Re: FreeBSD 5.4: 'cp -p' does not behave as documented

2006-08-28 Thread David King

According to the cp man page:
-p  Cause cp to preserve the following attributes of each source file
   in the copy: modification time, access time, file flags, file  
mode,

   user ID, and group ID, as allowed by permissions.

   If the user ID and group ID cannot be preserved, no error message
   is displayed and the exit value is not altered.
However, when I run this script or when I do a cp -p manually I am  
seeing:

cp: chown: /stats/maillogs/maillog-copy-test.bz2: Permission denied
You need to run this as root so the permissions and ownership all  
can be set.

-Derek


I think you misunderstand the poster's complaint. It's not that the  
permissions aren't being set, it's that the documentation is  
incorrect. This part:

If the user ID and group ID cannot be preserved, no error message
is displayed and the exit value is not altered.
is not in accordance to the behaviour that they are seeing. The owner  
and/or group could not be set, but cp(1) fails, and displays a  
message, but the documentation says that it should not display an  
error message or fail. 
___

freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: FreeBSD 5.4: 'cp -p' does not behave as documented

2006-08-28 Thread Derek Ragona
You need to run this as root so the permissions and ownership all can be 
set.


-Derek


On Mon, 28 Aug 2006, Gabriel O'Brien wrote:


Hi folks,

FreeBSD 5.4-RELEASE-p6 i386

We have a script in our environment that is used to back up our mail logs. 
In essence it does:


cp -p /var/log/maillog.0.bz2 /stats/maillogs/maillog-testcopy.bz2

According to the cp man page:



-p  Cause cp to preserve the following attributes of each source file
   in the copy: modification time, access time, file flags, file mode,
   user ID, and group ID, as allowed by permissions.

   If the user ID and group ID cannot be preserved, no error message
   is displayed and the exit value is not altered.



However, when I run this script or when I do a cp -p manually I am seeing:

cp: chown: /stats/maillogs/maillog-copy-test.bz2: Permission denied

For the record the user does not actually have permissions to do the chown, 
however we would still like to use 'cp -p' in order to preserve the remainder 
of the attributes and according to the docs this should be possible.  Does 
anybody have any insight?


I note this issue does not appear to exist on our FreeBSD 6.1 boxes.

cheers,
Gabriel O'Brien
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


FreeBSD 5.4: 'cp -p' does not behave as documented

2006-08-28 Thread Gabriel O'Brien

Hi folks,

FreeBSD 5.4-RELEASE-p6 i386

We have a script in our environment that is used to back up our mail 
logs.  In essence it does:


cp -p /var/log/maillog.0.bz2 /stats/maillogs/maillog-testcopy.bz2

According to the cp man page:



-p  Cause cp to preserve the following attributes of each source file
in the copy: modification time, access time, file flags, file mode,
user ID, and group ID, as allowed by permissions.

If the user ID and group ID cannot be preserved, no error message
is displayed and the exit value is not altered.



However, when I run this script or when I do a cp -p manually I am seeing:

cp: chown: /stats/maillogs/maillog-copy-test.bz2: Permission denied

For the record the user does not actually have permissions to do the 
chown, however we would still like to use 'cp -p' in order to preserve 
the remainder of the attributes and according to the docs this should be 
possible.  Does anybody have any insight?


I note this issue does not appear to exist on our FreeBSD 6.1 boxes.

cheers,
Gabriel O'Brien
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"