Bug 1117334 - unload from loaded modulefile broken
Summary: unload from loaded modulefile broken
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: environment-modules
Version: 22
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-08 13:28 UTC by Filip Krska
Modified: 2015-07-21 08:14 UTC (History)
4 users (show)

Fixed In Version: environment-modules-3.2.10-16.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of: 1117327
Environment:
Last Closed: 2015-07-21 08:14:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
unload from modulefile fix (808 bytes, patch)
2014-08-10 07:13 UTC, Filip Krska
fkrska: review?
Details | Diff
reproducer modules (523 bytes, application/x-compressed)
2014-08-10 07:14 UTC, Filip Krska
no flags Details

Description Filip Krska 2014-07-08 13:28:49 UTC
Reproduces with environment-modules-3.2.10-6.fc20.x86_64 as well

+++ This bug was initially created as a clone of Bug #1117327 +++

Reproduces with environment-modules-3.2.10-8.el7 as well

+++ This bug was initially created as a clone of Bug #1117307 +++

Description of problem:

If you are loading module testunloadother/version_A containing command

module unload "testunloadother/version_B"

the module testunloadother/version_B is loaded instead.

On the contrary, if you are unloading module testunloadother/version_A,
the module testunloadother/version_B is unloaded instead of being ignored
(the recursion should expect it is not loaded (actually should be unloaded) by previous load of testunloadother/version_A).

Version-Release number of selected component (if applicable):

environment-modules-3.2.10-1.el6_5

How reproducible:

Always

Steps to Reproduce:
1. 
# cd /tmp/modulefiles
2.
# export MODULEPATH="${MODULEPATH}:/tmp/modulefiles"
3.
# tar -xzf testunloadother.tgz
4.
# module load testunloadother/version_B ; module list; echo $PATH
# module unload testunloadother/version_B ; module list; echo $PATH
# module load testunloadother/version_B ; module list; echo $PATH
# module load testunloadother/version_A ; module list; echo $PATH
# module unload testunloadother/version_A ; module list; echo $PATH

Actual results:

# module load testunloadother/version_B ; module list; echo $PATH
module-info flags     :: 32800
module-info name      :: testunloadother/version_B
module-info mode      :: load
module-info flags     :: 32800
module-info name      :: testunloadother/version_C
module-info mode      :: load
Currently Loaded Modulefiles:
  1) testunloadother/version_C   2) testunloadother/version_B
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/testunloadother/C/bin:/opt/testunloadother/B/bin
# module unload testunloadother/version_B ; module list; echo $PATH
module-info flags     :: 32769
module-info name      :: testunloadother/version_B
module-info mode      :: remove
module-info flags     :: 32769
module-info name      :: testunloadother/version_C
module-info mode      :: remove
No Modulefiles Currently Loaded.
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
# module load testunloadother/version_B ; module list; echo $PATH
module-info flags     :: 32800
module-info name      :: testunloadother/version_B
module-info mode      :: load
module-info flags     :: 32800
module-info name      :: testunloadother/version_C
module-info mode      :: load
Currently Loaded Modulefiles:
  1) testunloadother/version_C   2) testunloadother/version_B
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/testunloadother/C/bin:/opt/testunloadother/B/bin
# module load testunloadother/version_A ; module list; echo $PATH
module-info flags     :: 32800
module-info name      :: testunloadother/version_A
module-info mode      :: load
module-info flags     :: 32800
module-info name      :: testunloadother/version_B
module-info mode      :: load
module-info flags     :: 32800
module-info name      :: testunloadother/version_C
module-info mode      :: load
Currently Loaded Modulefiles:
  1) testunloadother/version_C   2) testunloadother/version_B   3) testunloadother/version_A
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/testunloadother/C/bin:/opt/testunloadother/B/bin:/opt/testunloadother/A/bin
# module unload testunloadother/version_A ; module list; echo $PATH
module-info flags     :: 32769
module-info name      :: testunloadother/version_A
module-info mode      :: remove
module-info flags     :: 32769
module-info name      :: testunloadother/version_B
module-info mode      :: remove
module-info flags     :: 32769
module-info name      :: testunloadother/version_C
module-info mode      :: remove
No Modulefiles Currently Loaded.
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin


Expected results:

# module load testunloadother/version_B ; module list; echo $PATH
module-info flags     :: 32800
module-info name      :: testunloadother/version_B
module-info mode      :: load
module-info flags     :: 32800
module-info name      :: testunloadother/version_C
module-info mode      :: load
Currently Loaded Modulefiles:
  1) testunloadother/version_C   2) testunloadother/version_B
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/testunloadother/C/bin:/opt/testunloadother/B/bin
# module unload testunloadother/version_B ; module list; echo $PATH
module-info flags     :: 32769
module-info name      :: testunloadother/version_B
module-info mode      :: remove
module-info flags     :: 32769
module-info name      :: testunloadother/version_C
module-info mode      :: remove
No Modulefiles Currently Loaded.
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
# module load testunloadother/version_B ; module list; echo $PATH
module-info flags     :: 32800
module-info name      :: testunloadother/version_B
module-info mode      :: load
module-info flags     :: 32800
module-info name      :: testunloadother/version_C
module-info mode      :: load
Currently Loaded Modulefiles:
  1) testunloadother/version_C   2) testunloadother/version_B
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/testunloadother/C/bin:/opt/testunloadother/B/bin
# module load testunloadother/version_A ; module list; echo $PATH
module-info flags     :: 32800
module-info name      :: testunloadother/version_A
module-info mode      :: load
module-info flags     :: 32769
module-info name      :: testunloadother/version_B
module-info mode      :: remove
module-info flags     :: 32769
module-info name      :: testunloadother/version_C
module-info mode      :: remove
Currently Loaded Modulefiles:
  1) testunloadother/version_A
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/testunloadother/A/bin
# module unload testunloadother/version_A ; module list; echo $PATH
module-info flags     :: 32769
module-info name      :: testunloadother/version_A
module-info mode      :: remove
No Modulefiles Currently Loaded.
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin


Additional info:

The regression was introduced by rebase to 3.2.10, upstream bug:
http://sourceforge.net/p/modules/bugs/56/
http://sourceforge.net/p/modules/git/ci/47de6300538d61ab5a97a9d38905f4f944e4edd6/tree/ModuleCmd_Load.c?diff=da94545fb8f75612ceea71873a3d5188fc3d5b5c

I did some test that the proposed patch doesn't break the recursion fixed by upstream bug 56, but still I'd suggest to let the patch reviewed upstream first.

--- Additional comment from Filip Krska on 2014-07-08 09:19:31 EDT ---

Comment 1 Orion Poplawski 2014-08-08 03:13:34 UTC
I'm not authorized to view the bugs this was cloned from.  Is there a patch on those?  Has it been submitted upstream?

Comment 2 Filip Krska 2014-08-10 07:13:00 UTC
Created attachment 925471 [details]
unload from modulefile fix

Comment 3 Filip Krska 2014-08-10 07:14:31 UTC
Created attachment 925472 [details]
reproducer modules

Comment 4 Filip Krska 2014-08-10 07:20:39 UTC
Hi Orion, sorry for not re-attaching the patch and reproducer, mea culpa. Attached now.

Jan, did you have chance to fwd the patch to upstream for review?

Comment 5 Jan Synacek 2014-08-18 09:15:49 UTC
The patch has not been submitted upstream. Feel free to do so.

Comment 6 Filip Krska 2014-08-27 07:54:49 UTC
Reported to modules-interest mailing list, waiting for approval...

Comment 9 Chris Goodyer 2014-11-11 16:36:27 UTC
Hi.

I ran into this same error on my system and the patch above only fixed half the issues.  As it stands the patch only fixes the case where unloads are done in the sub-command of a load.  In order to allow loads (rather than unloads) during an unload an additional if clause is needed in the 'else':

        } else {
            if (load) {
                g_flags |= M_LOAD;
                g_flags &= ~M_REMOVE;
            } else {
                g_flags |= M_REMOVE;
                g_flags &= ~M_LOAD;
            }
        }

However this seems to render the enclosing "if (!(g_flags & M_SUBCMD)) {" almost redundant as the only difference is the "g_flags |= M_SUBCMD;" line.  Clearly some simplification would be possible, assuming this all works in other cases!

Comment 10 Fedora End Of Life 2015-05-29 12:19:27 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Orion Poplawski 2015-07-13 20:37:47 UTC
Applied.

Comment 12 Fedora Update System 2015-07-13 21:23:17 UTC
environment-modules-3.2.10-16.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/environment-modules-3.2.10-16.fc22

Comment 13 Fedora Update System 2015-07-14 15:52:31 UTC
Package environment-modules-3.2.10-16.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing environment-modules-3.2.10-16.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-11622/environment-modules-3.2.10-16.fc22
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2015-07-21 08:14:30 UTC
environment-modules-3.2.10-16.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.