[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spaces in path names

From: Roger While
Subject: Re: Spaces in path names
Date: Mon, 16 Jan 2006 12:29:39 +0100

OK. I did not look at the actual usage of this example,
but what is definitely true is that the resultant command
passed to gcc/linker whatever, must have the quotes
ala. -L"my space dir". I think we agree on that.
On an aside note, it seems that autoconf is also
busted here. Specifically autotest is blown
for as_dir in $PATH
  test -z "$as_dir" && as_dir=.
  test -f $as_dir/$at_program && break

or :

      rm -rf $at_group_dir
      mkdir $at_group_dir ||



[ Cc:ing Derek, maybe he's still interested; this is ]

* Roger While wrote on Fri, Jan 13, 2006 at 11:27:23AM CET:
> Hmm. Derek's patch is interesting.
> As an addendum to your mail commenting
> on Derek's mail (July 8 2005),  note :
> (One of a few places)
> +    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='\"-L$libdir\"'
> That, I think, is wrong. Should be
> ='-L\"$libdir\"'
> or ?

No, that difference does not matter.  You may want to get more familiar
with how Bourne shells do word splitting.  For example,
  test $foo = "no"

(a common idiom seen in user's scripts) is wrong: the right hand side
contains nothing (parameter expansions like $foo, or command
substitutions like `ls`) that will introduce white space that will be
word-split, unlike the left-hand side.  Thus, the right way (with
minimal quoting) would be
  test "$foo" = no

If it's unclear whether $foo may start with a hyphen, the common idiom
  test "X$foo" = Xno
or, with minimal quoting,
  test X"$foo" = Xno

Because the shell does not word-split on the right hand side of
assignments, this:
can always safely be written as

and this:
  foo="$bar $baz"
  foo=$bar" "$baz
or even
  foo=$bar\ $baz

It's just that the former versions are often easier to read and help
avoid bugs.

> Is/has anything going/gone on regarding this issue in CVS/2.x ?

No, not yet.  I do have a couple of suggestions though for someone
ambitious to work on this: I would be much more easy with integrating
this if it were more backwards-compatible.  One possibility could be
to quote path names in .la files *only* if the have to be quoted.
IOW, one common idiom in ltmain could be
  case $dir in
  *[$IFS]*) foo_dir="$foo_dir \"$dir\"" ;;
  *)        foo_dir="$foo_dir $dir" ;;

and it would be useful to factor this out in a small shell function;
it would also be necessary to check whether above works with all kinds
of shells.  That way at least all other users would not see dramatical
changes, libltdl would continue to work for them, and all in all we
could incrementally(!) fix each occurrence of missing quotes, while as
long as unfinished, only users of paths with spaces would be impacted.

Pleas note also that my followup comment[1] contained a glitch itself,

>> @@ -1043,7 +1043,7 @@ EOF
>>      compiler_flags=
>>      linker_flags=
>>      dllsearchpath=
>> -    lib_search_path=`pwd`
>> +    lib_search_path=\"`pwd`\"
>This change is not necessary.  The general rule is, that command
>substitutions and variable expansions do not get word-split in
>assignments and in the word after `case'.

This comment is wrong, the code was ok.  I misread



reply via email to

[Prev in Thread] Current Thread [Next in Thread]