Bug#458246: report xrdb: filename:, not <stdin>
tags 458246 + upstream
tags 458246 + patch
thanks
Hello!
On Sun, 30 Dec 2007 19:40:09 +0100, Brice Goglin wrote:
> jidanni@jidanni.org wrote:
>> $ xrdb zz
>> <stdin>:42:20: warning: missing terminating ' character
>>
>> I clearly gave it a filename, as the xrdb man page instructs, but
>> instead it reports "<stdin>". This causes _many hours_ of chasing down
>> the source of errors when used in scripts!
>
> xrdb invokes cpp with your file as stdin. This first warning comes
> from cpp, that's why the warning talks about <stdin>, as opposed to
> other warnings that are issued by xrdb itself.
>
> As always, patches are welcome. Given how simple this program is, it
> would be a good programming exercise for anybody, even a newbie.
Against the Debian package (which is upstream 1.0.4 and the same as the
upstream git at [1]) and very similar to the WIN32 part:
--8<---------------cut here---------------start------------->8---
--- x11-xserver-utils-7.3+2/xrdb/xrdb.c.ORG 2006-07-11 04:54:07.000000000 +0200
+++ x11-xserver-utils-7.3+2/xrdb/xrdb.c 2008-01-06 20:14:06.000000000 +0100
@@ -1203,10 +1203,13 @@
#else
if((cmd = (char *)
malloc(strlen(cpp_program) + strlen(includes.val) + 1 +
- strlen(defines.val) + 1)) ==
+ strlen(defines.val) + 1 +
+ strlen(filename ? filename : "") + 1)) ==
NULL)
fatal("%s: Out of memory\n", ProgramName);
- sprintf(cmd, "%s%s %s", cpp_program, includes.val, defines.val);
+ sprintf(cmd, "%s%s %s %s", cpp_program,
+ includes.val, defines.val,
+ filename ? filename : "");
if (!(input = popen(cmd, "r")))
fatal("%s: cannot run '%s'\n", ProgramName, cmd);
free(cmd);
--8<---------------cut here---------------end--------------->8---
This has been tested on my sid-amd64:
=====
luca@gismo:~/test/x11-xserver-utils-7.3+2/xrdb$ ./configure
[...]
luca@gismo:~/test/x11-xserver-utils-7.3+2/xrdb$ make
[...]
luca@gismo:~/test/x11-xserver-utils-7.3+2/xrdb$ make
[empty, waiting for input as expected until CTRL-C]
luca@gismo:~/test/x11-xserver-utils-7.3+2/xrdb$ ./xrdb -merge ~/.Xresources
/home/luca/.Xresources:16:13: warning: missing terminating ' character
/home/luca/.Xresources:18:17: warning: missing terminating ' character
/home/luca/.Xresources:20:18: warning: missing terminating ' character
luca@gismo:~/test/x11-xserver-utils-7.3+2/xrdb$
=====
Fixing this bug would mean closing bug #443537: since xrdb calls cpp,
these warnings (not errors) will always be shown.
Thx, bye,
Gismo / Luca
Footnotes:
[1] http://gitweb.freedesktop.org/?p=xorg/app/xrdb.git;a=summary
Reply to: