Hi Gordon, > > It seems to me that many GNU packages (coreutils, emacs, gettext, sed, at > > least) include <sys/xattr.h> only for the purpose of ACLs. > > That was why I was trying to make them work, yes. The libacl package > requires them and is in turn taken advantage of if present by a great many > other things. > ... > From what you say, it really might make more sense to build off of what the > GNU tar and wget2 projects have already got -- it sounds like they're already > further along than I got.
So, what is your actual goal? Do you want to make the Linux libacl work on more platforms? Then Gnulib is not involved, because - Gnulib uses libacl, not the other way around, - Gnulib already has specific code for each platform (excluding the new ACLs in NetBSD 10). Or do you want to make it easy for programs to store and read extended attributes, like wget2 does? In this case a new Gnulib module is appropriate. > > GNU tar needs variants with *at, which it declares in xattr-at.h. > > I'll be honest, I'd never even heard of those variants until now. Neither did I. But I did a code search https://codesearch.debian.net/search?q=include+%3Csys%2Fxattr.h%3E&literal=1 and looked at a few of the packages that use <sys/xattr.h>. > > GNU wget2 needs it in order to set > > user.mime_type > > user.charset > > user.xdg.origin.url > > user.xdg.referrer.url > > user.last_modified > > attributes, and has code for it on Linux, macOS, FreeBSD (the code for > > FreeBSD being obviously buggy). > > "Obviously"? Why? Because in wget2-2.1.0/src/wget_xattr.h, in the FreeBSD case, the expansions of the macros fsetxattr and fgetxattr are identical. > > Would you like to work on submitting a sys/xattr.h facility for Gnulib, > > that > > - covers all functions from glibc [1], > > - works on Linux, Hurd, macOS, FreeBSD, NetBSD, Cygwin, Android ? > > Would I like to? Certainly. Would I know how? Unfortunately not. The only way > I was able to get it to work on my Mac required overriding, and completely > re-implementing the relevant parts of, the system xattr.h file; and I can't > imagine it would be much different on those other platforms. How do you do > something like that and have it work cross-platform? We have good techniques in Gnulib for doing this overriding and re-implementing on specific platforms. You can take a look at e.g. lib/truncate.c and m4/truncate.m4 to see how it's done in simple cases. > As it is, I think even the C-language method I used might only reliably work > for GCC, which not everyone uses. No worry about this point. The Gnulib techniques work with all C and C++ compilers. Bruno