bug-bash
[Top][All Lists]
Advanced

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

Re: bash-shipped getcwd() replacement does not work on interix.


From: Eric Blake
Subject: Re: bash-shipped getcwd() replacement does not work on interix.
Date: Thu, 20 Dec 2007 06:20:53 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

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

According to Andreas Schwab on 12/20/2007 4:30 AM:
>> +      char *t = xmalloc(PATH_MAX);
>> +      the_current_working_directory = getcwd (t, PATH_MAX);
> 
> The length of the cwd may be bigger than PATH_MAX.

On most systems, yes.  Interix, however, probably follows suit with cygwin
1.5.x, since most Windows syscalls enforce that relative path names can't
generate paths whose corresponding absolute path is longer than a puny 256
PATH_MAX (the cygwin developers are working towards avoiding this
limitation in cygwin 1.7.0 by using lower-level NT syscalls that allow up
to 32k in absolute length, and will be raising their PATH_MAX to at least
the POSIX XSI minimum of 1k, but aren't there yet).  But I agree that the
patch as posted is wrong for non-Interix platforms.

It may also be worth inspecting the gnulib replacement for getcwd, to see
how it handles the problem:
http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/getcwd.c

- --
Don't work too hard, make some time for fun as well!

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

iD8DBQFHamw184KuGfSFAYARArOXAJkBwR6CbME0zyACCFbbe2g8XLmOKACgzdoJ
Y0p53TTfWOrxjctD8Bkck2Q=
=0ssG
-----END PGP SIGNATURE-----




reply via email to

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