Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 270538 - emerge does not properly process comments in /etc/portage/package.use
Summary: emerge does not properly process comments in /etc/portage/package.use
Status: RESOLVED DUPLICATE of bug 141747
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-20 09:34 UTC by Bryant Hansen
Modified: 2009-05-20 15:41 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bryant Hansen 2009-05-20 09:34:08 UTC
In package.use, I like to sometimes comment out use flags on the same line that is being processed.  I just realized that there is a problem with this, at least in the use case that I'm showing below.

Here is a line that I had in my package.use:

app-emulation/virtualbox-ose headless  # additions

When I attempt an "emerge -uDN world -pv", or an "emerge virtualbox-ose -pv", I see the following output:

============
ebuild   R   ] app-emulation/virtualbox-ose-1.6.6  USE="additions* headless qt3 -alsa -pulseaudio -sdk" 0 kB
============


I didn't know why the "additions" flag was pulled in.

I changed the line in my package.use to remove the comment:
app-emulation/virtualbox-ose headless

and with "emerge virtualbox-ose -pv", I see the following output:

============
These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] app-emulation/virtualbox-ose-1.6.6  USE="headless qt3 -additions -alsa -pulseaudio -sdk" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB
============

It seems that the use flag that appears *after* the comment in the first part is being processed.  I think this is *not* intended behavior.


Reproducible: Always

Steps to Reproduce:
1. Edit /etc/portage/package.use
2. At the end of an existing line, add a comment character '#' followed by a use flag that's not currently selected
3. Emerge the package

Actual Results:  
The flag that is commented out at the end of the line is processed and used by emerge.

Expected Results:  
The commented flag should not be used.

This is probably a trivial upgrade.  The text processor for package.use should throw away everything that appears after every comment character until the end of the line.

A preprocessor (or whatever handles comments in package.use) should add the regex, "s/\#.*$//g"

The expected result can be demonstrated on the command line by the following:

cat /etc/portage/package.use | sed "s/\#.*$//g"
Comment 1 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2009-05-20 14:59:42 UTC

*** This bug has been marked as a duplicate of bug 141747 ***
Comment 2 Bryant Hansen 2009-05-20 15:41:34 UTC
Oops.  I did multiple a bug searches before filing this; I looked through the automated one and I did an extra search of my own.  I just didn't consider using the non-default search options of including resolved bugs.

I would agree with the other posters that it would be more intuitive, and follow more standard commenting conventions, if "end-of-line comments" were allowed.  It would also put an end to even more duplicate bugs like this being submitted.  However, it's easy for me to work around now that I know the behavior.