← Back to team overview

desktop-packages team mailing list archive

[Bug 678421] Re: Error message for a faulty ~/.profile script

 

Hi Barry!

On 2014-11-14 17:56, Barry Warsaw wrote:
> So, when I log in, I do get several warnings in a dialog.  Most are 
> because I use `source` instead of `.` to source other shell files.
> What shell is lightdm using these days?

It has always been using Bourne shell, so "source" is not understood.
You have obliviously been running your system without the configuration
in those other shell files.

> Anyway, when I change them all to `.` I still get one warning about
> my use of shopt,

Another bash command, not understood by dash.

> However, logins are now completely broken. I see the screen blank and
> then I'm thrown back to the login screen.  ~/.xsession-errors is
> empty and I can find no other log file either in $HOME or /var/log
> that contains any information about what's going wrong.

This is the code in /usr/sbin/lightdm-session which triggers those
warning dialogs:

<code>
# temporary storage of error messages
ERR=$(mktemp --tmpdir config-err-XXXXXX)

source_with_error_check () {
    CONFIG_FILE="$1"
    if sh -n "$CONFIG_FILE" 2>"$ERR"; then
        echo "Loading $CONFIG_FILE";
        . "$CONFIG_FILE" 2>"$ERR"
        if [ -s "$ERR" ]; then
            SYNTAX=false
            . /usr/lib/lightdm/config-error-dialog.sh
        fi
    else
        SYNTAX=true
        . /usr/lib/lightdm/config-error-dialog.sh
    fi
    cat "$ERR" >>/dev/stderr
    truncate -s 0 "$ERR"
}

# Load profile
for file in "/etc/profile" "$HOME/.profile" \
            "/etc/xprofile" "$HOME/.xprofile"; do
    if [ -f "$file" ]; then
        source_with_error_check "$file"
    fi
done
</code>

I find it hard to believe that that code itself is causing the problem
you describe. Considering that you could log in just fine before you
changed the occurrences of "source" to ".", I would look for the cause
in the code which unlike before is now sourced by lightdm.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to gdm in Ubuntu.
https://bugs.launchpad.net/bugs/678421

Title:
  Error message for a faulty ~/.profile script

Status in GDM: The Gnome Display Manager:
  New
Status in “gdm” package in Ubuntu:
  In Progress
Status in “lightdm” package in Ubuntu:
  Fix Released
Status in “gdm” source package in Trusty:
  Triaged
Status in “lightdm” source package in Trusty:
  In Progress
Status in “gdm” source package in Utopic:
  Triaged
Status in “lightdm” source package in Utopic:
  Fix Committed

Bug description:
  trusty and utopic SRU requests
  ==============================

  [Impact]

  In case of a syntax error in either of ~/.profile or a few other
  similar files, the Xorg login is interrupted, and the user is taken
  back to the login screen without an explanation. Debugging this
  problem may be a time consuming exercise, especially for non-
  experienced users.

  With the proposed change, lightdm/gdm does not try to load such a
  file, but shows a warning dialog instead. (A warning dialog is also
  shown in case of some other type of error, which would not have caused
  the login to fail.)

  [Test Case]

  To reproduce:

  * Edit ~/.profile and add something bad, e.g. a non-closed parenthesis.
  * Log out and find that you can't log in to a graphical session.

  After installing the proposed lightdm/gdm version, you'll instead see
  the dialog and can log in.

  [Regression Potential]

  Since this is only about improved exception handling, it does not at
  all affect users with correct configuration files. The regression risk
  ought to be minimal.

  [Original description]

  Binary package hint: gdm

  After adding "function AddPath { PATH="$1:$PATH" }" to $HOME/.profile
  made the Xorg startup fail. (At that moment I had already forgotten
  the changes made to the .profile). As I had autologin that meant it
  kept trying to login and finally showed me the graphics
  reconfiguration screen. That sent me to a huge hunt for xorg conf and
  setup problems.

  Anyway finally tracked this down. I had used bash syntax in .profile
  file whereas it was run with sh.

  This is not a bug per se but I think a user mistake in ".profile"
  shouldn't bring the whole xorg startup to a halt as it does with
  autologin. I propose running user ".profile" and ".xprofile" scripts
  so that Xsession script continues running even if they have errors.
  I'm not sure whether this change would have some negative effects as
  well.

  1) Ubuntu Lucid, Linux egon-laptop 2.6.32-25-generic #45-Ubuntu SMP Sat Oct 16 19:48:22 UTC 2010 i686 GNU/Linux
  2) gdm 2.30.2.is.2.30.0-0ubuntu4

To manage notifications about this bug go to:
https://bugs.launchpad.net/gdm/+bug/678421/+subscriptions


Follow ups