From owner-freebsd-bugs Tue Sep 10 4:40: 9 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BD0C937B400 for ; Tue, 10 Sep 2002 04:40:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 789C643E65 for ; Tue, 10 Sep 2002 04:40:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g8ABe4JU026263 for ; Tue, 10 Sep 2002 04:40:04 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g8ABe3sD026257; Tue, 10 Sep 2002 04:40:03 -0700 (PDT) Date: Tue, 10 Sep 2002 04:40:03 -0700 (PDT) Message-Id: <200209101140.g8ABe3sD026257@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: kern/42617: rename(2) IEEE Std 1003.1-2001 Violation Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/42617; it has been noted by GNATS. From: Bruce Evans To: David Malone Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: kern/42617: rename(2) IEEE Std 1003.1-2001 Violation Date: Tue, 10 Sep 2002 21:38:57 +1000 (EST) On Tue, 10 Sep 2002, David Malone wrote: > On Tue, Sep 10, 2002 at 02:59:34AM +0200, Matthias Andree wrote: > > When using rename with old and new path referring to the same file (through > > hard links), old path is removed. This is a violation of IEEE Std 1003.1-2001. > > This is also a violation of the Single Unix Specification 2. Either demands > > that if the old argument and the new argument point to the same existing file, > > rename() shall do nothing and return success. > > Doing nothing and returning success would seem to be inconsistent > with C99: > > The rename function causes the file whose name is the string > pointed to by old to be henceforth known by the name given by > the string pointed to by new. The file named old is no longer > accessable by that name. This seems to be a bug in C90, since I think it stole rename() from POSIX and POSIX has always clearly specified that at least rename("x", "x") return successfully and perform no other action. The C standard requires an error for this case since making "x" inaccessible would be more surprising. > Mind you, it does say that if the new file exists before prior to > the rename call, then the behaviour is implimentation defined. What > does the wording in IEEE Std 1003.1-2001 look like? Better look at the whole standard since it is not very consistent and support for different interpretations is too easy to provide by not quoting everything relevant. My fix for this PR paraphrases small parts of it :-). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message