NetBSD-Bugs archive

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

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



The following reply was made to PR bin/57434; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/57434: cp(1) -P description is misleading.
Date: Wed, 24 May 2023 20:41:21 +0700

     Date:        Wed, 24 May 2023 09:50:00 +0000 (UTC)
     From:        isaki%pastel-flower.jp@localhost
     Message-ID:  <20230524095000.AA9341A9241%mollari.NetBSD.org@localhost>
 
   | The cp(1) manpage says the following about -P option:
   |      -P    No symbolic links are followed.  This is the default.
 
 Before I say anything else, let me first agree with you, the man page
 is not at all good (not clear).
 
   | But cp without -P (nor -R) follows symlinks.
 
 Not always.   It depends upon -r as well.   A simple cp of a file does
 follow symlinks, a cp -r of a directory tree does not.   So whether -P
 is the default or not, depends...
 
 Of course, it also isn't great that cp(1) doesn't mention the -r flag
 at all (it is similar to -R, an older variant, but different).
 
   | When I see syntax in SYNOPSIS section, I can understand that -P should
   | be specified with -R.
 
 Actually, no, -P and -R aren't (quite) that closely related.   However -P
 is related to -H and -L (at most 1 of those three can be set) and -H and -L
 only apply when -R is set.   It is all very murky...   (-r and -R can't both
 be used, in fact, with -r, none of -R -P -L or -H can also be set - which
 is kind of odd, as -r kind of implies -P, without setting it).
 
   | However, -P can be specified without -R.  I don't know what is correct
   | (intended) situation, but the followings are that I observed:
 
 I believe your observations are correct.   However (unsuprisingly) you
 didn't test the (rather older) -r option - when that's set -P is (more or
 less) set as well (it is, but it isn't....)
 
 kre
 


Home | Main Index | Thread Index | Old Index