Skip to content

install: refuse a -t target that is not a directory with one source - #14997

Merged
cakebaker merged 1 commit into
uutils:mainfrom
abendrothj:install-t-not-a-directory
Oct 1, 2026
Merged

cakebaker merged 1 commit into
uutils:mainfrom
abendrothj:install-t-not-a-directory

Conversation

@abendrothj

@abendrothj abendrothj commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

With a single source and no -D, install -t X f treated X as the file to install as unless it already looked like a directory, so a regular file, symlink or fifo at X was replaced and a missing X was created as a file, with exit status 0. GNU refuses all of these.

Every -t invocation now goes through the same path as multiple sources, which checks that the target is a directory, and the error for -t now reads like GNU's: failed to access 'X': Not a directory (or No such file or directory). -D -t and -t into an existing directory are unchanged.

Closes #14996

Copilot AI balanced review requested due to automatic review settings October 1, 2026 04:21

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.

With a single source and no -D, `install -t X f` only installed into `X`
when `X` already looked like a directory; otherwise it fell through to the
file-to-file path and installed `f` as `X`. A regular file, a symlink or a
fifo at `X` was replaced and a missing `X` was created as a file, all with
exit status 0, where GNU refuses.

Route every -t invocation through copy_files_into_dir, as multiple sources
already are, so a target that is not a directory is reported instead. For
-t, report it the way GNU does: "failed to access 'X': Not a directory"
(or the lookup error, such as "No such file or directory").
Copilot AI balanced review requested due to automatic review settings October 1, 2026 04:30
@abendrothj
abendrothj force-pushed the install-t-not-a-directory branch from 2cdc30a to 53bdf11 Compare October 1, 2026 04:30

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.

@cakebaker
cakebaker merged commit 5f3aa7b into uutils:main Oct 1, 2026
97 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

@abendrothj
abendrothj deleted the install-t-not-a-directory branch October 1, 2026 08:39
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: -t without -D writes the file as the target when the target is not a directory

3 participants