Bug 32701 - xrdb-1.0.7 ignores continuation lines; runtime error with GCC 4.5
Summary: xrdb-1.0.7 ignores continuation lines; runtime error with GCC 4.5
Alias: None
Product: xorg
Classification: Unclassified
Component: App/xrdb (show other bugs)
Version: 7.4 (2008.09)
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
Keywords: patch
Depends on:
Reported: 2010-12-28 07:36 UTC by Ulrich Müller
Modified: 2011-10-15 16:31 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Proposed patch for xrdb.c (407 bytes, patch)
2010-12-28 07:36 UTC, Ulrich Müller
no flags Details | Splinter Review

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:

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.