[Toybox] 81207825c50fa9a4ec1475024543f830dee247fd broke bionic build

Rob Landley rob at landley.net
Tue Jan 22 17:26:01 PST 2019


On 1/22/19 2:54 PM, enh via Toybox wrote:
> this hunk from 81207825c50fa9a4ec1475024543f830dee247fd:
> 
> diff --git a/toys.h b/toys.h
> index 4083725a..df37b55e 100644
> --- a/toys.h
> +++ b/toys.h
> @@ -108,7 +108,7 @@ extern struct toy_context {
>    char wasroot;            // dropped setuid
> 
>    // This is at the end so toy_init() doesn't zero it.
> -  jmp_buf *rebound;        // longjmp here instead of exit when do_rebound set
> +  sigjmp_buf *rebound;     // longjmp here instead of exit when do_rebound set
>    struct arg_list *xexit;  // atexit() functions for xexit(), set by sigatexit(
> )
>    void *stacktop;          // nested toy_exec() call count, or 0 if vforked
>  } toys;

Which was because of a warning the freebsd build threw...

> caused:
> 
> external/toybox/toys/net/netcat.c:188:37: error: incompatible pointer
> types assigning to 'sigjmp_buf *' (aka 'long (*)[33]') from 'jmp_buf
> *' (aka 'long (*)[32]') [-Werror,-Wincompatible-pointer-types]
>           if (toys.optflags&FLAG_L) NOEXIT(child = XVFORK());
>                                     ^~~~~~~~~~~~~~~~~~~~~~~~
> external/toybox/lib/lib.h:375:19: note: expanded from macro 'NOEXIT'
> #define NOEXIT(x) WOULD_EXIT(_noexit_res, x)
>                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
> external/toybox/lib/lib.h:367:16: note: expanded from macro 'WOULD_EXIT'
>   toys.rebound = &_noexit; \
>                ^ ~~~~~~~~
> 1 error generated.
> 
> hmm... looks like you always call setjmp (rather than sigsetjmp) but
> also always call siglongjmp?

That codepath is there for error_exit() and friends returning from NOFORK
commands, which are primarily shell builtins. Until I do toysh, they haven't
gotten a lot of testing. Sorry.

> so the real fix is probably to s/setjmp/sigsetjmp/ and move _noexit
> over to sigjmp_buf too:
> 
> #define WOULD_EXIT(y, x) do { jmp_buf _noexit; \
> 
> patch attached...

Applied,

Rob



More information about the Toybox mailing list