Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 71285 - env-update is not allways executed when there is a change
Summary: env-update is not allways executed when there is a change
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Reported: 2004-11-15 07:10 UTC by Paul Pacheco
Modified: 2005-06-12 05:57 UTC (History)
1 user (show)

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

bootmisc.patch (bootmisc.patch,450 bytes, patch)
2004-11-15 07:11 UTC, Paul Pacheco
Details | Diff (,429 bytes, patch)
2004-11-16 07:15 UTC, Paul Pacheco
Details | Diff (,524 bytes, patch)
2004-11-16 07:24 UTC, Paul Pacheco
Details | Diff (,524 bytes, patch)
2004-11-17 05:38 UTC, Paul Pacheco
Details | Diff (,794 bytes, patch)
2004-11-17 06:19 UTC, Paul Pacheco
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Pacheco 2004-11-15 07:10:57 UTC
When booting, env-update gets run, but there is no need to run it if nothing has changed.

Reproducible: Always
Steps to Reproduce:
1. reboot system

Actual Results:  
env-update gets run every time 

Expected Results:  
only run env-update if something changed
Comment 1 Paul Pacheco 2004-11-15 07:11:56 UTC
Created attachment 43990 [details, diff]

Avoids running env-update if nothing has changed
Comment 2 Paul Pacheco 2004-11-15 07:13:08 UTC
It depends on bug 55329 because I use the function dependencyChanged that I defined there that properly determines if there is any change.
Comment 3 SpanKY gentoo-dev 2004-11-15 07:35:11 UTC
dont write patches unless you check cvs / latest unstable

i fixed this sometime already
Comment 4 SpanKY gentoo-dev 2004-11-15 13:55:31 UTC
that may of sounded a little harsh, it wasnt meant that way ...

basically patches/fixes will only be accepted if they're against cvs/1.11.x since that is the tree under development

if you create a patch for 1.9.x or 1.10.x it'll be a waste of time because we wont be fixing those versions ;)
Comment 5 Paul Pacheco 2004-11-16 06:15:58 UTC
The patch was made against baselayout-1.11.6-r1.

Comment 6 SpanKY gentoo-dev 2004-11-16 06:27:37 UTC
it couldnt have been

1.11.6 runs `/sbin/ -u`

your patch doesnt show the '-u'
Comment 7 Paul Pacheco 2004-11-16 07:00:55 UTC
sorry about that, it seems I posted the wrong patch.

Anyway, I see what the -u does, it fixes the problem, It clearly makes my patch obsolete.


Pleeeease check bug 55329 :) , I have been pushing it but I don't get much feedback from developers.
Comment 8 Paul Pacheco 2004-11-16 07:11:51 UTC
Your approach seems to have a problem.

This loop:

        for config in /etc/env.d
                if [ "${config}" -nt "${svcdir}/envcache" ]

gets executed only once with config = /etc/env.d

You can try it with 

for config in /etc/env.d; do echo $config ; done

So the for is equivalent to just:
                if [ "/etc/env.d" -nt "${svcdir}/envcache" ]

Now, if you change one of the existing files inside /etc/env.d, say:
touch /etc/env.d/05gcc

then the date of /etc/env.d does not change and update=1 will never be executed.

We did discuss that problem in bug 55329, and that was the reason I introduced the function dependencyChanged.

To fix properly the problem, you need to check the date of the directory (in case something gets deleted) and each one of the scripts inside, which is what the dependencyChanged function does.
Comment 9 Paul Pacheco 2004-11-16 07:15:46 UTC
Created attachment 44059 [details, diff]

Do proper checking for directory change
Comment 10 Paul Pacheco 2004-11-16 07:18:13 UTC
Just in case, the patch does depend on bug 55329 where I define the function dependencyChanged
Comment 11 Paul Pacheco 2004-11-16 07:24:40 UTC
Created attachment 44060 [details, diff]

Simplified version
Comment 12 Paul Pacheco 2004-11-17 05:38:58 UTC
Created attachment 44150 [details, diff]

Oops, I had the wrong conditional before.
Comment 13 Paul Pacheco 2004-11-17 06:19:23 UTC
Created attachment 44152 [details, diff]

dependencyChanged is now recursive
Comment 14 SpanKY gentoo-dev 2004-12-02 19:56:18 UTC
added to cvs, thanks