Bug 5529 - windres rejects paths in rc files
Summary: windres rejects paths in rc files
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Kai Tietz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-29 23:04 UTC by Gordon Magnusson
Modified: 2008-01-28 16:42 UTC (History)
1 user (show)

See Also:
Host: i686-pc-mingw32
Target: i686-pc-mingw32
Build: i686-pc-mingw32
Last reconfirmed:


Attachments
Allow colon, underscore, and path seperators for not quoted strings (276 bytes, patch)
2008-01-08 09:05 UTC, Kai Tietz
Details | Diff
Also allow hypens in file names (322 bytes, patch)
2008-01-28 15:55 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gordon Magnusson 2007-12-29 23:04:01 UTC
windres 2.18.50 contains the following regression relative to 2.17.50:

C:\demo>dir /s /b
C:\demo\foo
C:\demo\quux.rc
C:\demo\windres-2.17.50-20060824.exe
C:\demo\windres-2.18.50-20071123.exe
C:\demo\foo\bar.txt

C:\demo>type quux.rc
bar.txt eieio foo/bar.txt

C:\demo>type foo\bar.txt
anything

C:\demo>ren windres-2.17.50-20060824.exe windres.exe

C:\demo>.\windres --version
GNU windres 2.17.50 20060824
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

C:\demo>.\windres quux.rc quux1.o

C:\demo>ren windres.exe windres-2.17.50-20060824.exe

C:\demo>ren windres-2.18.50-20071123.exe windres.exe

C:\demo>.\windres --version
GNU windres (GNU Binutils) 2.18.50.20071123
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.

C:\demo>.\windres quux.rc quux2.o
.\windres: can't open file `foo': Permission denied

Both windres executables were downloaded from mingw.org. windres-2.17.50-
20060824.exe contains MinGW-specific patches, but windres-2.18.50-20071123.exe 
was built from plain FSF sources.

Chris Sutcliffe has confirmed that this bug is present in the binutils 2.18.50-
20071229 snapshot (see 
http://article.gmane.org/gmane.comp.gnu.mingw.user/24972 ).
Comment 1 Kai Tietz 2008-01-08 09:05:20 UTC
Created attachment 2181 [details]
Allow colon, underscore, and path seperators for not quoted strings

I patched the token lexer to allow typical file name characters as ':', '_',
'/', and '\\' as secondary token characters in rclex.c.
Comment 2 Henry N. 2008-01-13 21:50:27 UTC
Similar problems on a Linux host with target mingw32.
A simple workarrount is to use "Quotes" for filename.

2 ICON foo-bar.ico
This line in rc file failed in binutils 2.18.50 with message
i686-pc-mingw32-windres: can't open icon file `foo': No such file or directory

2 ICON "foo-bar.ico"
Worked without patch

I Mean your hack would not work all times.
What is with '-' in filenames or utf8?
Comment 3 Henry N. 2008-01-13 22:04:58 UTC
(In reply to comment #2)
> 2 ICON foo-bar.ico
> This line in rc file failed in binutils 2.18.50 with message
> i686-pc-mingw32-windres: can't open icon file `foo': No such file or directory

binutils 2.18.50-20071229 was used for the line above.
Comment 4 Henry N. 2008-01-13 22:17:47 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > 2 ICON foo-bar.ico
> > This line in rc file failed in binutils 2.18.50 with message
> > i686-pc-mingw32-windres: can't open icon file `foo': No such file

Sorry for confusing.
binutils-2.18.50-20080109 was used
Comment 5 Henry N. 2008-01-15 02:47:39 UTC
Have compiled binutils-2.18.50-20080109-src.tar.gz
with host: Linux, target: mingw32.

Filenames with paths works now. Filename with '-' dosn't work.
Filename with "Quotes" works in all versions (old and new).

$ cat test.rc
2 ICON "dir/foo-bar.ico"
Comment 6 Nick Clifton 2008-01-28 15:55:53 UTC
Created attachment 2221 [details]
Also allow hypens in file names
Comment 7 Nick Clifton 2008-01-28 15:57:00 UTC
Hi Gordon,

  This appears to be due to a small omission in Kai's original patch.

  Kai - is there any reason not to apply the uploaded extension to your patch ?

Cheers
  Nick
Comment 8 Kai Tietz 2008-01-28 16:07:10 UTC
Sorry, I simply didn't saw it. No there is no reason for that AFAICS.
Comment 9 Nick Clifton 2008-01-28 16:42:43 UTC
Hi Kai,

  OK, I have applied the patch along with this changelog entry.

Cheers
  Nick

binutils/ChangeLog
2008-01-28  Nick Clifton  <nickc@redhat.com>

	PR binutils/5529
	* rclex.c (yylex): Also allow the hypen character.