makedep: Sanitize the module names before turning them into resource ids.

Francois Gouget fgouget at free.fr
Mon Feb 23 12:45:29 CST 2015


On Fri, 20 Feb 2015, Alexandre Julliard wrote:
[...]
> There's no reason that resource ids can't contain dashes,

You're right, it's a bug in wrc.

The simple fix would be to add '-' to the set of allowed characters for 
tIDENT but in fact the resource and type ids (and probably filenames) 
can contain pretty much any character. That's much harder to handle in 
the parser however :-(

The problem is we can have things like:

---
/* A resource called '1,2,3,4' of type '5,6,7,8' */
1,2,3,4   5,6,7,8   special-characters-must-be-quoted.exe

/* A VERSIONINFO resource called '4,3,2,1' */
4,3,2,1   16
FILEVERSION 1,0x2,3,4
FILESUBTYPE 0x0
{ BLOCK "StringFileInfo" { } }

1,2,%,4   5,$,7,(   api.exe
---

So the problem is that sometimes 1,2,3,4 should be treated as a single 
token (tIDENT), and sometimes as 7 tokens: four numbers and three 
commas.

I'm not sure the lexer can distinguish between these two cases on its 
own. Maybe if it switches to the 'numbers please' mode when returning a 
FILEVERSION token (and the others like it), and also when returning an 
opening brace. It would then have to count the opening/closing braces 
(resp BEGIN/END tokens) to know when to go back to its default state. 
And this probably is not limited to the VERSIONINFO type of resource.

Another option would be to switch the lexer state from the grammatical 
parser but that's frowned upon. So if it's not necessary it would be 
nice to avoid it.

Interestingly, commas are not allowed in unquoted filenames: this means 
that at this point it treats commas as separators, just like in the file 
resource. However characters like '^' or '$' are allowed.

Any opening brace also seems to have an impact: '1 3,4 dummy' 
complains dummy does not exist, but '{ 1 3,4 dummy' complains '3' does 
not exist. So does '{ 1,2 3,4' so the first comma does not seem to be 
treated as a separator.


> and besides, winetest won't know what to do with it if you change the 
> name.

I did test and that worked... just had to use underscores.

-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
              E-Voting: It's not the people who vote that count.
                     It's the people who count the votes.



More information about the wine-devel mailing list