Luca Masini & Bram Moolenaar wrote:

<snip>

>> In cygwin /etc/hosts is a symbolic link to
>> C:\WINDOWS\system32\drivers\etc\hosts
>> and if expanded in that way is not recognized as a full path because
>> does not start with / or with ~.
>
> A symlink from a Unix-style path to a DOS-style path?  That appears to
> be the problem to me.  It's a bad symlink.  Unix programs will not work
> properly with this symlink.

This is common in cygwin.
It supports different path formats.

<snip>

> Then why don't you change the symlink to this path?

I come across the problem because I often need to edit /etc/hosts
and that is a predefined symbolic link.
But a user can define other symbolic link as he or she likes.
The symbolic link problem is general.

<snip>

> slash_adjust() only changes "\" to "/", which doesn't change the length
> of the path.  I assume that cygwin_conv_to_posix_path() can change the
> length, thus it's a very different thing.

if I remember correctly the size of buf was MAXPATHL o something similar
so the change of lenght should not be a problem in this context...
but I agree that if the function is called with len less than MAXPATHL
this will be a problem.

> I think the Cygwin version of Vim should never see "C:/path" things,
> thus converting all paths sounds like a good idea.   Probably near the
> start of mch_FullName().  However, I don't know if this breaks
> something.  I never use the Cygwin version.

The used function is explained here
 http://www.cygwin.com/cygwin-api/func-cygwin-conv-to-posix-path.html

My idea was to convert to posix the path as soon as possible
(just after the resolution of the symlink) with a snippet like this
      #if defined(__CYGWIN__)
          cygwin_conv_to_posix_path( buf, buf );
      #endif
Then the path is posix and the problem of having a mix of posix
and windows path is no more present.

It is late here....
I will look tomorrow at the mch_FullName() in os_unix.c

Luca.




Reply via email to