[Top][All Lists]

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

Re: windows build failure

From: Eli Zaretskii
Subject: Re: windows build failure
Date: Tue, 22 Feb 2011 05:49:41 -0500

> Date: Tue, 22 Feb 2011 01:40:24 -0800
> From: Paul Eggert <address@hidden>
> CC: address@hidden
> On 02/22/2011 12:57 AM, Eli Zaretskii wrote:
> >  the artificial definition to zero in sys_stat.in.h
> > is only fine if one ignores the de-facto practice of testing for
> > S_IFLNK or S_ISLNK to guard code elsewhere that cannot be compiled or
> > run on platforms without symlinks
> No, the idea is that normal code should not use #ifdef S_IFLNK.

Well, "normal code" in Emacs does.  We have 5 such places at this
time, if I didn't miss any.

> It should instead use "if (S_ISLNK (...)) ...".
> On hosts that don't have symbolic links, this "if"
> gets optimized away to nothing, so it's just as fast
> as the #ifdef.

How can we use this idea, when the code in question calls functions
like `symlink' or `readlink", which don't exist on hosts that don't
support symlinks?  This won't link, unless we do something else in
addition.  If we want to go your way, we need to decide how to resolve
this difficulty (and do it in a way that won't become broken when you
resync with gnulib an hour or a day or a year from now ;-).

> Using plain "if" tends to lead to code that is easier to maintain
> than using "#ifdef", in cases like these.

I have no issues with using "if", but we must decide how to do that
without breaking compilation/link.

Once compilation and link work, we will also need to carefully review
the affected code, because its logic might subtly assume something
about the underlying platforms' behavior wrt symlinks, and that logic
might do The Wrong Thing when applied to hosts without symlinks, in
the parts that are common to "if" and its "else".

> Large chunks of GNU code have been written using this style,
> in programs such as coreutils, and it typically works well.

For some value of "well".  I really don't want to begin griping about
the MinGW port of Coreutils on Windows (that's OT here, anyway), but
for starters, it is linked against a ported glibc, which includes a
bastard semi-broken emulation of symlinks.  So I'm not sure anyone has
ever tested this approach in practice, at least not in Coreutils.

Again, I'm not against going the "if" path, I just wanted to (a) point
out the issue and hear from the relevant parties what, if anything,
they prefer to do about that, and (b) make sure we all understand that
fixing it cleanly is not a trivial job (but not rocket science,
either, of course).  Once the decision is made, I will be more than
willing to contribute to this effort.

reply via email to

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