From owner-freebsd-bugs Mon Sep 9 18: 0:25 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 06C0337B405 for ; Mon, 9 Sep 2002 18:00:16 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B636543E75 for ; Mon, 9 Sep 2002 18:00:14 -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 g8A10EJU046739 for ; Mon, 9 Sep 2002 18:00:14 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g8A10Ebn046738; Mon, 9 Sep 2002 18:00:14 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F9F737B400 for ; Mon, 9 Sep 2002 17:59:41 -0700 (PDT) Received: from mail.dt.e-technik.uni-dortmund.de (krusty.dt.E-Technik.Uni-Dortmund.DE [129.217.163.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id CDACE43E42 for ; Mon, 9 Sep 2002 17:59:40 -0700 (PDT) (envelope-from matthias.andree@web.de) Received: from m2a2.myip.org (localhost [127.0.0.1]) by mail.dt.e-technik.uni-dortmund.de (Postfix) with ESMTP id 1D075A3835 for ; Tue, 10 Sep 2002 02:59:39 +0200 (CEST) Received: from libertas.emma.line.org (libertas.emma.line.org [192.168.0.2]) by merlin.emma.line.org (Postfix) with ESMTP id 28DEE1A for ; Tue, 10 Sep 2002 02:59:36 +0200 (CEST) Received: from libertas.emma.line.org (localhost [127.0.0.1]) by libertas.emma.line.org (8.12.6/8.12.6) with ESMTP id g8A0xZTx011561 for ; Tue, 10 Sep 2002 02:59:35 +0200 (CEST) (envelope-from emma@libertas.emma.line.org) Received: (from emma@localhost) by libertas.emma.line.org (8.12.6/8.12.6/Submit) id g8A0xYLA011560; Tue, 10 Sep 2002 02:59:34 +0200 (CEST) Message-Id: <200209100059.g8A0xYLA011560@libertas.emma.line.org> Date: Tue, 10 Sep 2002 02:59:34 +0200 (CEST) From: Matthias Andree Reply-To: Matthias Andree To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/42617: rename(2) IEEE Std 1003.1-2001 Violation 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 >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 #include #include 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