Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Apr 2002 11:33:07 +0200 (CEST)
From:      Bogdan TARU <bgd@icomag.de>
To:        <freebsd-hackers@FreeBSD.ORG>
Subject:   'rm' incompatibility with Posix.2
Message-ID:  <20020409112048.D75449-200000@fw.cgn.icom>

next in thread | raw e-mail | index | archive | help
  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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020409112048.D75449-200000>