Describe the bug
For any package whose src is a directory, it fails when I try to build locally from nixos-unstable.
This is happens whether src is a path, or fetchFromGitHub, or anything that is a /nix/store/... directory.
I think this is due to the coreutils 9.4 update, which we could rollback (see below).
After a bisect, it turned out to be the glibc upgrade 2.38-44 -> 2.39-5 8b24908 done in #287594
Steps To Reproduce
Steps to reproduce the behavior:
- Run the kernel
linuxKernel.packages.linux_lqx from stable (nixos-23.11)
- run
nix build -L 'nixpkgs/nixos-unstable#lsof' --rebuild
Expected behavior
Those packages build.
"Screenshots"
# nix build -L 'nixpkgs/nixos-unstable#lsof' --rebuild
lsof> Running phase: unpackPhase
lsof> unpacking source archive /nix/store/snvdq7fanjnd8kadmi3p8i2ivsqjmp3x-source
lsof> cp: setting permissions for 'source': Invalid argument
lsof> do not know how to unpack source archive /nix/store/snvdq7fanjnd8kadmi3p8i2ivsqjmp3x-source
# nix build -L 'nixpkgs/nixos-unstable#htop' --rebuild
htop> Running phase: unpackPhase
htop> unpacking source archive /nix/store/yw4lq506x7aimb4b6ifrdmga3x9n9xsv-source
htop> cp: setting permissions for 'source': Invalid argument
htop> do not know how to unpack source archive /nix/store/yw4lq506x7aimb4b6ifrdmga3x9n9xsv-source
Additional context
I am running on the Linux 6.5.11-lqx2 kernel, which is linuxKernel.packages.linux_lqx from stable (nixos-23.11).
From my debugging, this seems due to a regression in glibc, which changed the way they do chmod:
# With coreutils from nixos-23.11 (tried it manually outside the Nix sandbox)
/nix/store/59mv7mybz16jjvnkz4z5shqgaqm4k009-coreutils-full-9.3/bin/cp -pr --reflink=auto -- /nix/store/...-vim vim
# Success!
# With coreutils from nixos-unstable (tried both inside and outside the Nix sandbox)
/nix/store/ifzwv2xqwdnv1gz87rxkizi67py5p3vj-coreutils-9.4/bin/cp -pr --reflink=auto -- /nix/store/...-vim vim
# Error:
# /nix/store/ifzwv2xqwdnv1gz87rxkizi67py5p3vj-coreutils-9.4/bin/cp: setting permissions for 'vim': Invalid argument
Running coreutils from nixos-23.11 under strace gives this:
mkdirat(AT_FDCWD, "vim", 0555) = 0
newfstatat(AT_FDCWD, "vim", {st_mode=S_IFDIR|0555, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, "vim", O_RDONLY|O_NOFOLLOW|O_CLOEXEC|O_PATH) = 3
newfstatat(3, "", {st_mode=S_IFDIR|0555, st_size=4096, ...}, AT_EMPTY_PATH) = 0
chmod("/proc/self/fd/3", 040755) = 0
close(3) = 0
And coreutils from nixos-unstable under strace gives this:
mkdirat(AT_FDCWD, "vim", 0555) = 0
newfstatat(AT_FDCWD, "vim", {st_mode=S_IFDIR|0555, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
fchmodat2(AT_FDCWD, "vim", 040755, AT_SYMLINK_NOFOLLOW) = -1 EINVAL (Invalid argument)
According to the fchmodat manpage, EINVAL is returned when "Invalid flag specified in flags", which here is AT_SYMLINK_NOFOLLOW.
Above we can see:
AT_SYMLINK_NOFOLLOW: If pathname is a symbolic link, do not dereference it: instead operate on the link itself. This flag is not currently implemented.
Notify maintainers
Maintainers from glibc:
@edolstra @Ma27 @ConnorBaker
@vcunat might also be interested.
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 6.5.11-lqx2, NixOS, 23.11 (Tapir), 23.11.20240328.219951b`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.18.1`
- channels(root): `""`
- channels(minijackson): `""`
- nixpkgs: `/nix/store/9fpv0kjq9a80isa1wkkvrdqsh9dpcn05-source`
Add a 👍 reaction to issues you find important.
Describe the bug
For any package whose
srcis a directory, it fails when I try to build locally fromnixos-unstable.This is happens whether
srcis a path, orfetchFromGitHub, or anything that is a/nix/store/...directory.I think this is due to the coreutils 9.4 update, which we could rollback (see below).After a bisect, it turned out to be the glibc upgrade 2.38-44 -> 2.39-5 8b24908 done in #287594
Steps To Reproduce
Steps to reproduce the behavior:
linuxKernel.packages.linux_lqxfrom stable (nixos-23.11)nix build -L 'nixpkgs/nixos-unstable#lsof' --rebuildExpected behavior
Those packages build.
"Screenshots"
Additional context
I am running on the
Linux 6.5.11-lqx2kernel, which islinuxKernel.packages.linux_lqxfrom stable (nixos-23.11).From my debugging, this seems due to a regression in
glibc, which changed the way they dochmod:Running coreutils from nixos-23.11 under strace gives this:
And coreutils from nixos-unstable under strace gives this:
According to the
fchmodatmanpage,EINVALis returned when "Invalid flag specified in flags", which here isAT_SYMLINK_NOFOLLOW.Above we can see:
Notify maintainers
Maintainers from glibc:
@edolstra @Ma27 @ConnorBaker
@vcunat might also be interested.
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"and paste the result.Add a 👍 reaction to issues you find important.