This is the mail archive of the cygwin-patches mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Reattach trailing dirsep on existing directories too.

On Jan  8 10:49, Ray Donnelly wrote:
> On Wed, Jan 8, 2014 at 9:20 AM, Corinna Vinschen wrote:
> > On Jan  7 18:15, Ray Donnelly wrote:
> >> On Tue, Jan 7, 2014 at 3:12 PM, Corinna Vinschen wrote:
> >> > On Dec 22 01:03, Ray Donnelly wrote:
> >> >> I hope this is OK and I've done it in the best place. Please advise if
> >> >> it needs any changes.
> >> >
> >> > I have no idea if this is ok.  This is a patch to a very crucial
> >> > function in terms of path handling, and it's not clear that this isn't
> >> > doing the wrong thing.  What is this patch trying to accomplish?  Do you
> >> > have example user space code which is failing for this very reason?
> >>
> >> The exact issue was that paths that do not exist would maintain their
> >> final dirsep whereas paths that do exist would lose this dirsep:
> >>
> >> test.exe /c/doesnt-exist/ /c/does-exist/
> >>
> >> test.exe would see:
> >> arg1: C:/doesnt-exist/
> >> arg2: C:/does-exist
> >>
> >> These paths were passed to GCC as search paths and while I could've
> >> hacked up the GCC code to detect and correct this anomaly, but I think
> >> this patch fixes the problem at cause.
> >
> > And that is a problem, because...?
> .. because in this case, GCC appends sysroots directly to those
> passed-in-as-#define values and I end up with e.g. C:/does-existusr/
> and C:/doesnt-exist/usr/, when I always wanted the final /. Of course

Hang on.  Why are you using DOS paths here?  Cygwin's GCC uses POSIX
paths, not DOS paths.  The DOS path handling should be entirely internal
and we don't give any guarantee that it does exactly what you want in
case you're using them on the application level.  That's what already
bothered me in your above example.  test.exe should always only see
the POSIX path /c/doesnt-exist/ and /c/does-exist/, and the DOS path
is only used internally in Cygwin and doesn't concern the application
at all.

> I could add some nasty hacks in GCC and any other program that runs
> into this odd behavioural quirk to detect and workaround it, but IMHO
> fixing the quirk is a better approach.
> Someone's gone to the effort to re-attach the dirsep when the folder
> doesn't exist so they must have thought that preserving this was a
> good idea, I've just fixed a corner case in that so the results are
> consistent.

As I wrote, this functionality is the core of the path handling.  I'm
very reluctant to change it unless it turns out that an application
using POSIX paths has a problem.  Your change may end up breaking
another corner case when using POSIX paths, and if so, I opt for keeping
the POSIX path corner case working.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpg9npryrZwh.pgp
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]