Bug 4933 - windres does not escape path with spaces in them
Summary: windres does not escape path with spaces in them
Status: REOPENED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.24
: P2 critical
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-17 16:24 UTC by Emmanuel Stapf
Modified: 2018-05-11 21:01 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Proposed patch (1.15 KB, patch)
2016-03-22 17:23 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emmanuel Stapf 2007-08-17 16:24:00 UTC
On Windows, when installing `windres' in a path which contains spaces, it will
fail to execute even if you have the binutils in your PATH. To reproduce simply
launch windres as:

C:\apps\Eiffel60 x86/gcc/windows/mingw/bin/windres" -I../../..
../../../sample.rc -O coff -o sample
'C:\apps\Eiffel60' is not recognized as an internal or external command,
operable program or batch file.

With the -v option I get:

[C:\work\projects\61dev\EIFGENs\sample_normal\W_code]"C:\apps\Eiffel60
x86/gcc/windows/mingw/bin/windres.exe" -I../../.. ../../../sample.rc -O coff -o
sample.res -v
Using `C:\apps\Eiffel60 x86/gcc/windows/mingw/bin/gcc -E -xc -DRC_INVOKED
-I../../.. ../../../sample.rc'
Using popen to read preprocessor output
'C:\apps\Eiffel60' is not recognized as an internal or external command,
operable program or batch file.

It basically takes the path of `gcc' relative using the command line argument.
So the solution is to simply surround the path to gcc with double quotes.

For the moment I've used the `--preprocessor' option using:
"C:\apps\Eiffel60 x86/gcc/windows/mingw/bin/windres"
--preprocessor='"C:\apps\Eiffel60 x86/gcc/windows/mingw/bin/cpp.exe"' -I../../..
../../../sample.rc -O coff -o sample.res

but I'm not sure if it is equivalent to the default behavior of windres.
Comment 1 Danny Smith 2007-08-18 22:41:27 UTC
Please try with CVS binutils.  Some of the popen 'spaces in file names' problems
have been avoided.  

Danny
Comment 2 Emmanuel Stapf 2007-08-21 17:48:24 UTC
Do you have some information on how I can get the CVS binutils and compile it on
Windows?

Thanks,
Manu
Comment 3 Nick Clifton 2007-08-28 12:06:40 UTC
Subject: Re:  windres does not escape path with spaces
 in them

Hi Manu,

> Do you have some information on how I can get the CVS binutils 

See:
http://www.gnu.org/software/binutils/binutils.html

> and compile it on Windows?

See the README file at the top level in the sources you checked out of the CVS 
repository.  Assuming that you are using a Cygwin or Mingw development 
environment then you should not have any difficulty compiling the binutils.

Cheers
   Nick


Comment 4 Kai Tietz 2012-02-10 17:35:46 UTC
Hmm, is this issue resolved?
Comment 5 Kai Tietz 2012-02-15 11:59:49 UTC
As this issue is pretty old and I expect reporter won't reply anymore, I will close this bug.  If issue still exists, please open an new report for it.
Comment 6 Emmanuel Stapf 2012-02-16 23:42:09 UTC
I'm still following this bug. So far I've been using the workaround successfully. I'll try on more time without the `--preprocessor' option and report back.
Comment 7 Evgeniy 2015-10-16 18:31:51 UTC
I got this bug today on MinGW-w64 5.1.0
Comment 8 Nick Clifton 2016-03-22 16:54:03 UTC
Hi Guys,

  If I understand this bug report correctly, the problem is that the popen() system call does not cope with paths that contain spaces, right ?  If so, then I am not sure that there is anything that the binutils can actually do.  Is there a Windows specific way (or maybe mingw specific way) of converting a path containing spaces into one that does not contain spaces, but which will still locate the correct file ?

Cheers
  Nick
Comment 9 Nick Clifton 2016-03-22 16:55:48 UTC
Hmm, reads title of the PR.... OK so we need to escape the spaces in the name.
Hang on sec then...
Comment 10 Nick Clifton 2016-03-22 17:23:44 UTC
Created attachment 9119 [details]
Proposed patch

Could someone please try out this *experimental* patch and let me know if it works ?

Cheers
  Nick
Comment 11 Emmanuel Stapf 2016-03-23 14:16:21 UTC
Looking at the patch it seems it would do what it supposed to do. Is there a way to get a binary version ?
Comment 12 Nick Clifton 2016-03-24 09:32:05 UTC
Hi Emmanuel,

> Looking at the patch it seems it would do what it supposed to do. Is there a
> way to get a binary version ?

Sorry - I do not have access to a mingw development environment.  Where do you get your binaries from - maybe they could help create a new one for you ?

I could possibly build a 64-bit cygwin targeted version of windres.  Would that help ?

Cheers
  Nick