[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: invalid assumption of m4/getcwd-path-max.m4
From: |
Jim Meyering |
Subject: |
Re: invalid assumption of m4/getcwd-path-max.m4 |
Date: |
Sat, 26 Mar 2005 15:17:50 +0100 |
address@hidden (Eric Blake) wrote:
> Right now, m4/getcwd-path-max.m4 of coreutils 5.3.0 or CVS is overly
> pessimistic, and the test program returns 2 (interpreted as getcwd does
> not even partially work) if it fails to mkdir or chdir to the ever-growing
> pathname. This unnecessarily penalizes cygwin, where PATH_MAX is 259
> [1] and NAME_MAX is 255 [2], and where it is not possible, even with
> relative paths, to ever exceed PATH_MAX for the absolute name of the file
> [3].
Thanks for reporting that.
So the test program goes wrong on cygwin because of a
mkdir failure when the would-be cwd_len exceeds PATH_MAX.
Sounds like this is what would need to change:
/* If mkdir or chdir fails, be pessimistic and consider that
as a failure, too. */
if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0)
{
fail = 2;
break;
}
If mkdir fails in a way (what errno value?) that cannot be confused
with e.g., disk full, then it should be easy to adjust the test program.
Just test for the combination of a too-large cwd_len and failed mkdir
with that errno value.
Can you propose/test a patch?