Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev <gentoo-dev@g.o>
From: Renat Golubchyk <RAGermany@...>
Subject: Some environment variables lost after reboot
Date: Sat, 15 Mar 2003 02:25:31 +0100
Hi!

I'm a Gentoo newbie (a couple of years of Linux experience though).
Since I just made a clean stage1 install I have to configure my
system. And the first thing I did have brought me some annoying
"problems".

Particularly, I modified the LESS variable in /etc/env.d/70less so I
have some info displayed. And then I did env-update which updated my
/etc/profile.env. After reboot though profile.env lacked the changes I
made (LESS wasn't there). So I did env-update again and it updated
profile.env just fine. But after every reboot LESS was gone again.

After some hours I found out that the problem was caused by
/sbin/rc-envupdate.sh script that was called on reboot from 'bootmisc'
in runlevel 'boot' (when it says "Updating environment"). After some
debugging I found out that, when rc-envupdate.sh parses the files in
/etc/env.d it creates a list of variables it founds. But every name is
only once in the list so it knows what to write to profile.env .

The ambiguity check is pretty simple: the first match of current
variable is deleted from the list of already known variables and the
resulting list is compared to the original list. If they are equal
then we have a new variable, if they are not equal then we have found
an already known variable.

Now to my problem. In /etc/env.d/00basic there is a variable called
LESSOPEN. My LESS variable is in 70less so it is parsed later. While
rc-envupdate.sh was making check on LESS it simply deleted LESS from
LESSOPEN because LESSOPEN already was in the list. It means that
rc-envupdate.sh doesn't check for whole words but only for substrings
(env-update _does_ look for words).

I don't think this is a serious bug, since everybody can just change
the 'bootmisc' script to call env-update instead. But env-update is
written in python and needs more time to do the same job
(rc-envupdate.sh is in bash). I don't whether I should file a bug
report, but I didn't find anything similar in the bug database.

So here is the patch (or in the attachment):
========================= patch starts here =========================
--- rc-envupdate.sh     2003-03-14 02:06:07.000000000 +0100
+++ rc-envupdate.sh.new 2003-03-15 01:09:15.000000000 +0100
@@ -52,14 +52,14 @@
                        (/bin/awk '!/^#|^\t+#/ { gsub ( /=/, "\t" ) ; print $0 }' ${x}) | \
                                while read -r variable value
                        do
-                               if [ "$(eval echo \${VARLIST/${variable}/})" = "${VARLIST}" -a \
+                               if [ "$(eval echo \${VARLIST/ ${variable} /})" = "$(eval echo \${VARLIST/# /})" -a \
                                     -n "${variable}" -a -n "${value}" ]
                                then
                                        if [ -n "${VARLIST}" ]
                                        then
-                                               VARLIST="${VARLIST} ${variable}"
+                                               VARLIST="${VARLIST} ${variable} "
                                        else
-                                               VARLIST="${variable}"
+                                               VARLIST=" ${variable} "
                                        fi
                                        echo "${VARLIST}" >${svcdir}/varlist
                                fi
========================= patch ends here =========================


Did anybody experience this behavior?


Regards,
  Renat

-- 
Don't worry. Be hippy.
Attachment:
rc-envupdate.patch (Binary data)
--
gentoo-dev@g.o mailing list
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: ISC-Bind inconsistancy
Next by thread:
Re: [gentoo-dev] Some environment variables lost after reboot
Previous by date:
Re: ISC-Bind inconsistancy
Next by date:
Re: output from qpkg / gentoolkit without ESC codes


Updated Jun 17, 2009

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.