Web lists-archives.com

Re: cygpath -u converts quoted UNC paths to local




On 2019-04-03 12:20 pm, Andrey Repin wrote:
Greetings, All!

This can be considered "working by design", but it really imposes some serious restrictions on interoperability with Cygwin, that I think can be avoided.

...

After some further testing, this seems to be affecting IP-based UNC paths
only.

The essence is this:

$ dir "\\192.168.1.5\wwwroot\ccenter\bin\online.sh"
26.10.2018  18:16               431 online.sh

$ cygpath -u \\192.168.1.5\wwwroot\ccenter\bin\online.sh
//192.168.1.5/wwwroot/ccenter/bin/online.sh

$ cygpath -u "\\192.168.1.5\wwwroot\ccenter\bin\online.sh"
/192.168.1.5/wwwroot/ccenter/bin/online.sh

$ cygpath -u \\HOSTING64.DARKDRAGON.LAN\wwwroot\ccenter\bin\online.sh
//HOSTING64.DARKDRAGON.LAN/wwwroot/ccenter/bin/online.sh

$ cygpath -u "\\HOSTING64.DARKDRAGON.LAN\wwwroot\ccenter\bin\online.sh"
//HOSTING64.DARKDRAGON.LAN/wwwroot/ccenter/bin/online.sh

$


Using echo is a good way of checking just what the shell is handing to your program. But I totally agree that this is a major interoperability annoyance.

I'm using Bash 4.4.12(3):

$ echo \\192.168.1.5\wwwroot\ccenter\bin\online.sh
\192.168.1.5wwwrootccenterbinonline.sh

$ echo "\\192.168.1.5\wwwroot\ccenter\bin\online.sh"
\192.168.1.5\wwwroot\ccenter\bin\online.sh

$ echo '\\192.168.1.5\wwwroot\ccenter\bin\online.sh'
\\192.168.1.5\wwwroot\ccenter\bin\online.sh

$ echo \\foo\wwwroot\ccenter\bin\online.sh
\foowwwrootccenterbinonline.sh

$ echo "\\foo\wwwroot\ccenter\bin\online.sh"
\foo\wwwroot\ccenter\bin\online.sh

$ echo '\\foo\wwwroot\ccenter\bin\online.sh'
\\foo\wwwroot\ccenter\bin\online.sh


read -r is an alternate way of getting text into a command line that might otherwise turn into quoting hell.

$ read -r; cygpath -u $REPLY
\\192.168.1.5\wwwroot\ccenter\bin\online.sh
//192.168.1.5/wwwroot/ccenter/bin/online.sh









--
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