Skip to content

[Bug]: Intermittent Permission Errors reading hard links from the mount directory #1937

Description

@kwasimensah

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

Basically reopening apple/containerization#509
Using this script

#!/usr/bin/env bash


for i in {1..100}
do
    rm -rf source_dir
    rm -rf dest_dir
    mkdir source_dir
    mkdir dest_dir
    for j in {1..100}
    do
        head -c 1000000 < /dev/urandom > source_dir/test${j}.txt
        chmod 555 source_dir/test${j}.txt
        link source_dir/test${j}.txt dest_dir/test_link${j}.txt
        chmod 555 dest_dir/test_link${j}.txt
    done

    abs_path="$(pwd)/dest_dir"
    # tar is arbitary. we just need a command that going to open and read every file in the directory
    container run -it --remove  --uid=1024 --mount=type=bind,source=${abs_path},target=/dest_dir debian:bookworm-slim tar -cf /tmp/test.tar /dest_dir
done

You will eventually see

tar: /dest_dir/test_link1.txt: Cannot open: Permission denied
tar: /dest_dir/test_link4.txt: Cannot open: Permission denied
tar: /dest_dir/test_link5.txt: Cannot open: Permission denied

Problem description

Intermittent EACCES errors when using hard links in mounts i.e a build system trying to share inputs across multiple actions and using containers as a sandbox.

Environment

- OS: macOs 26.4.1 (25E253)
- Xcode: N/A
- Container: container CLI version 1.0.0 (build: release, commit: ee848e3)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions