Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

40.1. attr-2.6.0

Utilities to administer the extended attributes on filesystem objects

Version 2.6.0, release 2
Shelf base-libs — Low-level C libraries that the base system links
Phase 30_foundation (Build Foundation), 18 of 127 in build order
Licence GPL-2.0-or-later AND LGPL-2.1-or-later
Homepage https://savannah.nongnu.org/projects/attr
Build time 0.1 SBU
Installed size 300.4 KiB in 30 files
Recipe ports/core/base-libs/attr/kpkgbuild

About

attr is the library and tools for extended attributes, the name-value pairs a file system keeps beside a file’s data. getfattr, setfattr and attr read and write them; libattr’s attr_copy_file and attr_copy_fd copy them from one file to another. Those two functions are why the base userland depends on it: coreutils (cp -a, mv across file systems), sed and patch call them so that a file they copy or rewrite keeps its attributes, and acl’s configure requires its attr/error_context.h. The bootstrap’s builds of those programs have no libattr; see A minimal KDOS: 10_bootstrap.

Sources

Dependencies

Depends on: nothing a recipe names.

Required by (10): acl, coreutils, gettext, kfilemetadata, libarchive, libvirt, patch, rsync, sed, shadow.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/30_foundation/phase.env && kpkg install attr'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/base-libs/attr.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/base-libs/attr
echo 'd42fa374513180bb48cb11a46696f488240e5124ff1e6ad88b0abff706985612  attr-2.6.0.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/attr
SRC=$SRC_ROOT/attr-2.6.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf attr-2.6.0.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

./configure --prefix=/usr     	\
            --bindir=/bin     	\
            --sysconfdir=/etc   \
            --disable-nls
make
make DESTDIR=$PKG install

install -Dm644 "$SRC/doc/COPYING" "$PKG/usr/share/licenses/$name/COPYING"
install -Dm644 "$SRC/doc/COPYING.LGPL" "$PKG/usr/share/licenses/$name/COPYING.LGPL"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/attr, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf attr-2.6.0-2.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/attr, and runs the triggers its paths call for.

Contents

Installed programs: attr, getfattr, setfattr.

Installed libraries: libattr.a, libattr.so.

Installed directories: /usr/include/attr, /usr/share/doc/attr, /usr/share/licenses/attr.

Short descriptions

attr extended attributes on XFS filesystem objects
getfattr get extended attributes of filesystem objects
setfattr set extended attributes of filesystem objects
libattr.pc A library for filesystem extended attribute support

Notes

/etc/xattr.conf decides what every caller of the copy functions carries over. Each line names an attribute pattern and an action: permissions marks the ACL attributes, which a caller copies only when it preserves permissions, and skip marks attributes no copy should carry, such as XFS’s internal ones and security.evm, which only the kernel may write. An attribute the file does not name is copied.