bug-make
[Top][All Lists]
Advanced

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

Re: make check under Cygwin


From: Eli Zaretskii
Subject: Re: make check under Cygwin
Date: Wed, 02 Oct 2013 20:00:36 +0300

> From: Pavel Fedin <address@hidden>
> Cc: address@hidden, address@hidden
> Date: Thu, 26 Sep 2013 10:47:15 +0400
> 
> > There must be a better way, since the only difference between Posix and
> Windows file
> > names is the X: prefix of every absolute file name.
> 
>  Yes. But in certain cases (Cygwin and may be EMX) absolute file names can
> take both forms. For example:
> 
> 1. /foo/bar - absolute POSIX path. But NOT absolute on a pure Windows, would
> be transformed to X:/foo/bar.
> 2. C:/foo/bar - absolute Windows path, nonsense for POSIX. But still
> perfectly valid on Cygwin.
> 3. foo/bar - non-absolute path. Should be converted to absolute.
> 
>  Consequently, Cygwin version should recognize both (1) and (2) as absolute
> paths. This is why i made two branches. The idea is:
> 
> #ifdef HAVE_NATIVE_DOS_PATHS
> 
>  ... DOS absolute path recognition. Included into DOS, Windows and Cygwin
> versions ...
> 
> #endif
> #ifndef NATIVE_DOS_PATHS
> 
>  ... POSIX absolute path recognition. Included into UNIX and Cygwin versions
> ...
> 
> #endif
> 
>  On Cygwin both branches should coexist, hence the original section:
> --- cut ---
>       strncpy (apath, name, root_len);
>       apath[root_len] = '\0';
>       dest = apath + root_len;
>       /* Get past the root, since we already copied it.  */
>       name += root_len;
> --- cut ---
>  got duplicated. It just got a bit transformed for root_len = 1 (strncpy
> turned into single assignment).
> 
>  Well, perhaps it's really possible to permute some parts in order to move
> final:
> --- cut ---
> dest = apath + root_len;
> name += root_len;
> --- cut ---
>  out of #ifdef's... But, oops, you can screw up "if (DOS absolute) ... else
> if (POSIX absolute) ... else (relative)" sequence. Perhaps does not worth
> it. Actually when i made my implementation i took care about making the code
> clear to read and understand since it can be tricky.

Please take a look at the change I made, it takes care of all those
things at a price of only 5 changed lines.



reply via email to

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