NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/57434: cp(1) -P description is misleading.

>Number:         57434
>Category:       bin
>Synopsis:       cp(1) -P description is misleading.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 24 09:50:00 +0000 2023
>Originator:     Tetsuya Isaki
>Release:        NetBSD 10.0_BETA
NetBSD 10.0_BETA amd64
The cp(1) manpage says the following about -P option:

     -P    No symbolic links are followed.  This is the default.

But cp without -P (nor -R) follows symlinks.

 % uname -srm
 NetBSD 10.0_BETA amd64
 % ln -s /netbsd test
 % ls -lF
 total 4
 lrwxr-xr-x  1 isaki  wheel  7 May 20 12:02 test@ -> /netbsd
 % which \cp
 % \cp test ./cp_default
 % \cp -P test ./cp_withP
 % ls -lF
 total 28828
 -rwxr-xr-x  1 isaki  wheel  29509280 May 20 12:02 cp_default*
 lrwxr-xr-x  1 isaki  wheel         7 May 20 12:03 cp_withP@ -> /netbsd
 lrwxr-xr-x  1 isaki  wheel         7 May 20 12:02 test@ -> /netbsd

When I see syntax in SYNOPSIS section, I can understand that -P should
be specified with -R.  I think that there needs to be a reference to
-R option in the description of -P, if so.

However, -P can be specified without -R.  I don't know what is correct
(intended) situation, but the followings are that I observed:
1. -P means that "no symbolic links are followed".
   (manpage and its behavior are consistent)
2. If -R is specified, -P is the default. (manpage doesn't explain it enough)
3. If -R is not specified, -P is not the default. (There is no explanation
   about this)
man cp
I don't have.

Home | Main Index | Thread Index | Old Index