install: refuse a -t target that is not a directory with one source - #14997
Merged
Merged
Conversation
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").
abendrothj
force-pushed
the
install-t-not-a-directory
branch
from
October 1, 2026 04:30
2cdc30a to
53bdf11
Compare
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With a single source and no
-D,install -t X ftreatedXas the file to install as unless it already looked like a directory, so a regular file, symlink or fifo atXwas replaced and a missingXwas created as a file, with exit status 0. GNU refuses all of these.Every
-tinvocation now goes through the same path as multiple sources, which checks that the target is a directory, and the error for-tnow reads like GNU's:failed to access 'X': Not a directory(orNo such file or directory).-D -tand-tinto an existing directory are unchanged.Closes #14996