develooper Front page | perl.makemaker | Postings from June 2006

MakeMaker on Cygwin when environment variables end in backslash

Thread Next
From:
Ed Avis
Date:
June 6, 2006 16:44
Subject:
MakeMaker on Cygwin when environment variables end in backslash
Message ID:
80D2D3DB17CD2E498E04171C2C95129267985F@wcl-exc.wcl.local
For whatever reason on my Windows XP machine the environment variable LIB is set to

C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\

This is harmless to Windows programs but when using MakeMaker under Cygwin, the trailing backslash causes errors a bit like this:

% make subdirs
cd C && make -f Makefile all LIB="C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\" LIBPERL_A="libperl.a" LINKTYPE="dynamic" PREFIX="" OPTIMIZE="" PASTHRU_DEFINE="" PASTHRU_INC=""
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [subdirs] Error 2

The backslash at the end of the double-quoted string confuses sh.  This could be fixed by putting a substitution in the Makefile:

PASTHRU = LIB="$(subst \,/,${LIB})"\
   ...

and perhaps for other environment variables which contain paths and so might end in backslash on Cygwin.  (I don't expect a pure-Win32 version of perl would be affected because it wouldn't use /bin/sh from makefiles.)

Failing that, MakeMaker could simply fall over with an error message whenever it detects trailing backslashes in an environment variable it would like to mention.  In principle, the same bug affects more normal Unix-like systems whenever someone puts a backslash at the end of the LIB environment variable (but who would do that?).

-- 
Ed Avis <eda@waniasset.com>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About