bug-findutils
[Top][All Lists]
Advanced

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

[patch #9754] find: new '-attr' predicate to test inode flags


From: Bernhard Voelker
Subject: [patch #9754] find: new '-attr' predicate to test inode flags
Date: Sat, 9 Feb 2019 11:43:54 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0

Follow-up Comment #1, patch #9754 (project findutils):

Thanks for the patch.

For this size of contributions, we need to have the GNU copyright
assignment in place.  Are you willing to do that?

Re. attr in general: this is quite EXT2/3/4 && GNU Linux specific, no?
So such an extension would need to be 'configure'-able on platforms
where it is not available.

The #ifdef's in [1] are already quite complex, and doesn't seem to cover
further platforms the GNU findutils have to support.

[1]
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/tree/lib/e2p/fgetflags.c

E.g. on FreeBSD, I'm getting:


parser.c:27:10: fatal error: 'linux/fs.h' file not found
#include <linux/fs.h>
         ^~~~~~~~~~~~
1 error generated.


BTW: on GCC-8.2.1 on GNU/Linux (openSUSE:Tumbleweed), I'm getting
the following warnings:


make[3]: Entering directory '/media/big_data/berny/git/findutils/find'
  CC       parser.o
parser.c: In function 'parse_attr':
parser.c:923:7: error: suggest explicit braces to avoid ambiguous 'else'
[-Werror=dangling-else]
    if (!(iflag = attr_to_iflag (*p)))
       ^
parser.c:944:3: error: this 'else' clause does not guard...
[-Werror=misleading-indentation]
   else
   ^~~~
parser.c:947:5: note: ...this statement, but the latter is misleadingly
indented as if it were guarded by the 'else'
     our_pred = insert_primary (entry, expr);
     ^~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:1936: parser.o] Error 1
  CC       pred.o
pred.c: In function 'pred_attr':
pred.c:254:23: error: suggest parentheses around arithmetic in operand of '^'
[-Werror=parentheses]
   ret = (state.iflags & pred_ptr->args.intmask.and_mask ^
pred_ptr->args.intmask.xor_mask) != 0;
          ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:1936: pred.o] Error 1
  CC       util.o
util.c:281:1: error: function declaration isn't a prototype
[-Werror=strict-prototypes]
 get_iflags ()
 ^~~~~~~~~~
util.c: In function 'get_iflags':
util.c:281:1: error: old-style function definition
[-Werror=old-style-definition]
util.c:287:20: error: declaration of 'ret' shadows a previous local
[-Werror=shadow]
       int fd = -1, ret;
                    ^~~
util.c:283:7: note: shadowed declaration is here
   int ret = 0;
       ^~~
util.c:296:7: error: this statement may fall through
[-Werror=implicit-fallthrough=]
    if (state.curdepth == 0)
       ^
util.c:302:2: note: here
  case SYMLINK_NEVER_DEREF:
  ^~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:1936: util.o] Error 1


I didn't check the code exactly yet (especially the parsing), mainly to avoid
tainting myself in order to have a chance to re-implement -attr in the case
we want to add it and you are not willing to undergo the above mentioned
GNU copyright assignment.

A quick look unveils that your code misses the 'F' (Casefold) and the 'V'
(Verity)
flag, and I'm unsure how we could keep this in sync with e2fsprogs [2] in the
long run.

[2] https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/tree/lib/e2p/pf.c

I don't know if this has been discussed before - maybe the complexity
was the reason not to add -attr to find.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?9754>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]