Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Aug 2006 14:32:48 -0700
From:      David King <dking@ketralnis.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: FreeBSD 5.4: 'cp -p' does not behave as documented
Message-ID:  <BC202692-AFCB-4851-8D07-835FDA925BDF@ketralnis.com>
In-Reply-To: <20060828134729.U57414@betty.computinginnovations.com>
References:  <44F33207.2070401@nm.cbc.ca> <20060828134729.U57414@betty.computinginnovations.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>> 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. 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BC202692-AFCB-4851-8D07-835FDA925BDF>