Your message dated Sun, 12 Jul 2020 22:37:41 -0400
with message-id <[email protected]>
and subject line Closing bug report
has caused the Debian Bug report #649968,
regarding ksh: traps and 'set -e' set inside a function are ignored
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
649968: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=649968
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: ksh
Version: 93u-1
Severity: important



Traps set inside KSH functions and 'set -e' (exit on error) command
are ignored when the function is used in a command substitution
and the command substitution $( ) is contained in a || or && command,
or is following an 'if'. This problem does not occur in pdksh.


EXAMPLE:


#!/bin/ksh

function foo {
  set -e
  trap 'print "ERR trap of foo" > /dev/fd/2' ERR
  false  #false, having exit status 1, should execute the trap and then 
terminate foo()
  print 'we should not be here'
  return 0
}

print 'first try'
s=$(foo) || print 'foo returned with a non-zero exit status'
echo "($s)"


print 'second try'
s=$(foo)
echo "($s)"


OUTPUT (ksh):

first try
(we should not be here)
second try
ERR trap of foo
()


OUTPUT (pdksh):

first try
ERR trap of foo
foo returned with a non-zero exit status
()
second try
ERR trap of foo
()





-- System Information:
Debian Release: wheezy/sid
  APT prefers oneiric-updates
  APT policy: (500, 'oneiric-updates'), (500, 'oneiric-security'), (500, 
'oneiric'), (100, 'oneiric-backports')
Architecture: i386 (i686)

Kernel: Linux 3.0.0-13-generic (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages ksh depends on:
ii  libc6                     2.13-20ubuntu5 Embedded GNU C Library: Shared lib

ksh recommends no packages.

ksh suggests no packages.

-- no debconf information



--- End Message ---
--- Begin Message ---
Thanks for the report.

I'm closing this as Oliver has provided the feedback on this one and
it's been nearly ten years. If you have anything else to add, please let
us know. Thanks.

--- End Message ---

Reply via email to