This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bad PATH conversion under XP


Le 26/01/2011 03:10, Rafael Kitover a écrit :

On 1/25/2011 7:14 PM, Cyrille Lefevre wrote:
v2$ uname -a
CYGWIN_NT-5.1 PC213736 1.7.7(0.230/5/3) 2010-08-31 09:58 i686 Cygwin

aka

Windows XP Professional Ver 5.1 Build 2600 Service Pack 3

though SSH at least :

v2$ regtool get /machine/SYSTEM/CurrentControlSet/Control/Session\
Manager/Environment/PATH
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\orawin\BIN;C:\Program

Files\ATI Technologies\ATI Control Panel;"C:\Program
Files\Hummingbird\Connectivity\7.00\Accessories\";C:\Program
Files\QuickTime\QTSystem\;D:\sfu\Perl\bin\;D:\sfu\common\;C:\WINDOWS\system32\WindowsPowerShell\v1.0\;C:\Program

Files\Samsung\Samsung PC Studio 3\

gives :

/usr/local/bin:/usr/bin:/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/orawin/BIN:/cygdrive/c/Program

Files/ATI Technologies/ATI Control Panel:"C:/Program
Files/Hummingbird/Connectivity/7.00/Accessories/":/cygdrive/c/Program
Files/QuickTime/QTSystem/:/cygdrive/d/sfu/Perl/bin/:/cygdrive/d/sfu/common/:/cygdrive/c/WINDOWS/system32/WindowsPowerShell/v1.0/:/cygdrive/c/Program

Files/Samsung/Samsung PC Studio 3/:/bin

note the unconverted path between double-quotes :

"C:/Program Files/Hummingbird/Connectivity/7.00/Accessories/"

I saw this problem on msys, I think it applies to cygwin as well.


If you just go into environment under advanced system settings in
control panel and remove the double quotes, it will work correctly. I'm
on Windows 7.

don't be kidding ! ok, I'm joking...


I'm reporting a cygwin bug...
of course I know I could edit the windows environment variables.
however, this problem has to be fixed.


also, how about to get rid of final slashes (.../ => ...) ?

You could reprocess your PATH in your .bashrc, but the final slashes should have no effect on how the PATH is actually used...

everything is possible at shell level, even more efficiently, but since the path is working by the cygwin layer, why not to clean things up.


PS : no fork cleanups...

# space tab newline
_IFS=${IFS:-' 	
'}
IFS=':'

# clean up final /'es
_PATH= _sep=
for _path in $PATH; do
case $path in */) _path=${_path#/} ;; esac
_PATH=${_PATH}${_sep}${_path}
_sep=':'
done
PATH=${_PATH}

# cleanup twins
_PATH= _sep=
for _path in $PATH; do
case ":${_PATH}:" in
*":${_path}:"*) ;;
*) _PATH=${_PATH}${_sep}${_path}; _sep=':' ;;
esac
done
PATH=${_PATH}

# not necessary, but...
# cleanup windows paths w/ space
_PATH= _sep=
for _path in $PATH; do
case ":${_path}:" in
*' '*) ;;
*) _PATH=${_PATH}${_sep}${_path}; _sep=':' ;;
esac
done
PATH=${_PATH}

IFS=${_IFS}
unset _IFS _PATH _path _sep

untested but should work...
of course, you may do this in one loop only !

also, I reworked my version of ssh-session-env.sh

Regards,

Cyrille Lefevre
--
mailto:Cyrille.Lefevre-lists@laposte.net

Attachment: ssh-session-env.sh
Description: Text document

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]