Skip to content

cp: reuse the open dest fd when a reflink clone falls back - #14136

Open
sylvestre wants to merge 2 commits into
uutils:mainfrom
sylvestre:lp-2164777
Open

cp: reuse the open dest fd when a reflink clone falls back #14136
sylvestre wants to merge 2 commits into
uutils:mainfrom
sylvestre:lp-2164777

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor

Copilot AI lite review requested due to automatic review settings August 25, 2026 14:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/symlink (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/tail-n0f (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/unexpand/bounded-memory is now being skipped but was previously passing.
Congrats! The gnu test tests/dd/no-allocate is now passing!

Copilot AI review requested due to automatic review settings August 25, 2026 17:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@oech3

oech3 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

fixes #13185 ?

With a umask that strips the owner write bit (e.g. 333), the dest is
created read-only, so re-opening it by path after a failed
ioctl_ficlone raised EACCES and left an empty file behind.

While reworking the fallback:
- report the ioctl_ficlone error instead of a stale errno, and remove a
  freshly created dest when --reflink=always fails, matching GNU
- keep the sparse copy size as u64 to avoid a 32-bit panic on >= 4 GiB
  sources, and stop the copy loop on early EOF
- avoid a step_by(0) panic when an empty source gains data mid-copy

Fixes https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2164777
Only a failure to preserve the SELinux security context empties the
destination; other attribute failures leave the copied data in place.
Restrict the truncation to context errors, and make it work when the
destination mode has no write bit.
Copilot AI review requested due to automatic review settings August 26, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants