Bug#45192: libc0.2: path names with trailing slashes and rmdir,rename
Package: libc0.2
Version: N/A
Severity: normal
Hello,
the below program generates the following output:
hurd:/tests/dirslash# ./dirslash
rmdir foo1/ : Invalid argument
rename foo4 bar4/ : No such file or directory
rename foo5/ bar5 : Invalid argument
rename foo6/ bar6/ : No such file or directory
Only the output for foo4 and foo6 is POSIX conform. The two times were
Invalid Argument is returned are wrong (this makes `mv foo/ bar' copying all
files seperately, a pain with huge source trees).
Thanks,
Marcus
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
main() {
mkdir("foo1");
mkdir("foo2");
mkdir("foo3");
mkdir("foo4");
mkdir("foo5");
mkdir("foo6");
if (rmdir("foo1/"))
printf ("rmdir foo1/ : %s\n", strerror(errno));
if (rmdir("foo2"))
printf ("rmdir foo2 : %s\n", strerror(errno));
if (rename("foo3","bar3"))
printf ("rename foo3 bar3 : %s\n", strerror(errno));
if (rename("foo4","bar4/"))
printf ("rename foo4 bar4/ : %s\n", strerror(errno));
if (rename("foo5/","bar5"))
printf ("rename foo5/ bar5 : %s\n", strerror(errno));
if (rename("foo6/","bar6/"))
printf ("rename foo6/ bar6/ : %s\n", strerror(errno));
rmdir("foo1");
rmdir("foo2");
rmdir("foo3");
rmdir("foo4");
rmdir("foo5");
rmdir("foo6");
rmdir("bar3");
rmdir("bar4");
rmdir("bar5");
rmdir("bar6");
}
-- System Information
Debian Release: potato
Kernel Version: Linux ulysses 2.2.12 #1 Mit Sep 15 03:28:57 CEST 1999 i586 unknown
Reply to: