Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 5777 - useflag can 0 make.conf
Summary: useflag can 0 make.conf
Status: RESOLVED INVALID
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: x86 Linux
: High critical
Assignee: Karl Trygve Kalleberg (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-30 11:05 UTC by Paul Belt
Modified: 2011-10-30 22:19 UTC (History)
1 user (show)

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 Paul Belt 2002-07-30 11:05:34 UTC
1) Make sure there are no USE= in your make.conf

2) Interactively update your use flags (would be better with a menu akin to
etc-update)

3) Watch the sed expression fail:  'sed: -e expression #1, char 696: No previous
regular expression'

Below is a diff to fix it.

--- useflag.orig        Tue Jul 30 16:02:08 2002
+++ useflag     Tue Jul 30 16:02:50 2002
@@ -159,6 +159,7 @@
 do_write_make() {
        local use_write="USE=\"$@\""
        local old_use="USE=\"`do_get_make dashes`\""
+        [ -z "${old_use}" ] && olduse=""
        if [ -w ${make_conf} ] && [ -w ${make_conf_dir} ]; then
                local use_write="USE=\"$@\""
                local old_use=`grep "USE=\"" ${make_conf} | grep -v "#"`
Comment 1 Paul Belt 2002-07-30 11:07:32 UTC
Futher testing shows 1) that diff didn't fix it... and 2) it doesn't matter hwo
you choose to set it...as long as USE is non-existant, sed fails
Comment 2 Daniel Robbins (RETIRED) gentoo-dev 2002-08-01 00:22:48 UTC
I didn't write "useflag;" assigning to karltk who probably knows who wrote it.
Comment 3 Nicholas Jones (RETIRED) gentoo-dev 2002-08-02 01:03:04 UTC
How about

USE=${USE} somewhere before the sed expression?

guarentees declaration...
Comment 4 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-08-04 16:19:26 UTC
Once you've written a fix for this, please attach your patch and reassign the 
bug back to me so that I may include it into Gentoolkit ASAP.
Comment 5 Paul Belt 2002-08-04 16:53:04 UTC
--- useflag.orig        Tue Jul 30 12:02:08 2002
+++ useflag     Sun Aug  4 17:53:25 2002
@@ -164,6 +164,13 @@
                local old_use=`grep "USE=\"" ${make_conf} | grep -v "#"`
                local start_line=`grep -n "USE=\"" ${make_conf} | \
                        grep -v "#" | cut -d ":" -f1`
+               if [ -z "${old_use}" ]; then
+                  echo "No USE=\"\" in ${make_conf}"
+                   old_use='USE=""'
+                  cp ${make_conf} ${make_temp} && \
+                     echo ${old_use} >> ${make_temp} && \
+                     mv ${make_temp} ${make_conf}
+               fi
                if [ "${old_use:0-1}" != "\\" ]; then
                        sed -e "s/${old_use}/${use_write}/" ${make_conf} > \
                                ${make_temp}
Comment 6 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-08-07 17:01:56 UTC
I've read through the latest useflag code. It needs major rework to be even 
remotely safe. I have removed it from gentoolkit pending a major overhaul.

I don't feel comfortable with it clearing out my /etc/make.conf consistently 
when I do:

useflag -a foo

It always does this if make.conf looks like
USE="foo bar
baz bax"

Which is very common when one has a good collection of useflags.

Comment 7 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-08-26 09:42:41 UTC
I guess this one is invalidated by your useflag rewrite ;)