[Bug 1097473] Re: Invoking "env -i bash" unnecessarily results in confusing message
Hugo Heden
hugoheden at gmail.com
Tue Jan 8 21:33:57 UTC 2013
Hmm, I'm starting to think this is not a "bug" but rather something that
belongs to a "policy discussion" (as suggested by the Ubuntu bug
reporting tutorial)?
Anyway, the version info:
Ubuntu 12.10
$ bash --version
GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
** Description changed:
I was invoking bash as follows:
env -i bash
This caused this message to be printed:
$ env -i bash
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
While I think I understand the rationale for the message, I found it
more confusing than helpful in this situation. I thought I had done
something wrong, or that there was some error with the new shell I was
starting.
The message is, I believe, caused by the following snippet in
- /etc/bash.bashrc (not that the "env -i" part above causes $HOME to not
+ /etc/bash.bashrc (note that the "env -i" part above causes $HOME to not
be set)
# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
- case " $(groups) " in *\ admin\ *)
- if [ -x /usr/bin/sudo ]; then
- cat <<-EOF
- To run a command as administrator (user "root"), use "sudo <command>".
- See "man sudo_root" for details.
-
- EOF
- fi
- esac
+ case " $(groups) " in *\ admin\ *)
+ if [ -x /usr/bin/sudo ]; then
+ cat <<-EOF
+ To run a command as administrator (user "root"), use "sudo <command>".
+ See "man sudo_root" for details.
+
+ EOF
+ fi
+ esac
fi
It would perhaps be better if the if-statement also checked that $HOME
is set (to refer to an existing directory?) before checking if
$HOME/.sudo_as_admin_successful and $HOME/.hushlogin exist.
** Description changed:
I was invoking bash as follows:
- env -i bash
+ $ env -i bash
This caused this message to be printed:
$ env -i bash
- To run a command as administrator (user "root"), use "sudo <command>".
- See "man sudo_root" for details.
+ > To run a command as administrator (user "root"), use "sudo <command>".
+ > See "man sudo_root" for details.
While I think I understand the rationale for the message, I found it
more confusing than helpful in this situation. I thought I had done
something wrong, or that there was some error with the new shell I was
starting.
The message is, I believe, caused by the following snippet in
/etc/bash.bashrc (note that the "env -i" part above causes $HOME to not
be set)
# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
case " $(groups) " in *\ admin\ *)
if [ -x /usr/bin/sudo ]; then
cat <<-EOF
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
EOF
fi
esac
fi
It would perhaps be better if the if-statement also checked that $HOME
is set (to refer to an existing directory?) before checking if
$HOME/.sudo_as_admin_successful and $HOME/.hushlogin exist.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1097473
Title:
Invoking "env -i bash" unnecessarily results in confusing message
Status in “bash” package in Ubuntu:
New
Bug description:
I was invoking bash as follows:
$ env -i bash
This caused this message to be printed:
$ env -i bash
> To run a command as administrator (user "root"), use "sudo <command>".
> See "man sudo_root" for details.
While I think I understand the rationale for the message, I found it
more confusing than helpful in this situation. I thought I had done
something wrong, or that there was some error with the new shell I was
starting.
The message is, I believe, caused by the following snippet in
/etc/bash.bashrc (note that the "env -i" part above causes $HOME to
not be set)
# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
case " $(groups) " in *\ admin\ *)
if [ -x /usr/bin/sudo ]; then
cat <<-EOF
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
EOF
fi
esac
fi
It would perhaps be better if the if-statement also checked that $HOME
is set (to refer to an existing directory?) before checking if
$HOME/.sudo_as_admin_successful and $HOME/.hushlogin exist.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1097473/+subscriptions
More information about the foundations-bugs
mailing list