Skip to content

"failed to determine package fingerprint for build script" caused by a symlink pointing to an unreadable directory #9881

@tavianator

Description

@tavianator

Problem

If a project with a build script has a symbolic link pointing to somewhere unreadable, cargo build fails.

Steps

$ git clone https://github.com/sharkdp/fd.git  # For example
$ cd fd
$ ln -s /root root  # Normal users can't read /root
$ cargo build
error: failed to determine package fingerprint for build script for fd-find v8.2.1 (/home/tavianator/code/sharkdp/fd)

Caused by:
  failed to determine the most recently modified file in /home/tavianator/code/sharkdp/fd

Caused by:
  failed to determine list of files in /home/tavianator/code/sharkdp/fd

Caused by:
  cannot read "/home/tavianator/code/sharkdp/fd/root"

Caused by:
  Permission denied (os error 13)

Possible Solution(s)

I suggest not following symbolic links when calculating the fingerprint.

I actually ran into this with a symlink to /, which caused

Caused by:
  cannot read "/home/tavianator/code/sharkdp/fd/why/dev/vboxusb"

meaning it was trying to recursively scan my whole file system.

Notes

Output of cargo version:

cargo 1.53.0 (4369396ce 2021-04-27)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-build-scriptsArea: build.rs scriptsA-rebuild-detectionArea: rebuild detection and fingerprintingC-bugCategory: bugE-mediumExperience: Medium

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions