1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

alarm: don't save sh.ifstable (re: 18b3f4aa)

It is not correct to save sh.ifstable (a.k.a. shp->ifstable) before
calling a function and then restore it after; this can cause field
splitting to malfunction. See 70368c57.

The change to init.c in the Red Hat patch applied in 18b3f4aa
(shp->ifstable[0] = S_EOF) appears to be sufficient.

src/cmd/ksh93/bltins/alarm.c:
- Revert save/restore of sh.ifstable.

src/cmd/ksh93/tests/builtins.sh:
- Tweak the regression test to work correctly on a slower machine,
  i.e. a Raspberry Pi running FreeBSD 12.2 arm64 (thanks to hyenias
  for providing testing access).
This commit is contained in:
Martijn Dekker 2021-01-26 15:48:38 +00:00
parent e72543a9fa
commit f033bb0351
2 changed files with 2 additions and 9 deletions

View file

@ -996,11 +996,11 @@ done 3< <(builtin)
if (builtin alarm) 2>/dev/null
then got=$( { "$SHELL" -c '
builtin alarm
alarm -r alarm_handler +.001
alarm -r alarm_handler +.005
i=0
function alarm_handler.alarm
{
let "(++i) > 100" && exit
let "(++i) > 20" && exit
}
while :; do
echo cargo,odds and ends,jetsam,junk,wreckage,castoffs,sea-drift