Skip to content

install: handle piped stdin when target exists#12418

Open
puneetdixit200 wants to merge 2 commits into
uutils:mainfrom
puneetdixit200:fix/12407-install-stdin-existing-target
Open

install: handle piped stdin when target exists#12418
puneetdixit200 wants to merge 2 commits into
uutils:mainfrom
puneetdixit200:fix/12407-install-stdin-existing-target

Conversation

@puneetdixit200
Copy link
Copy Markdown

Fixes #12407.

This updates the copy path to compare the opened source file metadata with the destination instead of canonicalizing the source path. That keeps openable special paths such as /dev/fd/0 working when the destination already exists while preserving same-file detection.

Tests:

  • cargo fmt --check
  • cargo test --features install --no-default-features test_install::test_install_from_stdin -- --nocapture
  • cargo test --features install --no-default-features test_install:: -- --nocapture
  • cargo test -p uu_install
  • cargo clippy --features install --no-default-features --all-targets -- -D warnings

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cut/cut-huge-range is now passing!


if let Ok(to_meta) = metadata(to) {
let from_meta = handle.metadata()?;
if from_meta.dev() == to_meta.dev() && from_meta.ino() == to_meta.ino() {
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.

please add a comment to explain this

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.

install with piped input fails if target file exists

2 participants