Page MenuHomeFreeBSD

cp: Avoid prepending ./ in file-to-file case.
ClosedPublic

Authored by des on May 14 2025, 8:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 26, 2:30 AM
Unknown Object (File)
Sun, Sep 14, 5:30 AM
Unknown Object (File)
Aug 31 2025, 7:18 AM
Unknown Object (File)
Aug 28 2025, 1:21 PM
Unknown Object (File)
Aug 11 2025, 5:30 PM
Unknown Object (File)
Aug 5 2025, 8:46 PM
Unknown Object (File)
Aug 2 2025, 5:04 AM
Unknown Object (File)
Jul 5 2025, 11:09 PM
Subscribers

Details

Summary
  • Make to.base large enough to hold a trailing separator.
  • Remove the separator from warning and error messages.
  • In the FILE_TO_FILE case, leave to.base empty.
  • In the FILE_TO_DIR and DIR_TO_DNE cases, append a separator to to.base once we've (optionally created and) opened it.
  • Thus, in the file-to-file case, we print an empty string followed by to.path, while in all other cases, to.base already contains the necessary separator.

This fixes failures in tests that used cp and expected a specific
error message and were surprised to see "./" pop up.

Fixes: 82fc0d09e862
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable