Public bug reported:
Any attributes set for local variables aren't exported to subshells
correctly, resulting in incorrect behaviour.
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}"
}
function call_from_main {
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
}
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
```
Upstream bug: https://github.com/ksh93/ksh/issues/465
This has been fixed in Noble. Intending to backport to Jammy.
** Affects: ubuntu
Importance: Undecided
Status: Fix Released
** Affects: Ubuntu Jammy
Importance: Undecided
Assignee: Ponnuvel Palaniyappan (pponnuvel)
Status: In Progress
** Affects: Ubuntu Noble
Importance: Undecided
Status: Fix Released
** Tags: sts
** Also affects: Ubuntu Jammy
Importance: Undecided
Status: New
** Also affects: Ubuntu Noble
Importance: Undecided
Status: New
** Changed in: Ubuntu Noble
Status: New => Fix Released
** Changed in: ubuntu
Status: New => Fix Released
** Changed in: Ubuntu Jammy
Assignee: (unassigned) => Ponnuvel Palaniyappan (pponnuvel)
** Changed in: Ubuntu Jammy
Status: New => In Progress
** Description changed:
Any attributes set for local variables aren't exported to subshells
correctly, resulting in incorrect behaviour.
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
-
- 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
+ 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
}
-
+
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
```
Upstream bug: https://github.com/ksh93/ksh/issues/465
+
+ This has been fixed in Noble. Intending to backport to Jammy.
** Tags added: sts
--
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:
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