monotone-devel
[Top][All Lists]
Advanced

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

Re: [Monotone-devel] heads up: file system changes


From: Zack Weinberg
Subject: Re: [Monotone-devel] heads up: file system changes
Date: Sat, 26 Sep 2009 14:14:15 -0700

On Thu, Sep 24, 2009 at 8:45 PM, Stephen Leake
<address@hidden> wrote:
>
> Sigh. I was quoting from libc.info, which is titled "The Red Hat
> newlib C Library". I thought that was an implementation of the C
> standard runtime; apparently not.

Sure it is; it's just that this is not behavior nailed down by C90 nor
C99, so it's not surprising that the documentation is less than clear
here.

>>     This is the ISO C function to remove a file. It works like unlink
>> for files and like rmdir for directories. remove is declared in
>> stdio.h.
>
> That certainly makes sense.
>
> But if it's in stdio.h, doesn't that mean it's defined by the C
> standard? So it should be the same on Win32? Hmm. Maybe that standard
> allows this variance as "implementation defined". Yuck.

Not all the stuff in stdio.h belongs to the C standard; for instance,
mine declares tempnam(), which is SVID/XOPEN (not even POSIX), and
various other such things.

Anyway, since the C standard has no concept of directories, of course
what remove() does to directories is not defined by the C standard. :)
 But it is defined by POSIX.

>> I checked - contra my recollection, neither C90 nor C99 even has the
>> concept of directories.
>
> But your quote above says it's the ISO C function; is ISO C something
> other than C90?

ISO would prefer that "ISO C" without qualification referred to C99
(the 1990 standard is officially withdrawn at this point) but the 1999
revision is still (ten years later!) not universally adopted, and
people tend to still mean C90 when they talk of the C standard.  But
this is kinda irrelevant. :)

The *function* is defined by C90, but its behavior on directories isn't.

>> POSIX.2001, incidentally, is available online at
>> http://www.opengroup.org/onlinepubs/009695399/nfindex.html (free
>> registration required).  You have to read it carefully because not
>> every system that we care about implements all of the 2001 spec, but
>> it's a good starting point.
>
> So mtn assumes unix = POSIX, win32 != POSIX?

Precisely.   And to some extent you can't even trust MSVCRT to get C90 right.

> So the comment in platform.hh is not correct, but the directory must
> be empty for do_remove to succeed. I'll fix it.

That sounds right to me.

zw




reply via email to

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