public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Stephan Mueller <Stephan.Mueller@microsoft.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: stat() and tilde prefix (was bad bash tab completion)
Date: Mon, 14 Jan 2013 20:29:00 -0000	[thread overview]
Message-ID: <c040ca2ce35648f99318ee341647c241@BN1PR03MB087.namprd03.prod.outlook.com> (raw)
In-Reply-To: <20130114161307.GB8617@calimero.vinschen.de>

On Jan 14 01:17, Christopher Faylor wrote:
" It is a bug.  It's not just "~".  Any nonexistent directory will
" work, like "foo/..".

Corinna wrote:
" And it's a bug which isn't easily fixed.  Since about the dawn of time,
" Cygwin's core path handling evaluates the path in a non-POSIX manner,
" mainly for performance reasons.

and:
" Cygwin would have to check
" the existence of every single path component from left to right to
" emulate the POSIX requirements.  

and:
" The first step of converting a POSIX path to a Windows path is to
" normalize the path.  "." and ".." components are simply dropped:
"
" "a/b/./c"  -> "a\b\c"
"  "a/b/../c" -> "a\c"
"
" Then the path prefix is replaced by the matching mount point.

and:
" Ultimately I would be glad to
" be able to come up with more correct code in Cygwin while not getting
" slower, of course.  But that's wishful thinking for now.

Perhaps (as you may well have already considered):

- replace the path prefix by the mount point first?  (this may be naïve
  on my part, but it's not clear to me that .. early in a path should be able
  to influence which mount point is substituted)
- test directory existence of the component preceding .. before collapsing
  (in the example above) b/.. to nothing.
- trust that for a/b3/b2/b/../../../c, the existence test of a/b3/b2/b
  before collapsing b/.. to nothing implies existence of b2 and b3 so no
  further tests are needed for 'runs' of .. components with enough
  components before them

Understood that this is still going to cause a slowdown because paths with
.. are not uncommon, but it would reduce the number of additional
existence checks from one-per-path-component to one-per-run-of-..,
which means none in the case of paths without .. in them.

stephan();


  reply	other threads:[~2013-01-14 20:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-10 14:25 bad bash tab completion Shaddy Baddah
2012-08-10 16:54 ` Eric Blake
2013-01-14  5:21 ` stat() and tilde prefix (was bad bash tab completion) Shaddy Baddah
2013-01-14  6:17   ` Christopher Faylor
2013-01-14 12:23     ` Corinna Vinschen
2013-01-14 14:37       ` Shaddy Baddah
2013-01-14 16:13         ` Corinna Vinschen
2013-01-14 20:29           ` Stephan Mueller [this message]
2013-01-14 21:37             ` Ryan Johnson
2013-01-15  8:44               ` Corinna Vinschen
2013-01-15 12:33           ` Shaddy Baddah
2013-02-07  7:00             ` Shaddy Baddah
2013-02-07 15:32               ` Eric Blake
2013-02-07 16:10                 ` Thomas Wolff
2013-02-07 16:24                   ` Corinna Vinschen
2013-02-07 16:26                     ` Christopher Faylor
2013-01-14 15:27       ` Christopher Faylor
2013-01-14 16:05         ` Corinna Vinschen
2013-01-14 17:00           ` Christopher Faylor
2013-01-14 22:15       ` Thomas Wolff
2013-01-15  8:56         ` Corinna Vinschen
2013-01-15 19:50         ` Andrey Repin
2013-01-15 20:03           ` Larry Hall (Cygwin)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c040ca2ce35648f99318ee341647c241@BN1PR03MB087.namprd03.prod.outlook.com \
    --to=stephan.mueller@microsoft.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).