Skip to content

cp: name the directory when -r cannot create it - #16797

Merged
cakebaker merged 1 commit into
uutils:mainfrom
binhvq:cp-create-directory-error
Nov 27, 2026
Merged

cakebaker merged 1 commit into
uutils:mainfrom
binhvq:cp-create-directory-error

Conversation

@binhvq

@binhvq binhvq commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

With a missing parent, cp -r dir no-such/dir failed in the into-itself check while canonicalizing the target and printed a bare No such file or directory (os error 2). That check now accepts a target whose parents don't exist yet, and build_dir adds cannot create directory 'X' to its error (which also covers subdirectories, e.g. a read-only parent).

Closes #16796

A target whose parent was missing failed the into-itself check while
canonicalizing, so 'cp -r dir no-such/dir' printed a bare 'No such file
or directory (os error 2)'. Let that check accept missing parents and
give the directory creation error its path.
@sylvestre
sylvestre force-pushed the cp-create-directory-error branch from 09f3ff2 to 436f8c4 Compare November 24, 2026 21:44
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Congrats! The gnu test tests/tail/debug is no longer failing!

@cakebaker
cakebaker merged commit f5a7259 into uutils:main Nov 27, 2026
105 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

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.

cp: -r into a missing parent prints a bare "No such file or directory (os error 2)"

2 participants