public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Renat Golubchyk <RAGermany@gmx.net>
To: gentoo-dev <gentoo-dev@gentoo.org>
Subject: [gentoo-dev] Some environment variables lost after reboot
Date: Sat, 15 Mar 2003 02:25:31 +0100	[thread overview]
Message-ID: <663387645.20030315022531@gmx.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 3492 bytes --]

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 #2: rc-envupdate.patch --]
[-- Type: application/octet-stream, Size: 717 bytes --]

--- 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

[-- Attachment #3: Type: text/plain, Size: 37 bytes --]

--
gentoo-dev@gentoo.org mailing list

             reply	other threads:[~2003-03-15  1:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-15  1:25 Renat Golubchyk [this message]
     [not found] ` <37880000.1047694541@dsl231-045-162.sea1.dsl.speakeasy.net>
2003-03-15 12:14   ` Re[2]: [gentoo-dev] Some environment variables lost after reboot Renat Golubchyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=663387645.20030315022531@gmx.net \
    --to=ragermany@gmx.net \
    --cc=gentoo-dev@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox