Skip to content

builtins.readFileType regression on symlink handling #15617

@quantenzitrone

Description

@quantenzitrone

Describe the bug

builtins.readFileType doesn't resolve symlinks

in nix 2.18 and lix it does

Steps To Reproduce

$ mkdir -p test
$ touch test/file
$ ln -s test symlink
$ nix eval --impure --expr 'builtins.readFileType ./symlink/file'
error:
       … while calling the 'readFileType' builtin
         at «string»:1:1:
            1| builtins.readFileType ./symlink/file
             | ^

       error: path '/home/zitrone/symlink' is a symlink

Expected behavior

this is the behavior in nix 2.18 and lix:

$ nix eval --impure --expr 'builtins.readFileType ./symlink/file'
"regular"

Metadata

nix:

nix-env (Nix) 2.31.3`

lix:

nix-env (Lix, like Nix) 2.96.0-dev-pre20260328-dev_d0190cf
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/zitrone/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/zitrone/.local/share/flatpak/exports/etc/xdg/nix/nix.conf:/var/lib/flatpak/exports/etc/xdg/nix/nix.conf:/home/zitrone/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/zitrone/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/zitrone/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/ypfrasnv3jwdiw4v2ii5w9dbnc0cih72-lix-2.96.0-dev-pre20260328-dev_d0190cf/share

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions