From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31532 invoked by uid 1002); 15 Mar 2003 01:25:58 -0000 Mailing-List: contact gentoo-dev-help@gentoo.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Received: (qmail 24790 invoked from network); 15 Mar 2003 01:25:57 -0000 Date: Sat, 15 Mar 2003 02:25:31 +0100 From: Renat Golubchyk X-Mailer: The Bat! (v1.62i) Business Reply-To: Renat Golubchyk X-Priority: 3 (Normal) Message-ID: <663387645.20030315022531@gmx.net> To: gentoo-dev MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----------816318C273D3285" Subject: [gentoo-dev] Some environment variables lost after reboot X-Archives-Salt: 7a364979-786a-43f3-942d-2a95815a06c4 X-Archives-Hash: 8a2d6e23b7750c259669f7f530ccd4e4 ------------816318C273D3285 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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. ------------816318C273D3285 Content-Type: application/octet-stream; name="rc-envupdate.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="rc-envupdate.patch" LS0tIHJjLWVudnVwZGF0ZS5zaAkyMDAzLTAzLTE0IDAyOjA2OjA3LjAwMDAwMDAwMCArMDEwMAor KysgcmMtZW52dXBkYXRlLnNoLm5ldwkyMDAzLTAzLTE1IDAxOjA5OjE1LjAwMDAwMDAwMCArMDEw MApAQCAtNTIsMTQgKzUyLDE0IEBACiAJCQkoL2Jpbi9hd2sgJyEvXiN8Xlx0KyMvIHsgZ3N1YiAo IC89LywgIlx0IiApIDsgcHJpbnQgJDAgfScgJHt4fSkgfCBcCiAJCQkJd2hpbGUgcmVhZCAtciB2 YXJpYWJsZSB2YWx1ZQogCQkJZG8KLQkJCQlpZiBbICIkKGV2YWwgZWNobyBcJHtWQVJMSVNULyR7 dmFyaWFibGV9L30pIiA9ICIke1ZBUkxJU1R9IiAtYSBcCisJCQkJaWYgWyAiJChldmFsIGVjaG8g XCR7VkFSTElTVC8gJHt2YXJpYWJsZX0gL30pIiA9ICIkKGV2YWwgZWNobyBcJHtWQVJMSVNULyMg L30pIiAtYSBcCiAJCQkJICAgICAtbiAiJHt2YXJpYWJsZX0iIC1hIC1uICIke3ZhbHVlfSIgXQog CQkJCXRoZW4KIAkJCQkJaWYgWyAtbiAiJHtWQVJMSVNUfSIgXQogCQkJCQl0aGVuCi0JCQkJCQlW QVJMSVNUPSIke1ZBUkxJU1R9ICR7dmFyaWFibGV9IgorCQkJCQkJVkFSTElTVD0iJHtWQVJMSVNU fSAke3ZhcmlhYmxlfSAiCiAJCQkJCWVsc2UKLQkJCQkJCVZBUkxJU1Q9IiR7dmFyaWFibGV9Igor CQkJCQkJVkFSTElTVD0iICR7dmFyaWFibGV9ICIKIAkJCQkJZmkKIAkJCQkJZWNobyAiJHtWQVJM SVNUfSIgPiR7c3ZjZGlyfS92YXJsaXN0CiAJCQkJZmkK ------------816318C273D3285 Content-Type: text/plain; charset=us-ascii -- gentoo-dev@gentoo.org mailing list ------------816318C273D3285--