Package: mksh
Version: 56c-1
Severity: normal
Tags: upstream

I have created a minimal script called "script" to show the problem.
To run this "script" from different shells I have created a small script called 
"run-script".
I expected, that mksh would print the lines "sub_shell_exit" and "shell_exit", 
but only "shell_exit" was printed.
A fix is important for me, to be able to support mksh in 
https://salsa.debian.org/bs/shellia.
Please confirm, that this is a bug and not the expected behaviour of mksh.

bs@sid:/tmp/bugreport$ cat script
fkt()
{
  trap -- "echo $1 >&2" EXIT
}
fkt shell_exit
$(fkt sub_shell_exit)

bs@sid:/tmp/bugreport$ cat run-script
#!/bin/sh
for sh in bash dash "busybox sh" mksh posh yash zsh; do
  set -x
  $sh ./script
  { set +x; } 2>/dev/null
  echo
done

bs@sid:/tmp/bugreport$ ./run-script
+ bash ./script
sub_shell_exit
shell_exit

+ dash ./script
sub_shell_exit
shell_exit

+ busybox sh ./script
sub_shell_exit
shell_exit

+ mksh ./script
shell_exit

+ posh ./script
shell_exit

+ yash ./script
sub_shell_exit
shell_exit

+ zsh ./script
shell_exit
sub_shell_exit

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.18.0-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages mksh depends on:
ii  libc6  2.27-6

Versions of packages mksh recommends:
ii  ed  1.14.2-2

mksh suggests no packages.

-- no debconf information

Reply via email to