SV: SV: compatibility issue in environment-modules version 4.1.1-1

Gösta Ljungdahl gosta.ljungdahl at foi.se
Tue May 7 10:55:58 UTC 2019


I did what you asked, logged out and logged back in. No change. Still I get

module: command not found

when I fire up a terminal session. There is an interesting observation, though.


These are the details:


1 I removed the symlink I had in /etc/profile.d/ pointing to the initialisation
script in the modules software compiled from Sourceforge tarball which I
put under /opt


2 I installed the distro package:

sudo apt install environment-modules


3 I commented out the line


BASH_VERSION= . "$CONFIG_FILE" 2>"$ERR"


and put in


. "$CONFIG_FILE" 2>"$ERR"


in /usr/sbin/lightdm-session just below the line I commented out.


4 Logged out and logged back in. Incidentally this required a restart of
X using Ctrl+Alt+Backspace. On logging back in I got an error window saying:


Error found when loading /home/gostal/.profile

...module: command not found

...


This is because I now have put the line:


module load use.own


in ~/.profile to make my own modules available. This is only half the
reason. I had also forgot to rename the package initialisation script
under /etc/profile.d/ which I had saved as modules.sh.ubuntu before
editing it to see if it was run some time ago. For some reason renaming
is not enough as reinstalling the package then does not put modules.sh under
/etc/profile.d/. Perhaps it only goes by a contents hash, what do I know?


5 Renamed the saved


/etc/profile.d/modules.sh.ubuntu


to


/etc/profile.d/modules.sh

Logged out and logged back in. This time I didn't have to restart X. Now
to the interesting observation. This time I did not get the error window
that I got under step 4. I other words the set shell commands are
available when ~/.profile is sourced. They are not, however, when I
fire up a command window. If the sourcing of ~/.profile is a part of
the same process running the initialisation file this is the expected
outcome. But the export of the commands has failed.


/Gösta




________________________________
Från: Gunnar Hjalmarsson <gunnarhj at ubuntu.com>
Skickat: den 6 maj 2019 11:58:56
Till: Gösta Ljungdahl; Ubuntu Developers
Ämne: Re: SV: compatibility issue in environment-modules version 4.1.1-1

On 2019-05-06 09:36, Gösta Ljungdahl wrote:
> On 2019-05-05 22:35, Gunnar Hjalmarsson wrote:
>> From a quick look at the code in environment-modules I see that it
>> seems to test for the BASH_VERSION variable. That makes me think of
>> this change of LightDM:
>>
>> https://bazaar.launchpad.net/~lightdm-team/lightdm/trunk/revision/2168/debian/lightdm-session
>>
>> which was made in response to:
>>
>> https://launchpad.net/bugs/1482641
Bug #1482641 “Lightdm (and GDM) source .profile as bash, indirec...” : Bugs : gdm package : Ubuntu<https://launchpad.net/bugs/1482641>
launchpad.net
The fix for https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/678421 leads to `.profile` being sourced by bash instead of dash. This leads `.bashrc` being sourced indirectly via .profile. IMHO, `.bashrc` should not be sourced even *once* in this situation. I suggest that sourcing .profile actually be done with BASH_VERSION unset:     BASH_VERSION= . "$CONFIG" At the very least, a check should be done whether bash is the user's login shell. It can be done thus:     [ "$SHELL" != "/bin/bas...


>>
>> Can this possibly be a reason for the confusion you have observed?
> > All I really know is that at some point in the initialization process
> dash comes into play and is not equal to the task. I know this
> because the initialization works as expected if I change /bin/sh to
> point to /bin/bash.

Right. But it could be useful to know what happens if you

1. Change the /bin/sh symlink back to point to dash, and

2. (assuming that MINT uses LightDM) edit /usr/sbin/lightdm-session and
    change the line

     BASH_VERSION= . "$CONFIG_FILE" 2>"$ERR"

    to

     . "$CONFIG_FILE" 2>"$ERR"

--
Gunnar Hjalmarsson
https://launchpad.net/~gunnarhj
Gunnar Hjalmarsson in Launchpad<https://launchpad.net/~gunnarhj>
launchpad.net
Ubuntu wiki page: https://wiki.ubuntu.com/GunnarHj


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20190507/ee026cdd/attachment.html>


More information about the Ubuntu-devel-discuss mailing list