[PATCH] windres: quote the angled brackets to avoid confusing shell

Alibek Omarov a1ba.omarov@gmail.com
Thu Jan 22 22:35:18 GMT 2026


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>
---
 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;
     }
-- 
2.51.0



More information about the Binutils mailing list