mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 19:52:20 +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. See70368c57
. The change to init.c in the Red Hat patch applied in18b3f4aa
(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:
parent
e72543a9fa
commit
f033bb0351
2 changed files with 2 additions and 9 deletions
|
@ -34,8 +34,6 @@
|
|||
* > happen is that the trap is marked for execution (sh_trapnote) and run after
|
||||
* > the current command completes. The time trap should wake up the shell if
|
||||
* > it is blocked and it should return and then handle the trap.
|
||||
*
|
||||
* When that is done, the save_ifstable workaround can probably be removed.
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
@ -153,12 +151,7 @@ void sh_timetraps(Shell_t *shp)
|
|||
{
|
||||
tp->flags &= ~L_FLAG;
|
||||
if(tp->action)
|
||||
{
|
||||
char save_ifstable[256];
|
||||
memcpy(save_ifstable,shp->ifstable,sizeof(save_ifstable));
|
||||
sh_fun(tp->action,tp->node,(char**)0);
|
||||
memcpy(shp->ifstable,save_ifstable,sizeof(save_ifstable));
|
||||
}
|
||||
tp->flags &= ~L_FLAG;
|
||||
if(!tp->flags)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue