bug-coreutils
[Top][All Lists]
Advanced

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

Re: ln.c portability fix for hosts where / != //


From: Eric Blake
Subject: Re: ln.c portability fix for hosts where / != //
Date: Wed, 02 Nov 2005 21:19:28 -0700
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Paul Eggert on 10/28/2005 4:19 PM:
> I installed this patch to fix a bug I found by inspecting the strace
> output for "ln".  It's hard to write a test case for it, since it
> requires write access to "/".

Cygwin is a great test platform - typical installations have writable /
but read-only //.  And sure enough:

$ ln-5.90 -s Makefile /
ln-5.90: creating symbolic link `//Makefile' to `Makefile': No such host
or network path
$ ln -s Makefile /
$

>  /* Construct a string NEW_DEST by concatenating DEST, a slash, and
> -   basename(SOURCE) in alloca'd memory.  Don't modify DEST or SOURCE.  */
> +   basename (SOURCE) in alloca'd memory.  Don't modify DEST or SOURCE.
> +   Omit unnecessary slashes in the boundary between DEST and SOURCE in
> +   the result; they can cause harm if "/" and "//" denote different
> +   directories.  */
>  
>  #define FILE_BASENAME_CONCAT(new_dest, dest, source)                 \

Why not fix this to malloc instead of alloca, since on platforms (like
Hurd) that accept arbitrarily long filenames, alloca will cause problems
on long names?

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDaY/Q84KuGfSFAYARAg8PAKCrsRgCgGhgHtQg1sBT/qbXNGDe5gCgjYV5
GMy4xuICifECoT25pxB+oa4=
=z1qb
-----END PGP SIGNATURE-----




reply via email to

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