cp: Do not trust st_size if it equals zero#24
Closed
ricardobranco777 wants to merge 1 commit into
Closed
Conversation
Author
|
Merged. |
netbsd-srcmastr
pushed a commit
that referenced
this pull request
Sep 2, 2025
bin/sh/cd.c: revision 1.54 bin/sh/cd.c: revision 1.55 bin/sh/cd.c: revision 1.56 PR standards/59565 - cd "" is now an error, not == cd . POSIX 2024 requires that cd "" generate an error message, and fail. Until now shells (including this one) have typically equated it to "cd ." as in the distant past, a lookup of "" as a path name would return the current directory (aka "."). From now on, we generate an error, as specified. (For this commit, the error message is kind of pathetic, but it is at least there - that will be fixed in a subsequent commit.) Improve error messages from cd builtin Have cd indicate (particularly for when CDPATH is in use, but also in other cases) which path name was attempted and failed, and why it failed. For CDPATH uses, when (if) the cd eventually fails, prefer the first entry in which the requested destination path is located (when the chdir() to it fails), or if there is none of those, the first lookup which failed to determine if the path exists there or not (ie: not ENOENT). If the all attempts return ENOENT simply report the arg given (after "cd -" and "cd a b" processing), as no one CDPATH entry is more appropriate than any other. Inspired by PR standards/59565 but not directly related. PR bin/59602 PWD update failure message from cd fix. Only complain about being unable to determine the new directory name after a cd when -e is given (test for that was forgotten).
netbsd-srcmastr
pushed a commit
that referenced
this pull request
Sep 2, 2025
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.
cp(1) cannot operate on files residing on pseudo-filesystems.
To reproduce: