On 02/07/2013 12:00 AM, Shaddy Baddah wrote: > Please find the patch discussed attached. It probably needs to be a bit > more generic, maybe with some precompiler directives to limit it to > cygwin? Although if it is just for cygwin, perhaps it can just go in the > cygports patch? The build of bash has nothing to do with cygports; if I decide to take this, I will include something like it the next time I build bash for cygwin. > > Do I need to put an "attn bash maintainer" on the subject line? Nah, I read the list. > *r++ = '\\'; > /* XXX -- check for standalone tildes here and backslash-quote them */ > - if (s == text && *s == '~' && file_exists (text)) > + if (s == text && *s == '~' && tilde_file_exists (text)) { No need to add the {} here. > *r++ = '\\'; > + } > *r++ = *s; > } > *r = '\0'; > diff --git a/general.c b/general.c > index fdadf1d..b279cbe 100644 > --- a/general.c > +++ b/general.c > @@ -544,6 +544,28 @@ file_exists (fn) > } > > int > +tilde_file_exists (fn) This function is misnamed for what it does, which is attempt work around the fact that cygwin's handling of .. is not POSIX-compliant. I think a better fix would be to change file_exists() itself instead of adding a misnamed wrapper function; then bashline.c wouldn't even need patching. The string 'tilde' need not even be in the patch; what you are really after is a function that says that if '..' is found within a string being probed for existence, then add an additional check to see if the prefix of that string exists as a directory. But I don't mind experimenting with the idea - it remains to be seen whether people will complain that bash is noticeably slower because it takes time to double-check instead of rely on cygwin's non-POSIX shortcut. And the slowdown would only be on paths containing a '..'; I would NOT be checking for symlinks (even though symlinks containing .. are also being interpreted in a non-POSIX manner, it is much more expensive to second-guess if you have to check every name for being a symlink than it is to just check for literal ..). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org