Bug 32701

Summary: xrdb-1.0.7 ignores continuation lines; runtime error with GCC 4.5
Product: xorg Reporter: Ulrich Müller <ulm>
Component: App/xrdbAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium Keywords: patch
Version: 7.4 (2008.09)   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Proposed patch for xrdb.c none

Description Ulrich Müller 2010-12-28 07:36:42 UTC
Created attachment 41488 [details] [review]
Proposed patch for xrdb.c

This is a forward of Gentoo bug 347758: <http://bugs.gentoo.org/show_bug.cgi?id=347758>

I've the following in my .Xdefaults (unchanged since a long time):

    *VT100.Translations: #override \
        <Key>BackSpace: string(0x7F)\n\
        <Key>Delete:    string("\033[3~")

With xrdb-1.0.7 and gcc-4.5.1, the backslash for line continuation doesn't work any more. xrdb -q shows that each of the above lines will end up in an own resource:

*VT100.Translations:    #override
<Key>BackSpace: string(0x7F)\n
<Key>Delete:    string("\033[3~")

Whereas with gcc-4.4.5 everything is as it should be:

*VT100.Translations: #override    <Key>BackSpace: string(0x7F)\n    <Key>Delete: string("\033[3~")

The problem depends only on the gcc version active at run time. It doesn't matter if xrdb is compiled with gcc 4.4 or 4.5.

My guess is that it's caused by this change of C preprocessor behaviour: <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41748>
So adding option -P or -traditional-cpp to the cpp call should fix the problem.

Patch is attached.
Comment 1 Alan Coopersmith 2010-12-28 08:03:16 UTC
While it's better than --traditional-cpp, I'm not sure hardcoding -P
is portable to all supported platforms.   Would need to get review on
xorg-devel from maintainers of other platforms first.
Comment 2 Alan Coopersmith 2011-01-07 15:07:05 UTC
Since no one objected to -P on xorg-devel review and it seems to be
supported in the versions of cpp we deal with, fix is now pushed to
git master:
http://cgit.freedesktop.org/xorg/app/xrdb/commit/?id=117021570515fa985670f78d27376d636ed5490f

Thanks for finding the solution and submitting the patch.

Will release xrdb 1.0.8 after people have had a while to test git.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.