On Tue, 27 Sep 2011 21:56:12 +0000 (UTC)
"Joseph S. Myers" <jos...@codesourcery.com> wrote:

> On Mon, 26 Sep 2011, Basile Starynkevitch wrote:
> 
> > Hello All,
> > 
> > It seems to me (file gcc/Makefile.in, definition of DRIVER_DEFINES) that 
> > the configure-d PREFIX is wired inside gcc.o (hence inside the gcc 
> > driver executable) without precautions.
> > 
> > In particular, I don't understand if someone can configure gcc with a 
> > prefix containing weird characters, such as double-quotes " or 
> > backslashes \ or perhaps even spaces.
> > 
> > My intuition is that GCC won't even build if the prefix contains such 
> > naughty characters. If it is the case, should we document that.?
> 
> In general it's hard to support this in full generality because of 
> difficulty escaping things for "make" (and you have "make" - multiple 
> levels thereof - the shell and C escaping to consider at least).  If the 
> paths to the source and build directories contain special characters it's 
> particularly problematic (configure scripts get involved as well; some 
> past autoconf versions had their own problems in this regard, although 
> this may have been fixed).


I do know that and I have been bitten by the multiple levels of escaping in 
MELT.
Actually, for the MELT branch (and the just released MELT 0.9 plugin for GCC 
4.6), I came
up adding a trivial C generator which produces code like const char foo[]="bar";
even when the bar string contain naughty characters.

In MELT it is even a little bit worse, since I do need to stringify the default 
CFLAGS
for the compilation of the C code generated by MELT, and that default string 
obviously
contain spaces. (the MELT plugin runs "make" sometimes, to compile the 
generated *.c
files into a *.so). See
http://groups.google.com/group/gcc-melt/browse_thread/thread/74c36fae50a2b47d 
for more
details.

The generator is simple and self-contained, on
http://gcc.gnu.org/viewcvs/branches/melt-branch/gcc/melt-make-string.c?view=log

Cheers.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Reply via email to