** Description changed:

- Any attributes set for local variables aren't exported to subshells
- correctly, resulting in incorrect behaviour.
+ [ Impact ]
+ 
+  Any attributes set for local variables aren't exported to subshells
+ correctly, resulting in incorrect behaviour in the subshells.
+ 
+ This is due to a bug in that, the attributes from the parent aren't
+ copied to the subshells and thus not inherited.
+ 
+ [ Test Plan ]
  
  A reproducer:
  
  ```bash
  #!/bin/ksh
  
  function called_function_ext {
-     echo "In function_ext: int_typeset_declared_in_func_exported: 
${int_typeset_declared_in_func_exported}"
+     echo "In function_ext: int_typeset_declared_in_func_exported: 
${int_typeset_declared_in_func_exported}"
  }
  
  function call_from_main {
-     typeset -i int_typeset_declared_in_func_exported=444
+     typeset -i int_typeset_declared_in_func_exported=444
  
-     export int_typeset_declared_in_func_exported
-     echo "In call_from_main: int_typeset_declared_in_func_exported: 
${int_typeset_declared_in_func_exported}"
-     called_function_ext
+     export int_typeset_declared_in_func_exported
+     echo "In call_from_main: int_typeset_declared_in_func_exported: 
${int_typeset_declared_in_func_exported}"
+     called_function_ext
  }
  
  call_from_main
  ```
  
  It outputs:
  ```
  In call_from_main: int_typeset_declared_in_func_exported: 444
  In function_ext: int_typeset_declared_in_func_exported: 3421236
  ``
  
  Whereas correct output should be:
  ```
  In call_from_main: int_typeset_declared_in_func_exported: 444
  In function_ext: int_typeset_declared_in_func_exported: 444
  ```
  
+ [ Other Info ]
+ 
  Upstream bug: https://github.com/ksh93/ksh/issues/465
  
- This has been fixed in Noble. Intending to backport to Jammy.
+ Upstream fix:
+ https://github.com/ksh93/ksh/commit/870ca92a0821775a400445126bc87ade6b203f94
+ 
+ This works as expected on Noble which has a new version of ksh that
+ contains this fix.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2110614

Title:
  [SRU] Honour attributes for local assignments in subshells

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+bug/2110614/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to