Bug 591

Summary: windres: problem compiling resource containing & in filename
Product: binutils Reporter: Marek Januszewski <spec>
Component: binutilsAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: bug-binutils
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: i686-pc-cygwin Target:
Build: Last reconfirmed:

Description Marek Januszewski 2004-11-30 03:58:58 UTC
hello, 
 
I'm trying to compile a resource containg & in filename. how do I escape it? I
tried enclosing it in quotes and escaping it with \& and && - none of those work. 
the command line would be: 
windres -i 'proj&priv.rc' --input-format=rc -o 'proj&priv.rc' -O COFF 

and I'm getting: 

gcc: proj: No such file or directory 
gcc: warning: `-x c' after last input file has no effect 
gcc: no input files 
'priv.rc' is not recognized as an internal or external command, 
operable program or batch file. 
c:\Dev-Cpp\bin\windres.exe: no resources 

I tried escape chars \&, &&, enclosing in double quotes and none of it worked
Comment 1 Ian Lance Taylor 2004-11-30 04:16:27 UTC
The problem arises when windres invokes the preprocessor.  By default windres
just calls popen, and when the arguments include file names with special
characters like '&', the wrong thing happens.  The --use-temp-file option may
fix this.  Otherwise, you need to patch open_input_stream() in binutils/resrc.c
to do appropriate quoting.
Comment 2 Nick Clifton 2007-06-06 08:05:54 UTC
Hi Marek,

  This PR should now be resolved.  A patch to resrec.c has recently been checked
in which should ensure that filenames are properly quoted.

Cheers
  Nick