home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
std_unix
/
v21
/
041
< prev
next >
Wrap
Internet Message Format
|
1990-12-05
|
3KB
From news@cs.utexas.edu Fri Aug 17 13:18:08 1990
Received: from cs.utexas.edu by uunet.uu.net (5.61/1.14) with SMTP
id AA08387; Fri, 17 Aug 90 13:18:08 -0400
Posted-Date: 17 Aug 90 09:46:37 GMT
Received: by cs.utexas.edu (5.64/1.70)
id AA06249; Fri, 17 Aug 90 12:18:01 -0500
From: ast@cs.vu.nl (Andy Tanenbaum)
Newsgroups: comp.std.unix
Subject: Query about P1003.2 'cp' utility
Message-Id: <439@usenix.ORG>
Sender: std-unix@usenix.ORG
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
X-Submissions: std-unix@uunet.uu.net
Date: 17 Aug 90 09:46:37 GMT
Reply-To: std-unix@uunet.uu.net
To: std-unix@uunet.uu.net
From: Andy Tanenbaum <ast@cs.vu.nl>
While studying the P1003.2 description of the 'cp' utility, I ran into an
ambiguity. In paragraph 4.13.2 (description), line 1985 & 1996-2000, it says:
(1) If the destination path exists:
(b) If the permissions of the file to which the destination path
refers to do not permit writing, actions are performed equivalent to
the unlink() #5.5.1[POSIX.1] function call using destination as the
path argument, and, if this fails for any reason...
In paragraph 4.13.3 (options), next page, lines 2010 & 2011 says:
-f For each existing destination pathname, remove it and create a new
file, without prompting for confirmation regardless of its permissions
Now, I believe that the description should say:
(b) If the permissions of the file to which the destination path
refers to do not permit writing, or if the -f option is specified, ...
to be consistent, but then "cp -f" would snap any existing links to the
destination file, and even change the destination file mode, owner and group
(without a -p being specified), while "cp" wouldn't.
Example:
-rw-r--r-- 1 user1 group1 srcfile
-rw-rw-rw- 2 user2 group2 dstfile
If user3 (group3) invokes cp srcfile dstfile, then the dstfile's mode, owner,
group and links do not change. However, if cp -f srcfile dstfile is invoked,
then the dstfile becomes:
-rw-r--r-- 1 user3 group3 dstfile
Now, this behavior might be correct, but is this effect really intended by
P1003.2? Possibly, the user that wish to replace the dstfile entirely (as
opposed to overwriting it) should use rm BEFORE calling cp, and the -f option
should be used only to suppress interaction with the user.
Maybe draft 10 clarifies the situation?
Vincent Archer | Email:archer%segin4.segin.fr@relay.prime.com
"People that are good at finding excuses are never good at anything else"
(Posted by Andy Tanenbaum because Vincent does not have USENET access.)
Volume-Number: Volume 21, Number 41