[binutils-gdb] windres: quote the angled brackets to avoid confusing shell
Alan Modra
amodra@sourceware.org
Sat Jan 24 03:34:20 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0b7ca8278cd4caba66172622551f0840f82e905f
commit 0b7ca8278cd4caba66172622551f0840f82e905f
Author: Alibek Omarov <a1ba.omarov@gmail.com>
Date: Fri Jan 23 03:35:18 2026 +0500
windres: quote the angled brackets to avoid confusing shell
When invoking windres with a preprocessor parameter that contains angled
brackets, the shell will try to interpret them, leading to an error.
For example with an empty test.rc file:
$ i686-w64-mingw32-windres '-DTEST=<foo>' -o test.o -i test.rc
sh: 1: cannot open foo: No such file
i686-w64-mingw32-windres: preprocessing failed.
After patch it correctly complains about no resources baked in:
$ ./i686-w64-mingw32-windres '-DTEST=<foo>' -o test.o -i test.rc
./i686-w64-mingw32-windres: no resources
Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
Diff:
---
binutils/windres.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/binutils/windres.c b/binutils/windres.c
index e7dd61aad4f..11cf3d5652c 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -692,7 +692,7 @@ quot (const char *string)
for (src = string, dest = buf; *src; src++, dest++)
{
- if (*src == '(' || *src == ')' || *src == ' ')
+ if (*src == '(' || *src == ')' || *src == ' ' || *src == '<' || *src == '>')
*dest++ = '\\';
*dest = *src;
}
More information about the Binutils-cvs
mailing list