bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bugs in dirname module


From: Paul Eggert
Subject: Re: bugs in dirname module
Date: Thu, 17 Nov 2005 12:59:28 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Eric Blake <address@hidden> writes:

> Actually, I think that calling base_name should strip the trailing
> slashes, similar to POSIX basename().

But if you do that, you violate this basic rule:

>   If you have a valid file name F, then accessing F is the same as
>   chdir(dir_name(F)) followed by accessing base_name(F).  Furthermore
>   if you successfully { chdir(dir_name(F)); rename(base_name(F),"foo"); },
>   you have renamed F to a file named "foo" in the same directory that F was 
> in.
If a/b is a symbolic link to a directory, then a/b/ is not the same as
a/b and should not be treated like it.  Hence base_name shouldn't
strip trailing slashes.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]