From: SourceForge.net <no...@so...> - 2008-02-12 21:37:37
|
Bugs item #1873971, was opened at 2008-01-17 17:45 Message generated for change (Comment added) made by keithmarshall You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1873971&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: msys Group: IINR - Include In Next Release Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Qter (trautbrg) Assigned to: Keith Marshall (keithmarshall) Summary: MSYS:which does not find programs in directories with blanks Initial Comment: I've just upgraded MSYS to the latest snapshots available: - bash-3.1-MSYS-1.0.11-1.tar.bz2 - coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2 - MSYS-1.0.11-20071204.tar.bz2 - msysCORE-1.0.11-2007.01.19-1.tar.bz2 It runs out that the new which script does not succeed in finding a program if the program resides in a directory with blanks in the directory name. # File: which # $Id: which,v 1.2 2006/02/11 10:43:06 keithmarshall Exp $ This problem is independent of OS (I tested on w2k, XP prof., Vista 64). The cause of the problem is in line 32 of the script: for LIST in `type -ap -- "$PROG" || type -p -- "$PROG"` If a directory contains blanks, then above line will return as many individuyl "$LIST" chnunks as there are blank seperated parts in the directory name. However the rest of the script assumes that one "$LIST" chnunk contains one full path and filename. BTW: msys is great! regards Wolfgang ---------------------------------------------------------------------- >Comment By: Keith Marshall (keithmarshall) Date: 2008-02-12 21:37 Message: Logged In: YES user_id=823908 Originator: NO > It would be great if the path was returned with escaped blanks, > e.g. like the following example: > > $ which devenv > /f/Programme/Microsoft\ Visual\ Studio\ 8/Common7/IDE/devenv If I simulate this on my Ubuntu 6.06 LTS box, `which' does *not* escape the embedded spaces, as you request; it would seem inappropriate to me, to make the MSYS version behave any differently. If you need the output of `which' to be quoted, you should quote it at point of use. Keith. ---------------------------------------------------------------------- Comment By: Qter (trautbrg) Date: 2008-02-11 07:56 Message: Logged In: YES user_id=1301242 Originator: YES Hi Keith, thanks for the fix. "which" now also properly finds executables which reside in directories that contain blanks. However the returned path is not directly usable by MSYS since the blanks in the path are not escaped: $ which devenv /f/Programme/Microsoft Visual Studio 8/Common7/IDE/devenv $ /f/Programe/Microsft Visual Studio 8/Common7/IDE/devenv sh.exe": /f/Programme/Microsoft: No such file or directory It would be great if the path was returned with escaped blanks, e.g. like the following example: $ which devenv /f/Programme/Microsoft\ Visual\ Studio\ 8/Common7/IDE/devenv best regards Wolfgang ---------------------------------------------------------------------- Comment By: Keith Marshall (keithmarshall) Date: 2008-02-08 18:12 Message: Logged In: YES user_id=823908 Originator: NO Thanks for the report. We continue to recommend avoidance of path names with embedded spaces. However, since this stupidity has been instigated by Microsnot themselves, and since the following simple patch seems to DTRT for me, I've committed this:-- 2008.02.08 Keith Marshall <kei...@us...> * bin/which: Set IFS to handle spaces in path names. Index: which =================================================================== RCS file: /cvsroot/mingw/msys/dvlpr/bin/which,v retrieving revision 1.2 diff -u -r1.2 which --- which 11 Feb 2006 10:43:06 -0000 1.2 +++ which 8 Feb 2008 17:51:41 -0000 @@ -1,7 +1,7 @@ #!/bin/sh # Original copyright (C) 2002, Earnie Boyd # mailto:ea...@us... -# This implementation copyright (C) 2006, Keith Marshall +# This implementation copyright (C) 2006, 2008, Keith Marshall # mailto:kei...@us... # # This file is part of MSYS @@ -18,6 +18,11 @@ exit 1 fi +# To accomodate Woe32's typically asinine $PATH, which frequently +# includes directory names with embedded spaces, we need to set up +# $IFS to consider only a newline as a field separator. +IFS=$'\n' + break=break for PROG do You may download the updated version from CVS: http://mingw.cvs.sourceforge.net/*checkout*/mingw/msys/dvlpr/bin/which ---------------------------------------------------------------------- Comment By: Keith Marshall (keithmarshall) Date: 2008-02-08 18:12 Message: Logged In: YES user_id=823908 Originator: NO The problem you report has caused modification in some fashion in the official CVS for the given package. The w32api and mingw-runtime official CVS reside in the winsup CVS directory tree for Cygwin. Those package CVS trees are periodically merged into the MinGW CVS tree. If you still find problems then please open a new report. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1873971&group_id=2435 |