Date: Tue, 10 Sep 2002 02:59:34 +0200 (CEST) From: Matthias Andree <matthias.andree@web.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/42617: rename(2) IEEE Std 1003.1-2001 Violation Message-ID: <200209100059.g8A0xYLA011560@libertas.emma.line.org>
next in thread | raw e-mail | index | archive | help
>Number: 42617 >Category: kern >Synopsis: rename(2) IEEE Std 1003.1-2001 Violation >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Sep 09 18:00:13 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Matthias Andree >Release: FreeBSD 4.7-PRERELEASE i386 >Organization: >Environment: System: FreeBSD libertas.emma.line.org 4.7-PRERELEASE FreeBSD 4.7-PRERELEASE #0: Sun Sep 8 04:09:31 CEST 2002 toor@libertas.emma.line.org:/usr/src/sys/compile/LIBERTAS i386 >Description: 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. Whether this constitutes a real bug, is a moot point. The rationale is to avoid rename("same", "same") having the same effect as unlink("same"). (FreeBSD is right about this one.) Linux 2.4.18 and Solaris 8 get it right. >How-To-Repeat: Compile this program and run it, then give "ls ?". If you see two files, "a" and "b", everything is fine. If you see only file "b", this is a violation. /* include: unistd.h, fcntl.h, stdio.h */ #include <unistd.h> #include <fcntl.h> #include <stdio.h> int main(void) { unlink("a"); unlink("b"); close(open("a", O_CREAT|O_WRONLY, 0644)); link("a", "b"); rename("a", "b"); return (0); } >Fix: >Release-Note: >Audit-Trail: >Unformatted: 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?200209100059.g8A0xYLA011560>