From owner-freebsd-hackers Wed Apr 10 0:15:14 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from icomag.de (ns.icomag.de [195.227.115.162]) by hub.freebsd.org (Postfix) with ESMTP id C0BF737B41A for ; Wed, 10 Apr 2002 00:15:06 -0700 (PDT) Received: from localhost (bgd@localhost) by icomag.de (8.11.3/8.11.3) with ESMTP id g3A7DIM79906 for ; Wed, 10 Apr 2002 09:13:18 +0200 (CEST) (envelope-from bgd@icomag.de) Date: Wed, 10 Apr 2002 09:13:18 +0200 (CEST) From: Bogdan TARU X-X-Sender: To: Subject: 'rm' incompatibility with Posix.2 Message-ID: <20020410091302.Y79904-200000@fw.cgn.icom> MIME-Version: 1.0 Content-Type: MULTIPART/Mixed; BOUNDARY="0-1447739591-1018344787=:75449" Content-ID: <20020410091302.X79904@fw.cgn.icom> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-1447739591-1018344787=:75449 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-ID: <20020410091302.W79904@fw.cgn.icom> Hi everyone, I have noticed quite some time ago a strange way in which some basic FreeBSD utilities work, related to symlinks. Example session: bgd@cvs$ mkdir temp bgd@cvs$ ln -s temp b bgd@cvs$ ls -ald temp b lrwxr-xr-x 1 bgd wheel 4 Apr 9 11:27 b -> temp drwxr-xr-x 2 bgd wheel 512 Apr 9 11:27 temp bgd@cvs$ rm -rf b/ bgd@cvs$ ls -ald temp b ls: temp: No such file or directory lrwxr-xr-x 1 bgd wheel 4 Apr 9 11:27 b -> temp bgd@cvs$ As you can see, when I tried to remove the symlink 'b' with a trailing slash 'rm -rf b/', the target directory was removed instead of the actual symlink. Of course, this is weird (tryied it on some other 10 un*xes, and all worked in another way). I have attached a patch for the 'rm' untility, which strips the trailing slash(es) from the path (according to Posix.2). But I think there are many other utilities which need to be patched (e.g. cp, mv). Greetings, bogdan --0-1447739591-1018344787=:75449 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="rm.patch" Content-Transfer-Encoding: BASE64 Content-ID: <20020409113307.B75449@fw.cgn.icom> Content-Description: Content-Disposition: ATTACHMENT; FILENAME="rm.patch" MGExLDINCj4gDQo+IA0KNDYzLDQ3MGQ0NjQNCjwgICAgICAgICAgICAgICAg IC8qIHN0cmlwIHRyYWlsaW5nIHNsYXNoZXMsIHNpbmNlIFBPU0lYLjIgZGVm aW5lcyBiYXNlbmFtZQ0KPCAJCSAgIGFzIHRoZSBmaW5hbCBwb3J0aW9uIG9m IGEgcGF0aCBhZnRlciB0aGUgdHJhaWxpbmcgc2xhc2hlcw0KPCAJCSAgIGhh dmUgYmVlbiByZW1vdmVkLg0KPCAJCSAqLw0KPCAgICAgICAgICAgICAgICAg cCA9IHN0cnJjaHIgKCp0LCAnXDAnKTsNCjwgICAgICAgICAgICAgICAgIHdo aWxlICgtLXAgPiAqdCAmJiAqcCA9PSAnLycpDQo8ICAgICAgICAgICAgICAg ICAgICAgICAgKnAgPSAnXDAnOw0KPCANCg== --0-1447739591-1018344787=:75449-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message