Bug 640366

Summary: xrdb puts space after defined symbols
Product: [Fedora] Fedora Reporter: Göran Uddeborg <goeran>
Component: xorg-x11-server-utilsAssignee: X/OpenGL Maintenance List <xgl-maint>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 24CC: A.Thyssen, kmatsui, mefoster, xgl-maint
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 16:50:40 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Göran Uddeborg 2010-10-05 12:33:21 EDT
Description of problem:
If a symbol is defined on the command line, and used in input to xrdb, a space is inserted after the value.

Version-Release number of selected component (if applicable):
xorg-x11-server-utils-7.4-19.fc14.x86_64

How reproducible:
Every time

Steps to Reproduce:
1.echo 'someXResource: HOME/file' | xrdb -merge -DHOME=/my/home/dir
2.xrdb -q | grep someXResource
  
Actual results:
someXResource:  /my/home/dir /file


Expected results:
someXResource:  /my/home/dir/file
Comment 1 Matěj Cepl 2010-10-06 12:12:26 EDT
Trivially reproducable on F14.
Comment 2 Adam Jackson 2012-05-29 17:20:17 EDT
Not xrdb's fault.  xrdb invokes mcpp for macro expansion:

20685 execve("/usr/bin/mcpp", ["/usr/bin/mcpp", "-P", "-DHOST=atropine", "-DSERVERHOST=atropine", "-DSRVR_atropine", "-DDISPLAY_NUM=0", "-DCLIENTHOST=atropine", "-DCLNT_atropine", "-DVERSION=11", "-DREVISION=0", "-DVENDOR=Fedora Project", "-DVNDR_Fedora_Project", "-DRELEASE=11101000", "-DNUM_SCREENS=1", "-DEXT_SGI_GLX", "-DEXT_GLX", "-DEXT_DAMAGE", "-DEXT_Composite", "-DEXT_XINERAMA", "-DEXT_RANDR", "-DEXT_RENDER", "-DEXT_XFIXES", "-DEXT_XC_MISC", "-DEXT_XKEYBOARD", "-DEXT_SYNC", "-DEXT_BIG_REQUESTS", "-DEXT_XTEST", "-DEXT_XInputExtension", "-DEXT_MIT_SHM", "-DEXT_SHAPE", "-DEXT_Generic_Event_Extension", "-DEXT_DRI2", "-DEXT_RECORD", "-DEXT_DOUBLE_BUFFER", "-DEXT_X_Resource", "-DEXT_XVideo_MotionCompensation", "-DEXT_XVideo", "-DEXT_DPMS", "-DEXT_XFree86_DGA", "-DEXT_XFree86_VidModeExtension", "-DEXT_MIT_SCREEN_SAVER", "-DSCREEN_NUM=0", "-DWIDTH=2560", "-DHEIGHT=1600", "-DX_RESOLUTION=3781", "-DY_RESOLUTION=3783", "-DPLANES=24", "-DBITS_PER_RGB=8", "-DCLASS=TrueColor", "-DCLASS_TrueColor=33", "-DCOLOR", "-DCLASS_TrueColor_24=33", "-DCLASS_DirectColor_24=34", "-DCLASS_TrueColor_32=88", "-DHOME=/my/home/dir"], [...]) = 0

And we just read its output:

20685 write(1, "someXResource:  /my/home/dir /fi"..., 35) = 35
20684 <... read resumed> "someXResource:  /my/home/dir /fi"..., 4096) = 35

So this is mcpp, not xrdb.
Comment 3 Mary Ellen Foster 2012-06-01 08:00:19 EDT
A tiny bit of investigation indicates that adding the parameter "-@kr" to the mcpp call gets rid of the extra space. I don't fully understand what's going on, but for now that would at least be a work-around ...
Comment 4 Mary Ellen Foster 2012-06-01 08:07:56 EDT
Looking at the code, inserting the space actually seems to be intentional in "std" (default) mode:
    "An expanded macro is surrounded by spaces to prevent unintended token merging."

So if you don't want spaces after expanded tokens, you need to use either -@kr or -@old as an argument to mcpp
Comment 5 Adam Jackson 2012-06-04 12:16:49 EDT
That's reasonable enough, although the easy way of implementing it further deepens xrdb's assumption that the preprocessor you're using is a (particular) C preprocessor.

Reassigning back to xrdb.
Comment 6 Fedora End Of Life 2013-01-16 17:17:35 EST
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 7 Göran Uddeborg 2013-01-17 14:53:52 EST
Still present in F18, xorg-x11-server-utils-7.5-14.fc18.x86_64.
Comment 8 Fedora End Of Life 2013-12-21 03:26:25 EST
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 9 Göran Uddeborg 2013-12-22 12:18:44 EST
Still present in F20, xorg-x11-server-utils-7.7-2.fc20.x86_64.
Comment 10 Fedora End Of Life 2015-05-29 04:37:37 EDT
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 11 Göran Uddeborg 2015-05-30 12:09:14 EDT
Still present in F22, xorg-x11-server-utils-7.7-15.fc22.x86_64 (and mcpp-2.7.2-13.fc22.x86_64).
Comment 12 Fedora End Of Life 2016-07-19 16:50:40 EDT
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 13 Göran Uddeborg 2016-07-21 03:56:44 EDT
Still present in F24

xorg-x11-server-utils-7.7-19.fc24.x86_64
mcpp-2.7.2-16.fc24.x86_64
Comment 14 antofthy 2016-10-17 21:03:47 EDT
I have posted a bug report for this with XOrg...
  https://bugs.freedesktop.org/show_bug.cgi?id=98300

This show the problem with having a space on the end of the define!
Even though the define did not use quotes to include a space!

As a quick solution users can actually use specify the cpp program to use

   xrdb -cpp /bin/cpp  ....
Comment 15 antofthy 2016-10-18 02:14:12 EDT
Feedback from XOrg...

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.

And it looks like this bug has been around for some time.

Solutions...

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.