[26489] in Source-Commits
/svn/athena r25590 - in trunk/debathena/debathena/dotfiles: . debian
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Fri Jun 29 14:45:35 2012
Date: Fri, 29 Jun 2012 14:45:34 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201206291845.q5TIjYV6020742@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2012-06-29 14:45:34 -0400 (Fri, 29 Jun 2012)
New Revision: 25590
Modified:
trunk/debathena/debathena/dotfiles/bashrc
trunk/debathena/debathena/dotfiles/cshrc
trunk/debathena/debathena/dotfiles/debian/changelog
Log:
In dotfiles:
* Prevent users from shooting themselves in the foot with PATH or
LD_ASSUME_KERNEL
Modified: trunk/debathena/debathena/dotfiles/bashrc
===================================================================
--- trunk/debathena/debathena/dotfiles/bashrc 2012-06-29 16:50:48 UTC (rev 25589)
+++ trunk/debathena/debathena/dotfiles/bashrc 2012-06-29 18:45:34 UTC (rev 25590)
@@ -146,3 +146,33 @@
. ~/.bashrc.mine
fi
fi
+if [ "${skip_sanity_checks+set}" != set ]; then
+ IFS=:
+ bin=no
+ usrbin=no
+ for p in $PATH; do
+ case $p in
+ /bin)
+ bin=yes
+ ;;
+ /usr/bin)
+ usrbin=yes
+ ;;
+ esac
+ done
+ unset IFS
+ if [ "$bin" != "yes" ] || [ "$usrbin" != "yes" ]; then
+ text="You appear to have incorrectly modified your PATH variable in your dotfiles,\nand as such have deleted /bin and/or /usr/bin from your PATH, which\nwill likely cause this login session to fail. Please correct this problem."
+ echo -e "$text" >&2
+ [ -n "$DISPLAY" ] && /usr/bin/zenity --warning --text="$text"
+ fi
+ if [ -n "$LD_ASSUME_KERNEL" ]; then
+ unset LD_ASSUME_KERNEL
+ echo "In your shell customizations, you set LD_ASSUME_KERNEL. This is a bad idea." >&2
+ echo "We have unset it for you." >&2
+ echo "If you really did want that, set skip_sanity_checks=y in your .bashrc.mine." >&2
+ [ -n "$DISPLAY" ] && /usr/bin/zenity --warning --text="You tried to set LD_ASSUME_KERNEL in your shell customizations. Don't do that.\nWe have unset it for you.\nSet skip_sanity_checks=y in your ~/.bashrc.mine if you really want that."
+ fi
+fi
+
+
Modified: trunk/debathena/debathena/dotfiles/cshrc
===================================================================
--- trunk/debathena/debathena/dotfiles/cshrc 2012-06-29 16:50:48 UTC (rev 25589)
+++ trunk/debathena/debathena/dotfiles/cshrc 2012-06-29 18:45:34 UTC (rev 25590)
@@ -182,3 +182,30 @@
source ~/.cshrc.mine
endif
endif
+
+if (! $?skip_sanity_checks) then
+ echo $path | /usr/bin/tr ':' '\n' | grep -Fqx /bin
+ missing=0
+ if ( $? != 0 ) then
+ missing=1
+ endif
+ echo $path | /usr/bin/tr ':' '\n' | grep -Fqx /usr/bin
+ if ( $? != 0 ) then
+ missing=1
+ endif
+ if ( $missing == 1 ) then
+ text="You appear to have incorrectly modified your PATH variable in your dotiles,\nand as such have deleted /bin and/or /usr/bin from your PATH, which\nwill likely cause this login session to fail. Please correct this problem."
+ echo "$text" > /dev/stderr
+ if ( $?DISPLAY) then
+ /usr/bin/zenity --warning --text="$text"
+ endif
+ endif
+ if ( $?LD_ASSUME_KERNEL ) then
+ unsetenv LD_ASSUME_KERNEL
+ echo "Setting LD_ASSUME_KERNEL in your dotfiles is a bad idea." > /dev/stderr
+ echo "We have unset it for you. Set skip_sanity_checks=y if you really wanted it." > /dev/stderr
+ if ( $?DISPLAY) then
+ /usr/bin/zenity --warning --text="You set LD_ASSUME_KERNEL in your dotfiles which is a bad idea.\nWe have unset it for you.\nSet skip_sanity_checks=y if you really wanted it."
+ endif
+ endif
+endif
Modified: trunk/debathena/debathena/dotfiles/debian/changelog
===================================================================
--- trunk/debathena/debathena/dotfiles/debian/changelog 2012-06-29 16:50:48 UTC (rev 25589)
+++ trunk/debathena/debathena/dotfiles/debian/changelog 2012-06-29 18:45:34 UTC (rev 25590)
@@ -1,3 +1,10 @@
+debathena-dotfiles (10.0.30-0debathena2) unstable; urgency=low
+
+ * Prevent users from shooting themselves in the foot with PATH or
+ LD_ASSUME_KERNEL
+
+ -- Jonathan Reed <jdreed@mit.edu> Fri, 29 Jun 2012 14:45:43 -0400
+
debathena-dotfiles (10.0.30-0debathena1) unstable; urgency=low
* Update logout alias for GNOME 3.0 (Trac: #1027)