<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>172472</bug_id>
          
          <creation_ts>2007-03-27 21:27 0000</creation_ts>
          <short_desc>app-admin/eselect-1.0.9: load_config() wrongly returns values from the environment</short_desc>
          <delta_ts>2007-06-17 10:06:58 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Hosted Projects</product>
          <component>Eselect</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>179880</blocked>
    
    <blocked>181166</blocked>
          
          <everconfirmed>1</everconfirmed>
          <reporter>ulm@gentoo.org</reporter>
          <assigned_to>eselect@gentoo.org</assigned_to>
          <cc>george@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2007-03-27 21:27:05 0000</bug_when>
            <thetext>&quot;eselect env update&quot; behaves differently from &quot;env-update&quot;. Path elements are accumulated in profile.env and are not deleted, even if they are removed from the files in env.d. The following session illustrates the problem:

# echo INFOPATH=foo &gt;/etc/env.d/99test
# env-update; . /etc/profile
&gt;&gt;&gt; Regenerating /etc/ld.so.cache...
# echo $INFOPATH
/usr/share/info:[...]:foo
[O.K.]

# echo INFOPATH=bar &gt;/etc/env.d/99test
# env-update; . /etc/profile
&gt;&gt;&gt; Regenerating /etc/ld.so.cache...
# echo $INFOPATH
/usr/share/info:[...]:bar
[O.K.]

# rm /etc/env.d/99test
# env-update; . /etc/profile
&gt;&gt;&gt; Regenerating /etc/ld.so.cache...
# echo $INFOPATH
/usr/share/info:[...]
[O.K.]

# echo INFOPATH=foo &gt;/etc/env.d/99test
# eselect env update; . /etc/profile
Regenerating /etc/ld.so.cache...
# echo $INFOPATH
/usr/share/info:[...]:foo
[O.K.]

# echo INFOPATH=bar &gt;/etc/env.d/99test
# eselect env update; . /etc/profile
Regenerating /etc/ld.so.cache...
# echo $INFOPATH
/usr/share/info:[...]:foo:bar
[This should contain &quot;bar&quot; only.]

# rm /etc/env.d/99test
# eselect env update; . /etc/profile
Regenerating /etc/ld.so.cache...
# echo $INFOPATH
/usr/share/info:[...]:foo:bar
[Should contain neither &quot;foo&quot; nor &quot;bar&quot;.]

# env-update; . /etc/profile
&gt;&gt;&gt; Regenerating /etc/ld.so.cache...
# echo $INFOPATH
/usr/share/info:[...]
[O.K.]</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2007-03-29 08:14:41 0000</bug_when>
            <thetext>Still the same in 1.0.9.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>george@gentoo.org</who>
            <bug_when>2007-05-19 12:11:48 0000</bug_when>
            <thetext>I observe the same. 
I tried to use &quot;do_action env update &amp;&gt; /dev/null&quot; in gnat.eselect module, but that pulls in active enc settings (like active PATH, ADA_INCLUDE_PATH, etc) which essentially breaks functionality of gnat.eselect module. This can be worked around by using env-update directly inside the gnat.eselect, however this is flagged &quot;incorrect&quot; in the eselect documentation (in developer-guide.html), plus it only makes sense to use eselect&apos;s own modules where possible.

I could provide a gnat specific extra test case, but the one above is way more simple and represents the issue well enough (short version: add &quot;do_action env update &amp;&gt; /dev/null&quot; to the end of do_set and do_update functions of gnat.eselect module and try switching from e.g. x86_64-pc-linux-gnu-gnat-gcc-4.2 to x86_64-pc-linux-gnu-gnat-gcc-4.1 (gnat-gcc-4.1.2 and gnat-gcc-4.2.0 would need to be installed) and then do &quot;. /etc/profile&quot; in some shell without running env-update first and then check PATH and ADA_INCLUDE_PATH vars. They should not contain old (but that were active at the moment of running eselect gnat set or env update) values (4.1 when activating 4.2 or vice verse).

I also upped the severity one notch, as eselect is an important package and env is a central its module and this is indeed a major issue for any package trying to utilize this functionality.

George</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2007-06-06 23:57:55 0000</bug_when>
            <thetext>Looks like the problem is in lib/config.bash, function load_config(). The ${key} variable misses a local declaration; so if it is not set in the config file, then its value will happily be taken from the environment.

Attached patch should fix the problem.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2007-06-07 00:00:21 0000</bug_when>
            <thetext>Created an attachment (id=121363)
Patch for eselect-1.0.9

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2007-06-07 00:12:48 0000</bug_when>
            <thetext>Created an attachment (id=121365)
Patch for eselect-1.0.9

Quotation marks are not neccessary here.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2007-06-08 06:56:52 0000</bug_when>
            <thetext>george: Can you confirm if the patch fixes the problem for you?
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>george@gentoo.org</who>
            <bug_when>2007-06-14 12:09:54 0000</bug_when>
            <thetext>Sorry for the delay, got carried out by other stuff.
Yes, this fixes it. Thanks! Now we only need this fix to be picked up :).

George</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2007-06-16 20:49:49 0000</bug_when>
            <thetext>Changed summary since the problem is not in env.eselect, but in config.bash.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>kugelfang@gentoo.org</who>
            <bug_when>2007-06-17 10:06:58 0000</bug_when>
            <thetext>Fixed as of 1.0.10</thetext>
          </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>121363</attachid>
            <date>2007-06-07 00:00 0000</date>
            <desc>Patch for eselect-1.0.9</desc>
            <filename>eselect.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIGxpYnMvY29uZmlnLmJhc2guaW5+CTIwMDctMDMtMjggMTY6MzU6MDkuMDAwMDAwMDAwICsw
MjAwCisrKyBsaWJzL2NvbmZpZy5iYXNoLmluCTIwMDctMDYtMDcgMDE6NDk6NTcuMDAwMDAwMDAw
ICswMjAwCkBAIC05Miw2ICs5Miw3IEBACiAKICAgICBjb25maWdmaWxlPSR7MX0KICAgICBrZXk9
JHsyfQorICAgIGxvY2FsICIke2tleX0iCiAgICAgW1sgISAtZSAke2NvbmZpZ2ZpbGV9IF1dIFwK
ICAgICAgICAgJiYgcmV0dXJuIDEKICAgICB2YWx1ZT0kKAo=
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>121365</attachid>
            <date>2007-06-07 00:12 0000</date>
            <desc>Patch for eselect-1.0.9</desc>
            <filename>eselect.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIGxpYnMvY29uZmlnLmJhc2guaW5+CTIwMDctMDMtMjggMTY6MzU6MDkuMDAwMDAwMDAwICsw
MjAwCisrKyBsaWJzL2NvbmZpZy5iYXNoLmluCTIwMDctMDYtMDcgMDE6NDk6NTcuMDAwMDAwMDAw
ICswMjAwCkBAIC05Miw2ICs5Miw3IEBACiAKICAgICBjb25maWdmaWxlPSR7MX0KICAgICBrZXk9
JHsyfQorICAgIGxvY2FsICR7a2V5fQogICAgIFtbICEgLWUgJHtjb25maWdmaWxlfSBdXSBcCiAg
ICAgICAgICYmIHJldHVybiAxCiAgICAgdmFsdWU9JCgK
</data>        

          </attachment>
    </bug>

</bugzilla>