Skip to content

configure.ac: check for xattr support both in libc and in -lattr #753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eli-schwartz
Copy link

In 2015, the attr/xattr.h header was fully removed from upstream attr.

In 2020, rsync started preferring the standard header, if it exists: #22

But the fix was incomplete. We still looked for the getxattr function in -lattr, and used it if -lattr exists. This was the case even if the system libc was sufficient to provide the needed functions. Result: overlinking to -lattr, if it happened to be installed for any other reason.

checking whether to support extended attributes... Using Linux xattrs
checking for getxattr in -lattr... yes

Instead, use a different autoconf macro that first checks if the function is available for use without any libraries (e.g. it is in libc).

Result:

checking whether to support extended attributes... Using Linux xattrs
checking for library containing getxattr... none required

In 2015, the attr/xattr.h header was fully removed from upstream attr.

In 2020, rsync started preferring the standard header, if it exists:
RsyncProject#22

But the fix was incomplete. We still looked for the getxattr function in
-lattr, and used it if -lattr exists. This was the case even if the
system libc was sufficient to provide the needed functions. Result:
overlinking to -lattr, if it happened to be installed for any other
reason.

```
checking whether to support extended attributes... Using Linux xattrs
checking for getxattr in -lattr... yes
```

Instead, use a different autoconf macro that first checks if the
function is available for use without any libraries (e.g. it is in
libc).

Result:

```
checking whether to support extended attributes... Using Linux xattrs
checking for library containing getxattr... none required
```

Signed-off-by: Eli Schwartz <[email protected]>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Apr 23, 2025
When USE=xattr is enabled, the configure script checks for -lattr and
attempts to link to it for good luck. It also checks for attr/xattr.h,
but only includes it in an if/elif when sys/xattr.h doesn't exist --
this makes sense, since the former simply #includes the latter and then
emits a #warning telling you to migrate to libc. Presumably, this is
meant as a sort of infinite compatibility thing and "it's fine if you
use --as-needed" in practice.

rsync doesn't actually include any of libattr's non-deprecated headers,
just xattr.h and at runtime libattr.so is not needed despite
automagically detecting it during configure.

Upstream fix for false detection: RsyncProject/rsync#753

Fixes:
```
 * VDB: detected possibly incorrect RDEPEND (net-misc/rsync-3.3.0-r2)
 * sys-apps/attr <
```

No revbump, this package won't be depcleaned anyway so forcing a rebuild
feels pointless.

Signed-off-by: Eli Schwartz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant