stat() and tilde prefix (was bad bash tab completion)

Shaddy Baddah lithium-cygwin@shaddybaddah.name
Thu Feb 7 07:00:00 GMT 2013


Hi,

On 15 Jan 2013 23:33, Shaddy Baddah wrote:
<snip>
>>> From what I make of it, there needs to be a patch that, although can
>>> work generically, adds checks only required for Cygwin. And therefore
>>> is specific to the Cygwin package.
>>>
>>> The check would be an extension of the file_exists() function, perhaps
>>> called tilde_file_exists(), which determines if the tilde prefix forms
>>> a directory component of the path (strchr('/')?). If it does not, the
>>> file_exists() check is sufficient. If it does, then the check of if
>>> that directory exists is logically and'ed to the result of
>>> file_exists().
>>>
>>> Does that sound about right?
>>
>> A check like this might be a good idea. 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.
>
> Bash, patched in the way I have described, seems to fix the tab
> completion issue.
>
> I will tidy up the work and publish the patch at some point soon. I may
> have taken a naive approach, so review comments are welcome.

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?

Do I need to put an "attn bash maintainer" on the subject line?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-181692-bash-tilde-fix.diff
Type: text/x-patch
Size: 1561 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20130207/4973cc67/attachment.bin>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list