bug-coreutils
[Top][All Lists]
Advanced

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

Re: truncate-fail-diag failure on Solaris


From: Jim Meyering
Subject: Re: truncate-fail-diag failure on Solaris
Date: Thu, 12 Jun 2008 10:27:40 +0200

Bruno Haible <address@hidden> wrote:
> Jim Meyering wrote in
> <http://lists.gnu.org/archive/html/bug-coreutils/2008-06/msg00101.html>:
>> > You could see whether the file name ends in '/' before
>> > you call open() on it, no?
>>
>> To work around such broken systems without polluting
>> all application code, in the past we've used wrapper
>> functions like the ones around stat, lstat and rename.
>> They would be enabled (with overhead) only if a configure-time
>> test detects the broken syscall.
>
> Yes, of course, we use this methodology.
>
>> We could probably do the
>> same with open to accommodate solaris 7, but I don't think
>> it's worth the effort for a system that old
>
> It's not only Solaris 7. It's also Solaris 9 and HP-UX 11.
>
> The right place for the wrapper is the gnulib 'open' module. I'm adding this:
>
>
> 2008-06-11  Bruno Haible  <address@hidden>
>
>       * m4/open.m4 (gl_FUNC_OPEN): Add test against trailing slash bug.
>       * lib/open.c: Include errno.h.
>       (open): Fail when attempting to write to a file that has a trailing
>       slash.
>       * tests/test-open.c (main): Test against trailing slash bug.
>       * doc/posix-functions/open.texi: Mention the trailing slash bug.
>
> *** doc/posix-functions/open.texi.orig        2008-06-12 02:15:29.000000000 
> +0200
> --- doc/posix-functions/open.texi     2008-06-12 01:53:53.000000000 +0200
> ***************
> *** 9,14 ****
> --- 9,18 ----
>   Portability problems fixed by Gnulib:
>   @itemize
>   @item
> + This function does not fail when the file name argument ends in a slash
> + and (without the slash) names a nonexistent file, on some platforms:
> + HP-UX 11.00, Solaris 9.

Thanks for investing in the wrapper.
With that, coreutils should be able to avoid some ugly,
system-specific test-skipping code.

It's worth noting in documentation that with the replacement function,
opening-for-write any name ending with a slash (regardless of
whether the non-trailing-slashed name exists) will always fail.

Isn't it the case that on some older systems, that opening a directory
for write access could succeed, but only the actual write would fail?
Or maybe it was only for reading...
In any case, they're all probably too old to matter these days.




reply via email to

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