Re: [PATCH] eval: make traps work when "set -e" is enabled

2018-12-13 Thread Herbert Xu
Antonio Ospite wrote: > When "set -e" is enabled traps are not always executed, in particular > the EXIT trap is not executed when the shell exits on an unhandled > error. > > Consider the following test script: > > #!/bin/dash > > set -e > > trap 'ret=$?; echo "EXIT: $ret"' EXIT > trap

Re: [PATCH 0/5] Build system updates and gcc warnings fixes

2018-12-13 Thread Herbert Xu
Antonio Ospite wrote: > Hi, > > here are some build system updates and some fixes for compilation > warnings with Gcc. > > After this patchset, compilation with Gcc is nice and clean, > > There are still some warnings when compiling with clang but I have not > addressed those. > > Thank you.

[v3 PATCH] eval: Only restore exit status on exit/return

2018-12-13 Thread Herbert Xu
Herbert Xu wrote: > > Here is a new patch that fixes the reported issue for both signal > traps and the EXIT trap. This introduced a warning in trap.c. Here is an update to silence the warning. ---8<--- We unconditionally restore the saved status in exitreset, which is incorrect as we only

Re: [PATCH] Make mktokens accept a random TMPDIR, replace `...` with $(...).

2018-12-13 Thread Herbert Xu
Devin Hussey wrote: > From 31afca233f67dde67181efd7ed594cd2c25fefa6 Mon Sep 17 00:00:00 2001 > From: Devin Hussey > Date: Thu, 15 Nov 2018 10:30:05 -0500 > Subject: [PATCH] Make mktokens accept a random TMPDIR, replace `...` with > $(...). > > Sorry about the multiple commits at once. > >

Re: [PATCH] Use a real non-cryptographic hash algorithm

2018-12-13 Thread Herbert Xu
Devin Hussey wrote: > From 502cbd61e386eb014035df66b032e90a9de926b7 Mon Sep 17 00:00:00 2001 > From: Devin Hussey > Date: Thu, 15 Nov 2018 09:12:24 -0500 > Subject: [PATCH] Use a real non-cryptographic hash algorithm > > dash previously used a modified version of the LoseLose algorithm. > >

Re: [PATCH] var: ensure variables are fully initialised when unset

2018-12-13 Thread Herbert Xu
Harald van Dijk wrote: > [-- text/plain, encoding 7bit, charset: utf-8, 29 lines --] > > On 12/11/2018 12:53, Ron Yorston wrote: >> When a variable is unset by calling setvar(name, 0, 0) the code >> to initialise the new, empty variable omits the trailing '='. > > It's supposed to. A trailing =

Re: [v2 PATCH] eval: Only restore exit status on exit/return

2018-12-13 Thread Herbert Xu
On Thu, Dec 06, 2018 at 09:35:47PM +, Harald van Dijk wrote: > On 04/12/2018 23:57, Harald van Dijk wrote: > > This has the benefit of fixing one other test case, a small modification > > from one of Martijn Dekker's: > > > >   $SHELL -c 'trap "set -o bad@option" INT; kill -s INT $$' && echo

Re: [v2 PATCH] eval: Only restore exit status on exit/return

2018-12-13 Thread Herbert Xu
On Sat, Dec 08, 2018 at 03:45:11PM +, Harald van Dijk wrote: > > --- a/src/eval.c > +++ b/src/eval.c > @@ -116,10 +116,7 @@ INCLUDE "eval.h" > EXITRESET { > evalskip = 0; > loopnest = 0; > - if (savestatus >= 0) { > - exitstatus = savestatus; > -

[PATCH v2] Create block-local FD state when appending redirection closing the FD

2018-12-13 Thread Martijn Dekker
[Corrected patch due to an oops in first take. Apologies.] Op 19-09-18 om 05:25 schreef Herbert Xu: Harald van Dijk wrote: On 23/04/2018 19:56, Martijn Dekker wrote: $ dash -c '{ exec 8 What surprises me most is that dash has code written specifically to keep the fd closed. dash would be

Re: [BUG] failure to push/restore closed file descriptor

2018-12-13 Thread Martijn Dekker
Op 19-09-18 om 05:25 schreef Herbert Xu: Harald van Dijk wrote: On 23/04/2018 19:56, Martijn Dekker wrote: $ dash -c '{ exec 8 What surprises me most is that dash has code written specifically to keep the fd closed. dash would be smaller and simpler if it behaved the way you expected and the