586fd24857
Code like t=$(stat -f %m "$file") segfaulted if -T was active and a trap was taken while the shell was waiting for the child process to finish. What happened was that the dotrap() call in waitforjob() was hit. This re-entered command execution (including expand.c) at a point not expected by expbackq(), and global state (unallocated stack string and argbackq) was corrupted. To fix this, change expbackq() to prepare for command execution to be re-entered. Reported by: bdrewery MFC after: 1 week
7 lines
110 B
Plaintext
7 lines
110 B
Plaintext
# $FreeBSD$
|
|
|
|
set -T
|
|
trapped=''
|
|
trap "trapped=x$trapped" TERM
|
|
[ "x$(:; kill $$)y" = xy ] && [ "$trapped" = x ]
|