[Bug 678421] Re: Error in ~/.profile halts the X startup
For the sed/eval round we can always escape the special characters beforehand, there should be some function for that. But I agree with your conclusion. Warning or message is a good enough solution, even though I would like to see some hand-holding. I agree it just isn't worth the effort and the only nice way (I can think) of doing this is to extend dash with such functionality. ** Summary changed: - Error in ~/.profile halts the X startup + Error message for a faulty ~/.profile script -- You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to gdm in Ubuntu. https://bugs.launchpad.net/bugs/678421 Title: Error message for a faulty ~/.profile script To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/678421/+subscriptions -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs
[Bug 678421] Re: Error in ~/.profile halts the X startup
The idea is simple: ### VARS=$( # this allows to capture subshell stdout to a variable . $HOME/script.sh 1/dev/null # this prevents script printing something to stdout set # this prints all variables to stdout alias | sed 's/.*/alias \0/' # this prints aliases to stdout and prefixes them with alias ) || ERRCODE=$? if [ $ERRCODE==0 ] then eval $VARS # if everything is ok, we reevaluate the variables and aliases in this shell fi ### Now the VARS=$(command) || ERRCODE=$?, || prevents the command from exiting the script if the next command exits with code 0. We could also use VARS=$(command) || true, but then $? would contain the result of command true, since ERRCODE=$? also exits with code 0 we can prevent the shell from exiting and remember the correct error code. -- You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to gdm in Ubuntu. https://bugs.launchpad.net/bugs/678421 Title: Error in ~/.profile halts the X startup To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/678421/+subscriptions -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs
[Bug 678421] Re: Error in ~/.profile halts the X startup
Right forgot about the variables. After poking around in dash source I found that $HOME/.profile has been hardcoded. So the change needs be made in the shell to make .profile safe. Also I found a way to keep the variables from subshell ### test.sh ### ERRCODE=0 TEST= VARS=$(set -e; . $HOME/script.sh 1/dev/null; set) || ERRCODE=$? if [ $ERRCODE==0 ] then eval $VARS fi echo ERRCODE = $ERRCODE echoTEST = $TEST ### script.sh ### TEST=something function AddPath { echo err } ## This also has one nice thing that when the script fails the environment stays unchanged. Also there may be some variables that shouldn't be taken from the subshell, but I have no idea which. -- You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to gdm in Ubuntu. https://bugs.launchpad.net/bugs/678421 Title: Error in ~/.profile halts the X startup To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/678421/+subscriptions -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs
[Bug 678421] Re: Error in ~/.profile halts the X startup
Sorry, I forgot about this due to other duties (work and school). This is not an active issue for me, but would be a nice touch to Ubuntu. This still happens in Oneiric (tested in daily). There are some differences, it just drops you into the default login screen without any explanation. Which is quite bad because then you will be puzzled what just happened/went wrong. Also I did some research how to keep the main script running when sub-script has some syntax errors: # set -e ERRCODE=0 (. $HOME/.profile) || ERRCODE=$? echo $ERRCODE # ERRCODE will be 0 if everything was ok 127 if there was a syntax error 0: there was some other problem with the script That way we can get the correct error code without terminating the main script and do graceful handling of the error. -- You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to gdm in Ubuntu. https://bugs.launchpad.net/bugs/678421 Title: Error in ~/.profile halts the X startup To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/678421/+subscriptions -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs
[Bug 678421] Re: Error in ~/.profile halts the X startup
Sure, silently just ignoring is just as bad. I just think that, it's a mistake that shouldn't prevent you to login and start up everything. The ~/.profile script can also easily be changed by non-experienced users (ones who may not know terminal that well). If that user doesn't get the session running then he'll be forced to use terminal. The ideal case I think would be: everything starts up and an relevant error message is displayed. I'm ok with scripts in /etc/.. preventing xsession to start as that requires sudo permissions (as sudo implies that caution must be taken). Essentially my POV is that if modifying a script doesn't require sudo permissions it should be relatively safe, meaning you should be still able to fix it from GUI interface. Of course practically it's impossible to do so, but it's a target to move towards. -- You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to gdm in Ubuntu. https://bugs.launchpad.net/bugs/678421 Title: Error in ~/.profile halts the X startup -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs
[Bug 678421] [NEW] Error in ~/.profile halts the X startup
Public bug reported: 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 ** Affects: gdm (Ubuntu) Importance: Undecided Status: New -- Error in ~/.profile halts the X startup https://bugs.launchpad.net/bugs/678421 You received this bug notification because you are a member of Ubuntu Desktop Bugs, which is subscribed to gdm in ubuntu. -- desktop-bugs mailing list desktop-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/desktop-bugs