[Toybox] [PATCH] tar: Fix support for long symbolic links

Rob Landley rob at landley.net
Thu Mar 21 13:24:11 PDT 2019


On 3/21/19 10:29 AM, enh wrote:
> https://github.com/landley/toybox/commit/14eee98d9dbe81729437bf333ea413b43e37969a#diff-2c433160b0e21dc043bae1484ee3077bL215
> switched to strncpy, but that patch upset clang:
> 
> external/toybox/toys/pending/tar.c:549:49: error: '&&' within '||'
> [-Werror,-Wlogical-op-parentheses]
>     if (filter(TT.excl, TT.hdr.name) || TT.incl && !delete) skippy(TT.hdr.size);
>                                      ~~ ~~~~~~~~^~~~~~~~~~
> 
> it's way too early in the morning for me to work out what was intended there...

&& has higher priority than || so it's doing exactly what it should be doing? I
dunno why the compiler is so upset. I can see the if (x = blah()) warning
because that's an easy typo to make, but && and || are not easily typoed...?
(Nor are - and & which it warns about mixing now. Give it time and it'll warn
about mixing + and * without parentheses.)

Compilers maintained by C++ developers demand gratuitous parentheses despite
defined operator precedence because C++ developers are not to be trusted and
this warning is enabled even for C code. They you have -Werror enabled so it
becomes an error...

(I note that I could hold off checking in any of the changes until it's done and
just do a single flag day change. If that's how I should clean up commands
Android's using out of pending, I can do that? I don't want to inconvenience you
guys more than necessary...)

Rob



More information about the Toybox mailing list