Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 17549 - /sbin/rc-envupdate.sh doesn't write LESS to /etc/profile.env if LESSOPEN is parsed earlier
Summary: /sbin/rc-envupdate.sh doesn't write LESS to /etc/profile.env if LESSOPEN is p...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-15 07:03 UTC by Renat Golubchyk
Modified: 2003-03-16 11:24 UTC (History)
0 users

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


Attachments
A patch to /sbin/rc-envupdate.sh (rc-envupdate.patch,717 bytes, patch)
2003-03-15 07:04 UTC, Renat Golubchyk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Renat Golubchyk 2003-03-15 07:03:21 UTC
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.

I found out that the problem was caused by /sbin/rc-envupdate.sh 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 finds. But
every variable name is included 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 the problem. In /etc/env.d/00basic there is a variable called LESSOPEN.
But LESS is in 70less so it is parsed later. When rc-envupdate.sh was checking
the list for LESS it simply deleted the first occurance of LESS which was a part
of LESSOPEN. This left OPEN in the list. The ambiguity check returned false
(different strings) ==> not a new variable.

It means that rc-envupdate.sh doesn't try to match whole words but merely
substrings. On the other hand, env-update works fine as far as this issue is
concerned.

A patch is attached.


PS. Is rc-envupdate.sh necessary? env-update works fine (except that it's slower)

Reproducible: Always
Steps to Reproduce:
1. Add a variable to /etc/env.d/XXsomething
2. Add a second variable which name is a substring of the first variable to
/etc/env.d/YYsomething where YY > XX
3. run /sbin/rc-envupdate.sh and backup the generated /etc/profile.env.
4. run env-update
5. compare the results
Comment 1 Renat Golubchyk 2003-03-15 07:04:36 UTC
Created attachment 9410 [details, diff]
A patch to  /sbin/rc-envupdate.sh
Comment 2 Renat Golubchyk 2003-03-15 07:12:08 UTC
Just forgot to mention. I have just installed Gentoo 1.4_rc3 but I think this bug is as well related to erlier Gentoo releases. (There is no option for 1.4_rc3 in "Version" dropdown menu in bugzilla.)
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-16 01:20:39 UTC
Hi.  This bug and others have already been fixed, and are in baselayout-1.8.6.3,
which will hopefully be out and ready for use after I have verified that it is
much more newbie proof in upgrading to it.
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-16 11:24:10 UTC
I did though apply to the old version which will be installed if we cannot
compile the gawk module, thanks.