NetBSD Problem Report #40336

From dhgutteridge@sympatico.ca  Wed Jan  7 06:57:21 2009
Return-Path: <dhgutteridge@sympatico.ca>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 358A563B8B6
	for <gnats-bugs@gnats.netbsd.org>; Wed,  7 Jan 2009 06:57:21 +0000 (UTC)
Message-Id: <COL0-F1810FDD03BB84B819BB485B7DF0@phx.gbl>
Date: Wed, 07 Jan 2009 01:57:15 -0500
From: "David H. Gutteridge" <dhgutteridge@sympatico.ca>
To: gnats-bugs@netbsd.org
Subject: cp(1) -p man page detail out of sync with present reality

>Number:         40336
>Category:       bin
>Synopsis:       cp(1) -p man page detail out of sync with present reality
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 07 07:00:00 +0000 2009
>Closed-Date:    Sun Dec 23 01:34:22 +0000 2018
>Last-Modified:  Sun Dec 23 01:34:22 +0000 2018
>Originator:     David H. Gutteridge
>Release:        NetBSD 5.0_BETA
>Organization:
>Environment:


NetBSD arcusiii.nonus-porta.net 5.0_BETA NetBSD 5.0_BETA (ARCUSIII) #1: Sun 
Nov 30 14:34:57 EST 2008  
disciple@arcusiii.nonus-porta.net:/home/disciple/build/netbsd-5/usr/src/sys/arch/i386/compile/ARCUSIII 
i386
>Description:
Hello,

The man page for cp(1) says of the -p option: "If the user ID and group ID
cannot be preserved, no error message is displayed and the exit value is not
altered."  This doesn't seem to be true for the last two major releases of
NetBSD:

[disciple@arcusv:disciple]$ uname -a
NetBSD arcusv.nonus-porta.net 4.0_STABLE NetBSD 4.0_STABLE (ARCUSV) #0: Mon 
Oct  6 00:47:08 EDT 2008  
disciple@arcusiii.nonus-porta.net:/home/disciple/build/netbsd-4/usr/src/sys/arch/macppc/compile/obj/ARCUSV 
macppc
[disciple@arcusv:disciple]$ su -
Password:
[root@arcusv:root]# mount_msdos /dev/sd0a /mnt
[root@arcusv:root]# cp -p 
/home/disciple/Matisse_The_Girl_With_The_Green_Eyes.jpg /mnt/test/
cp: chown: /mnt/test/Matisse_The_Girl_With_The_Green_Eyes.jpg: Invalid 
argument
[root@arcusv:root]# echo $?
1
[root@arcusv:root]# cd /mnt/test/
[root@arcusv:test]# ls -l
total 288
-rwxr-xr-x  1 root  wheel  140712 Jan 31  2005 
Matisse_The_Girl_With_The_Green_Eyes.jpg

[disciple@arcusiii:disciple]$ uname -a
NetBSD arcusiii.nonus-porta.net 5.0_BETA NetBSD 5.0_BETA (ARCUSIII) #1: Sun 
Nov 30 14:34:57 EST 2008  
disciple@arcusiii.nonus-porta.net:/home/disciple/build/netbsd-5/usr/src/sys/arch/i386/compile/ARCUSIII 
i386
[disciple@arcusiii:disciple]$ su -
Password:
[root@arcusiii:root]# mount_msdos /dev/sd0e /mnt
[root@arcusiii:root]# cp -p /home/disciple/scale.wav /mnt/test/
cp: chown: /mnt/test/scale.wav: Invalid argument
[root@arcusiii:root]# echo $?
1
[root@arcusiii:root]# cd /mnt/test
[root@arcusiii:test]# ls -l
total 2896
-rwxr-xr-x  1 root  wheel  1477164 Jul 21  2007 scale.wav

If I recall correctly, the statement in the man page was true for NetBSD 
1.6.x
and 3.x, so something presumably has changed after that time.  (I mention 
this
in part because it violates the "principle of least surprise", though I 
can't
say I'm particularly fussed about it.)

(It appears the POSIX standard states this behaviour is undefined.  "The 
user
ID and group ID. If this duplication fails for any reason, it is unspecified
whether cp writes a diagnostic message to standard error."
[http://www.opengroup.org/onlinepubs/009695399/utilities/cp.html])

Regards,

Dave

>How-To-Repeat:

>Fix:


>Release-Note:

>Audit-Trail:
From: "David H. Gutteridge" <dhgutteridge@sympatico.ca>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/40336: cp(1) -p man page detail out of sync with present reality
Date: Thu, 24 Dec 2015 13:33:37 -0500

 This still seems relevant for currently supported releases.

 Dave

From: "David H. Gutteridge" <gutteridge@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40336 CVS commit: src/bin/cp
Date: Sun, 23 Dec 2018 01:29:23 +0000

 Module Name:	src
 Committed By:	gutteridge
 Date:		Sun Dec 23 01:29:23 UTC 2018

 Modified Files:
 	src/bin/cp: cp.1

 Log Message:
 Clarify a sentence about the error handling of cp(1)'s -p option.
 Addresses PR bin/40336.


 To generate a diff of this commit:
 cvs rdiff -u -r1.45 -r1.46 src/bin/cp/cp.1

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: gutteridge@NetBSD.org
State-Changed-When: Sun, 23 Dec 2018 01:34:22 +0000
State-Changed-Why:
Change committed.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.