Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 382219 - >=app-portage/gentoolkit-0.3: euse adds junk to /etc/make.conf
Summary: >=app-portage/gentoolkit-0.3: euse adds junk to /etc/make.conf
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 346443
  Show dependency tree
 
Reported: 2011-09-08 01:23 UTC by Paul Varner (RETIRED)
Modified: 2012-12-26 20:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
euse_trace (euse_trace,859.39 KB, text/plain)
2011-10-21 17:35 UTC, Christian Ruppert (idl0r)
Details
Disable globbing completely (euse-0.3.0.4-r4-no-globbing-period.patch,1.59 KB, patch)
2011-10-30 20:25 UTC, Jared Hancock
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Varner (RETIRED) gentoo-dev 2011-09-08 01:23:23 UTC
[18:15:10] <idl0r> fuzzyray, dol-sen: euse -D <someflag> -- does it at some crap to your make.conf as well?
[18:15:19] <antarus> add?
[18:15:36] <idl0r> gentoolkit-9999 with testing portage (but seems its *not* gentoolkit related)
[18:15:46] <idl0r> yup, add
[18:16:14] <idl0r> i suspect a broken metadata or so :/
[18:16:34] <idl0r> --help.gkb -h.gkb will be added and "-*" will be removed
[18:17:02] <idl0r> it only happens if you have -* in USE
[07:28:40] <idl0r> dol-sen, fuzzyray: it happens in reduce_incrementals()
[07:31:26] <idl0r> dol-sen, fuzzyray: ACTIVE_FLAGS[1]="$(reduce_incrementals ${ACTIVE_FLAGS[1]} "${USE}")" - the quotes around ${USE} solve the problem for me
[07:32:54] <idl0r> dol-sen, fuzzyray: yup, quoting is necessary there.. it tries to do "-*" on the zsh which returns: zsh: command not found: --help.gkb
Comment 1 Paul Varner (RETIRED) gentoo-dev 2011-09-08 01:32:48 UTC
Released in gentoolkit-0.3.0.4-r4
Comment 2 Christian Ruppert (idl0r) gentoo-dev 2011-09-08 14:38:24 UTC
Unfortunately there is still something wrong :(

If you echo the $@ in reduce_incrementals() everything is fine but the return value of it isn't. So I suspect something with the piped command is wrong but I didn't get to it yet :(
Comment 3 Christian Ruppert (idl0r) gentoo-dev 2011-10-09 12:44:54 UTC
I can even reproduce it with a "empty" make.conf with just USE="-*" and then e.g. euse -E libssh2.

in line 280-284:
USE=""
for x in $(get_all_make_conf); do
    source "${x}"
    ACTIVE_FLAGS[1]="$(reduce_incrementals "${ACTIVE_FLAGS[1]}" "${USE}")"
done 
USE=""

A echo $USE after sourcing the make.conf already contains the junk.
Doing that in a test shell script works fine.
Comment 4 Christian Ruppert (idl0r) gentoo-dev 2011-10-09 12:48:10 UTC
Currently all 0.3.* as well as 9999 versions are affected.
0.2.4.6.1-r1 seems to work fine.
Comment 5 Christian Ruppert (idl0r) gentoo-dev 2011-10-09 12:51:32 UTC
CC'ing Jared because of "Jared Hancock (Signigicant rewrite for package.use support)".
He might have some ideas.
Comment 6 Jared Hancock 2011-10-16 02:12:06 UTC
Seriously guys?, a snippet from an IRC chat to describe a problem? -- And it doesn't even give any hint on what the problem actually looks like. 

Anyway -- ignore my cynicism. I can't reproduce this on my system. I just updated to the latest, released gentoolkit

$ euse -V
euse (0.3.0.4-r4)
Written by Marius Mauch

Copyright (C) 2004-2009 Gentoo Foundation, Inc.
This is free software; see the source for copying conditions.

As described, I deleted my make.conf and replaced it with a single line:

USE="-*"

and executed

euse -E libssh2

and now my make.conf contains

$ cat /etc/make.conf
USE="-* libssh2"

I'm confused on a few issues:
  - What's the "crap" it adds to make.conf?
  - How is zsh relevant? The shebang at the top of euse gives /bin/bash as the interpreter
  - (Perhaps I'll expose my ignorance) The quotes around variables passed to bash functions ensures that variable content with spaces and such are interpreted as a single variable -- instead of being split up into several variables. reduce_incrementals, on the bash side, just echo's $@, which will completely discard whether there were 2 variables given or 200 when the result is read from stdin by Python.

What version of Python is your system using? I'm using 2.6 on mine, but even switching to 3.1, I couldn't reproduce the bug. What about bash and zsh? Have you tried running euse from a bash prompt to see if it behaves the same?

Could you post the before and after make.conf you're seeing -- with the added crap. Seeing it might me as to where it's coming from.

Cheers,

Jared
Comment 7 Christian Ruppert (idl0r) gentoo-dev 2011-10-16 11:46:18 UTC
(In reply to comment #6)
> Seriously guys?, a snippet from an IRC chat to describe a problem? -- And it
> doesn't even give any hint on what the problem actually looks like. 
> 

That was to make sure we don't forget this issue.
Also I tried to describe it better in the comment(s).

> Anyway -- ignore my cynicism. I can't reproduce this on my system. I just
> updated to the latest, released gentoolkit
> 
> $ euse -V
> euse (0.3.0.4-r4)
> Written by Marius Mauch
> 
> Copyright (C) 2004-2009 Gentoo Foundation, Inc.
> This is free software; see the source for copying conditions.
> 
> As described, I deleted my make.conf and replaced it with a single line:
> 
> USE="-*"
> 
> and executed
> 
> euse -E libssh2
> 
> and now my make.conf contains
> 
> $ cat /etc/make.conf
> USE="-* libssh2"
> 
> I'm confused on a few issues:
>   - What's the "crap" it adds to make.conf?

As I said "--help.gkb -h.gkb".
So it replaces "-*" by the crap above and if you run "-*" in your shell then you'll notice that it returns something like "bash: --help.gkb: command not found"

>   - How is zsh relevant? The shebang at the top of euse gives /bin/bash as the
> interpreter

Ignore that.

>   - (Perhaps I'll expose my ignorance) The quotes around variables passed to
> bash functions ensures that variable content with spaces and such are
> interpreted as a single variable -- instead of being split up into several
> variables. reduce_incrementals, on the bash side, just echo's $@, which will
> completely discard whether there were 2 variables given or 200 when the result
> is read from stdin by Python.
> 
> What version of Python is your system using? I'm using 2.6 on mine, but even
> switching to 3.1, I couldn't reproduce the bug. What about bash and zsh? Have
> you tried running euse from a bash prompt to see if it behaves the same?

2.6.6-r2. The same with bash and zsh.

See comment 3, $USE contains this crap immediately after the "source" call.
I can't reproduce it in my test script and I also can't reproduce it with gentoolkit-0.2*.

It works fine on my server and other system so right now *only* my desktop is affected. I don't know what is different here that could cause this.
I tried to remove my /etc/portage as well as some other things - Still the same.

So atm we know:
It happens with gentoolkit-0.3* only
Only using "-*" will cause trouble
The junk will be "added" after or even *during* the source call to the $USE variable
It works fine if you source the make.conf in a test script

> 
> Could you post the before and after make.conf you're seeing -- with the added
> crap. Seeing it might me as to where it's coming from.
> 

As I said above, "empty" make.conf with only USE="-*"

> Cheers,
> 
> Jared
Comment 8 Paul Varner (RETIRED) gentoo-dev 2011-10-21 04:58:23 UTC
I'm running out of ideas since I can't reproduce.  Can you change the shebang line to /usr/bin/bash -x, run the command and attach the output?
Comment 9 Christian Ruppert (idl0r) gentoo-dev 2011-10-21 17:35:51 UTC
Created attachment 290473 [details]
euse_trace
Comment 10 Jared Hancock 2011-10-23 03:27:57 UTC
Looking at the trace file, it definitely looks like a globbing issue (with the "-*"). I would imagine that the reduce_incrementals function (and friends) needs a "set -f". It's late, so I'll try and reproduce it tomorrow or Monday.

Cheers,

Jared
Comment 11 Jared Hancock 2011-10-30 20:25:05 UTC
Created attachment 291277 [details, diff]
Disable globbing completely

So far, the only way I have been able to reproduce this issue is by creating two files in the directory I run euse from: "--help.gkb" and "-h.gkb". Whether or not that is the root of the issue described, it does reproduce the same problem.

This patch completely disables shell globbing except in the couple of places it is actually needed. I feel this makes more sense rather than continuing to disable it in locations globbing causes problems.

I suppose this fix might be a bit aggressive -- and it might require significant testing before accepted. But does it fix the crap-insertion issue?

Cheers,

Jared
Comment 12 Paul Varner (RETIRED) gentoo-dev 2012-03-06 05:38:13 UTC
The patch was applied in the following commit, and can be tested with gentoolkit-9999.

http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=2b73c56a831e188b1780f0749564dad8af8d13f8
Comment 13 Paul Varner (RETIRED) gentoo-dev 2012-12-26 20:49:39 UTC
idl0r, this patch has been in gentoolkit since gentoolkit-0.3.0.6, have you had any problems since then?