Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Sep 2002 03:40:04 -0700 (PDT)
From:      Ralf Becker <ralf@akk.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/42789: cp -p may report wrong exit status
Message-ID:  <200209171040.g8HAe4Po070287@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/42789; it has been noted by GNATS.

From: Ralf Becker <ralf@akk.org>
To: Slaven Rezic <slaven.rezic@berlin.de>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/42789: cp -p may report wrong exit status
Date: Tue, 17 Sep 2002 12:33:26 +0200

 On Mon, Sep 16, 2002 at 03:55:41PM +0200, Slaven Rezic wrote:
 > The current behavior is that cp tries to copy all traversed files,
 > regardless of an error in an individual copy. If there was at least
 > one error, then rval is set to 1 and returned at the end of cp (except
 > for the bug below).
 Yes, i realized it
 > 
 > So you want to stop cp at the first error? What's the opinion of POSIX
 > on this?
 
 In the POSIX-Specs is written (excerpt :-)):
 **
 d. The contents of source_file shall be written to the file descriptor.
 Any write errors shall cause cp to write a diagnostic message to standard
 error and continue to step 3e.
 
 e.The file descriptor shall be closed.
 
 f.The cp utility shall do nothing more with source_file.  If a write
 error occurred in step 3d, it is unspecified if cp continues with any
 remaining files. If no write error occurred in step 3d, cp shall go on
 to any remaining files.
 **
 
 So, the situation is more clear. Your change is absolutly neccessary to
 preserve the return value of copy_*  in the case of any error.
 The remaining question if cp should stop on write errors is a question
 of taste.
 (My understanding of f. is, that cp should continue if
 read, open ... on the source file fails.)
 
 Ralf
 -- 
 Ralf Becker           ralf@akk.org 
 Arbeitskreis Kultur und Kommunikation / Universitaet Karlsruhe
 Paulckeplatz 1        76131 Karlsruhe
 Tel 0721/96403-22     Fax 0721/608-4019 
 --------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209171040.g8HAe4Po070287>