Bug 98300

Summary: xrdb should NOT use mcpp!
Product: xorg Reporter: Anthony <A.Thyssen>
Component: App/xrdbAssignee: Alan Coopersmith <alan.coopersmith>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Anthony 2016-10-18 00:47:15 UTC
xrdb on many systems use mcpp instead of cpp as it declares in the manpage.

ASIDE: Also there is no easy way (without using trace commands) to see what preprocessor it is using, and what the output of the preprocessor is.

The preprocessor mcpp adds a space after all its defines, but a common use for those defines is in 'file path' components.  For example...

#define HOME  /home/user

*BitmapFilePath: HOME/icons:/usr/include/X11/bitmaps

The result of this is the setting..

*BitmapFilePath: /home/user /icons:/usr/include/X11/bitmaps

Which is clearly incorrect.


SOLUTION....

Please ensure that either cpp is used (which does not add a space to the end of defines) or add a -@kr or -@old  option to mcpp.

Also add a option to check which cpp is actually used, AND/OR output the result
of the cpp, so it can be checked.



This bug has also been previously reported to the redhat bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=640366
Comment 1 Alan Coopersmith 2016-10-18 02:01:31 UTC
xrdb as provided by X.Org looks for a program named "cpp".

If distros have provided mcpp as cpp, or passed --with-cpp=mcpp as Fedora does:
http://pkgs.fedoraproject.org/cgit/rpms/xorg-x11-server-utils.git/tree/xorg-x11-server-utils.spec#n109
we can't stop them from introducing bugs in their packages like this.
Comment 2 Anthony 2016-10-18 06:13:46 UTC
(In reply to Alan Coopersmith from comment #1)
> xrdb as provided by X.Org looks for a program named "cpp".
> 
> If distros have provided mcpp as cpp, or passed --with-cpp=mcpp as Fedora
> does:
> http://pkgs.fedoraproject.org/cgit/rpms/xorg-x11-server-utils.git/tree/xorg-
> x11-server-utils.spec#n109
> we can't stop them from introducing bugs in their packages like this.


How about the requested option to help debug cpp problems with xrdb?
Comment 3 Alan Coopersmith 2016-10-18 06:16:45 UTC
Such an option could be useful, which is why I didn't just close this out as
"Not Our Bug", but I don't know when anyone will have time to write the code
for it.
Comment 4 Alan Coopersmith 2018-03-25 06:33:28 UTC
xrdb --help will show the default preprocessor:

 -cpp filename       preprocessor to use [/usr/lib/cpp]

xrdb -n will show the parsed output

What seems to be missing is an option to show the cpp output before xrdb parses it.  I've added a -E flag (name taken from cc -E since I couldn't think of any
better name) that shows both the full cpp command line (with all the -D/-I/etc.
flags) and the generated output file.

Patch submitted for code review:
https://patchwork.freedesktop.org/patch/212799/

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.