Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 219864

Summary: app-admin/eselect fails on env variables with whitespace in value, despite quoting
Product: Gentoo Linux Reporter: Holger Hoffstätte <holger>
Component: [OLD] Core systemAssignee: Gentoo eselect Team <eselect>
Status: RESOLVED FIXED    
Severity: normal CC: cphil, I.zaufi
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: bash trace
Patch for config.bash

Description Holger Hoffstätte 2008-04-30 17:30:22 UTC
eselect is a wonderful system, but for the longest time I was wondering why eselect opengl set <opengl-impl> always died with a unhelpful "Killed" message, corrupting the generated /etc/profile.env.
Turns out that this was caused by a custom entry in /etc/env.d/99java with Java-typical property definitions, like e.g.: ANT_OPTS='-Duser.language=en -Djava.awt.headless=true'.
After removing this entry from env.d, eselect would work fine without crapping out.


Reproducible: Always

Steps to Reproduce:
1. echo "BUG='-Dfoo=bar -Dfrob=blob'" > /etc/env.d/99bug
2. eselect opengl set xorg-x11
3. eh?


Actual Results:  
Switching to xorg-x11 OpenGL interface...zsh: killed     eselect opengl set xorg-x11


Expected Results:  
$echo "BUG='-Dfoo=bar'" > /etc/env.d/99bug                                                                                              
$eselect opengl set xorg-x11              
Switching to xorg-x11 OpenGL interface... done


I first suspected that eselect's key/value parser would blindly split on '=' without treating the value of a variable definition as a whole, but it turned out that the bug is with the space between multiple -D property definitions. As demonstrated, it works just fine with only one property. FWIW the quoting style of the variable (" vs. ') does not make a difference.
Comment 1 Holger Hoffstätte 2008-05-01 14:10:59 UTC
Forgot to mention the eselect version I'm using:
eselect-1.0.11-r1
eselect-opengl-1.0.6-r1
Comment 2 Ulrich Müller gentoo-dev 2009-04-15 22:19:02 UTC
Does the following patch fix the problem?
<http://sources.gentoo.org/viewcvs.py/eselect/trunk/libs/config.bash.in?r1=305&r2=328>
Comment 3 Holger Hoffstätte 2009-04-16 12:11:55 UTC
(In reply to comment #2)
> Does the following patch fix the problem?
> <http://sources.gentoo.org/viewcvs.py/eselect/trunk/libs/config.bash.in?r1=305&r2=328>

Thanks for responding - unfortunately it does not help, same result as before.
Comment 4 Ulrich Müller gentoo-dev 2009-04-16 13:02:13 UTC
(In reply to comment #3)
> Thanks for responding - unfortunately it does not help, same result as before.

I was just guessing, since I can't reproduce it. Works for me with both eselect-1.0.11-r1 or eselect branch 1.0.x as of today.

Could you please attach the output of the following command:
$ bash -vx /usr/bin/eselect opengl set xorg-x11
Comment 5 Holger Hoffstätte 2009-04-16 13:19:27 UTC
Created attachment 188562 [details]
bash trace
Comment 6 Ulrich Müller gentoo-dev 2009-04-16 14:12:27 UTC
Created attachment 188570 [details, diff]
Patch for config.bash

Thanks. That trace really helped.
"eselect env update" should show the problem more clearly.

Does attached patch fix the issue for you?
Comment 7 Holger Hoffstätte 2009-04-16 14:23:17 UTC
(In reply to comment #6)

Yay! It works. Great job :)
Comment 8 Ulrich Müller gentoo-dev 2009-04-16 14:48:29 UTC
Committed to trunk (r434) and 1.0.x branch (r436).
This will be fixed in the upcoming 1.0.12 release.

Thank you for reporting the issue.
Comment 9 Ulrich Müller gentoo-dev 2009-04-16 22:30:35 UTC
*** Bug 257502 has been marked as a duplicate of this bug. ***
Comment 10 Ulrich Müller gentoo-dev 2009-04-18 08:37:47 UTC
Fixed in 1.0.12.