From owner-freebsd-hackers Wed Apr 10 18: 9:56 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 DED8F37B400 for ; Wed, 10 Apr 2002 18:09:50 -0700 (PDT) Received: from localhost (bgd@localhost) by fw.cgn.icom (8.11.3/8.11.3) with ESMTP id g399X7F75512 for ; Tue, 9 Apr 2002 11:33:07 +0200 (CEST) (envelope-from bgd@icomag.de) Date: Tue, 9 Apr 2002 11:33:07 +0200 (CEST) From: Bogdan TARU X-X-Sender: To: Subject: 'rm' incompatibility with Posix.2 Message-ID: <20020409112048.D75449-200000@fw.cgn.icom> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1447739591-1018344787=:75449" 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 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