tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Implement dash as bootstrap shell



Le 06/12/15 14:11, Jonathan Perkin a écrit :
> * On 2015-12-06 at 07:46 GMT, Richard PALO wrote:
> 
>> So I built dash and quickly tested this, the problem seems to be still current:
>>> $ richard@omnis:/home/richard$ dash
>>> $ trap date 1
>>> $ trap whoami 2
>>> $ trap 1 2 13 15
>>> $ 
>>>  6 décembre 2015 08:40:00 CET
>>> $ 
>>> dash: 1: 1: not found
>>
>> the above is after a 'kill -1 <pid>' followed by a 'kill -2 <pid>'
>>
>> I do the same test with ksh, bash and pdksh, it seems to work correctly.
> 
> Which scripts use this behaviour?
> 
> Try this diff:
> 
> ===
> diff --git a/shells/dash/files/src/trap.c b/shells/dash/files/src/trap.c
> index 17316c9..8e4e2aa 100644
> --- a/shells/dash/files/src/trap.c
> +++ b/shells/dash/files/src/trap.c
> @@ -118,3 +118,3 @@ trapcmd(int argc, char **argv)
>         }
> -       if (!ap[1])
> +       if ((!ap[1]) || (decode_signal(*ap, 0) > 0))
>                 action = NULL;
> ===
> 
> If that solves the issue I'll look at sending this upstream, so it will be
> useful to have examples of this usage in the wild.
> 
> Cheers,
> 

Great, this patch satisfies me, I tried both forms which seem to behave as expected now.

> richard@omnis:/home/richard/src/pkgsrc/shells/dash$ /tmp/pkgsrc/shells/dash/work/.destdir/opt/local/bin/dash 
> $ trap 'date' 1
> $ trap 'whoami' 2
> $ trap 1 2 13 15
> $ Hangup
> richard@omnis:/home/richard/src/pkgsrc/shells/dash$ /tmp/pkgsrc/shells/dash/work/.destdir/opt/local/bin/dash 
> $ trap 'date' 1
> $ trap 'whoami' 2
> $ trap -- 1 2 13 15
> $ Hangup

+1
cheers!

-- 
Richard PALO



Home | Main Index | Thread Index | Old Index