Lightdm (and GDM) source .profile as bash, indirectly sourcing .bashrc

Bug #1482641 reported by Murukesh Mohanan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdm (Ubuntu)
Fix Released
Medium
Gunnar Hjalmarsson
lightdm (Ubuntu)
Fix Released
Medium
Gunnar Hjalmarsson

Bug Description

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/bash" ] && BASH_VERSION=
    . "$CONFIG"

utilizing `$SHELL` given it stores the login shell (http://unix.stackexchange.com/questions/45458/why-shell-doesnt-change-when-i-run-new-shell).

description: updated
description: updated
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Thanks for your report, Muru.

Even if the default ~/.bashrc is protected from being run through a test at the top of the file, I think this will take care of a few cases where users with custom configuration have been somewhat confused.

Changed in lightdm (Ubuntu):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
importance: Undecided → Medium
status: New → In Progress
Changed in gdm (Ubuntu):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
importance: Undecided → Medium
status: New → Triaged
status: Triaged → In Progress
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Subscribed ubuntu-sponsors, since the GDM MP doesn't show up in the queue for some reason.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gdm - 3.16.2-0ubuntu2

---------------
gdm (3.16.2-0ubuntu2) wily; urgency=medium

  * debian/patches/ubuntu_config_error_dialog.patch:
    Prevent that ~/.bashrc is sourced when ~/.profile is sourced
    (LP: #1482641).

 -- Gunnar Hjalmarsson <email address hidden> Fri, 07 Aug 2015 17:23:00 +0200

Changed in gdm (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Murukesh Mohanan (murukesh) wrote :

Presumably this isn't important enough to make an SRU, right, Gunnar?

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Given that first command in the default .bashrc, I don't think an SRU is motivated either.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lightdm - 1.15.2-0ubuntu2

---------------
lightdm (1.15.2-0ubuntu2) wily; urgency=medium

  * debian/control:
    - Add build-depends on valac

 -- Robert Ancell <email address hidden> Mon, 10 Aug 2015 16:38:04 +1200

Changed in lightdm (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.