conf/71994: Login shell may unnecessarily print "Exit 1"

Mikael Eklund rma at ludd.ltu.se
Wed Sep 22 04:40:25 PDT 2004


>Number:         71994
>Category:       conf
>Synopsis:       Login shell may unnecessarily print "Exit 1"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 22 11:40:24 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Mikael Eklund
>Release:        FreeBSD 5.3-BETA4 i386
>Organization:
Ludd (Luleå Academic Computer Society)
>Environment:
System: FreeBSD bumblebee 5.3-BETA4 FreeBSD 5.3-BETA4 #0: Wed Sep 15 05:35:37 CEST 2004 root at bumblebee:/usr/obj/usr/src/sys/BUMBLEBEE i386
tcsh-6.13.00

	
>Description:
Under some rare circumstances your login shell may greet you with
the single line:
Exit 1
followed by your command prompt.

To me, this looks scary and it made me wonder what went wrong.

The problem is in the file /usr/share/skel/dot.login, that uses /bin/[
rather than a csh-syntax if-clause that always returns true (0), even
if the test fails.
	
>How-To-Repeat:
Install a minimum distribution set, or at least one that does
not include /usr/games/fortune.
In your ~/.cshrc file, set the shell variable $printexitvalue.
Log in, or start a new login terminal window: "xterm -ls".

At login, the test for /usr/games/fortune will become false.  Thus
/bin/[ will return a status code of 1.  This will be reported by tcsh,
printing "Exit 1" alerting the user that something went wrong.

	
>Fix:
Apply the following patch.
	

--- patch begins here ---
--- share/skel/dot.login.old	Sat Sep 11 14:29:27 2004
+++ share/skel/dot.login	Wed Sep 15 04:49:15 2004
@@ -5,4 +5,4 @@
 # see also csh(1), environ(7).
 #
 
-[ -x /usr/games/fortune ] && /usr/games/fortune freebsd-tips
+if ( -x /usr/games/fortune ) /usr/games/fortune freebsd-tips
--- patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list