[25579] in Source-Commits
/svn/athena r25097 - in trunk/debathena/debathena/dotfiles: . debian
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Thu Apr 21 16:01:01 2011
Date: Thu, 21 Apr 2011 16:00:55 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201104212000.p3LK0tGq019926@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2011-04-21 16:00:55 -0400 (Thu, 21 Apr 2011)
New Revision: 25097
Modified:
trunk/debathena/debathena/dotfiles/bashrc
trunk/debathena/debathena/dotfiles/cshrc
trunk/debathena/debathena/dotfiles/debian/changelog
Log:
In dotfiles:
* Suppress stdout/stderr for sftp sessions (Trac #512)
Modified: trunk/debathena/debathena/dotfiles/bashrc
===================================================================
--- trunk/debathena/debathena/dotfiles/bashrc 2011-04-20 22:03:06 UTC (rev 25096)
+++ trunk/debathena/debathena/dotfiles/bashrc 2011-04-21 20:00:55 UTC (rev 25097)
@@ -6,10 +6,19 @@
initdir=/usr/lib/init
+# Determine if we're in an sftp or scp session and if so, be quiet
+SILENT=no
+case "$BASH_EXECUTION_STRING" in
+ /usr/lib/openssh/sftp-server)
+ SILENT=yes
+ ;;
+ scp*)
+ SILENT=yes
+ ;;
+esac
+
# ******************* ENVIRONMENT SETUP *******************
-
-
# Set up standard system/user environment configuration (including setup of
# environment variables, attachment of lockers, and setting of search path)
@@ -83,10 +92,19 @@
# listed above.
# ~/.bash_environment is not sourced if NOCALLS is set (i.e.,
# if you selected the xlogin "Ignore your customizations"
- # option when you logged in).
+ # option when you logged in).q
if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then
- . ~/.bash_environment
+ if [ "$SILENT" = "yes" ]; then
+ exec 6>&1 # Save STDOUT
+ exec 7>&2 # Save STDERR
+ exec > /dev/null 2>&1
+ fi
+ . ~/.bash_environment
+ if [ "$SILENT" = "yes" ]; then
+ exec 1>&6 6>&- # Restore STDOUT
+ exec 2>&7 7>&- # Restore STDERR
+ fi
fi
# If the user has a bindir in $HOME, put it in front of the path.
@@ -132,5 +150,14 @@
# option was selected to begin the session.
if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then
- . ~/.bashrc.mine
+ if [ "$SILENT" = "yes" ]; then
+ exec 6>&1 # Save STDOUT
+ exec 7>&2 # Save STDERR
+ exec > /dev/null 2>&1
+ fi
+ . ~/.bashrc.mine
+ if [ "$SILENT" = "yes" ]; then
+ exec 1>&6 6>&- # Restore STDOUT
+ exec 2>&7 7>&- # Restore STDERR
+ fi
fi
Modified: trunk/debathena/debathena/dotfiles/cshrc
===================================================================
--- trunk/debathena/debathena/dotfiles/cshrc 2011-04-20 22:03:06 UTC (rev 25096)
+++ trunk/debathena/debathena/dotfiles/cshrc 2011-04-21 20:00:55 UTC (rev 25097)
@@ -7,6 +7,19 @@
set initdir=/usr/lib/init
+# Determine if we're in an sftp or scp session, and if so, be quiet
+set SILENT=no
+if ($?command) then
+ switch (`echo $command | cut -d\ -f 1`)
+ case /usr/lib/openssh/sftp-server:
+ set SILENT=yes
+ breaksw
+ case scp:
+ set SILENT=yes
+ breaksw
+ endsw
+endif
+
# ******************* ENVIRONMENT SETUP *******************
# Compatibility with older versions of Athena tcsh
@@ -100,7 +113,13 @@
# if NOCALLS is set (i.e., if you selected the xlogin "Ignore your
# customizations" option when you logged in).
- if ((! $?NOCALLS) && (-r ~/.environment)) source ~/.environment
+ if ((! $?NOCALLS) && (-r ~/.environment)) then
+ if ( $SILENT == "yes" ) then
+ source ~/.environment
+ else
+ source ~/.environment >&/dev/null
+ endif
+ endif
# NOTE:
# .path files are no longer supported, consult Athena documentation
@@ -152,4 +171,10 @@
# here. ~/.cshrc.mine is not sourced if the xlogin "Ignore your
# customizations" option was selected to begin the session.
-if ((! $?NOCALLS) && (-r ~/.cshrc.mine)) source ~/.cshrc.mine
+if ((! $?NOCALLS) && (-r ~/.cshrc.mine)) then
+ if ( $SILENT == "yes" ) then
+ source ~/.cshrc.mine
+ else
+ source ~/.cshrc.mine >&/dev/null
+ endif
+endif
Modified: trunk/debathena/debathena/dotfiles/debian/changelog
===================================================================
--- trunk/debathena/debathena/dotfiles/debian/changelog 2011-04-20 22:03:06 UTC (rev 25096)
+++ trunk/debathena/debathena/dotfiles/debian/changelog 2011-04-21 20:00:55 UTC (rev 25097)
@@ -1,3 +1,9 @@
+debathena-dotfiles (10.0.27-0debathena1) unstable; urgency=low
+
+ * Suppress stdout/stderr for sftp sessions (Trac #512)
+
+ -- Jonathan Reed <jdreed@mit.edu> Thu, 21 Apr 2011 15:59:26 -0400
+
debathena-dotfiles (10.0.26-0debathena1) unstable; urgency=low
* Stop setting LPROPT (Trac #794)