From rma@ludd.ltu.se  Wed Sep 22 11:35:34 2004
Return-Path: <rma@ludd.ltu.se>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8D1DD16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Sep 2004 11:35:34 +0000 (GMT)
Received: from mailfe02.swip.net (mailfe02.swip.net [212.247.154.33])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4F15943D31
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Sep 2004 11:35:33 +0000 (GMT)
	(envelope-from rma@ludd.ltu.se)
Received: from [213.100.160.63] (HELO megalagrion.home)
  by mailfe02.swip.net (CommuniGate Pro SMTP 4.2.1)
  with ESMTP id 170704124 for FreeBSD-gnats-submit@freebsd.org; Wed, 22 Sep 2004 13:35:32 +0200
Received: from bumblebee.home (bumblebee.home [192.168.253.3])
	by megalagrion.home (8.12.3/8.12.3) with ESMTP id i8MBZVRQ030343
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Sep 2004 13:35:32 +0200 (CEST)
	(envelope-from rma@ludd.ltu.se)
Received: from bumblebee.home (localhost [127.0.0.1])
	by bumblebee.home (8.13.1/8.13.1) with ESMTP id i8MBZVfE047431
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Sep 2004 13:35:31 +0200 (CEST)
	(envelope-from rma@ludd.ltu.se)
Received: (from rme@localhost)
	by bumblebee.home (8.13.1/8.13.1/Submit) id i8MBZUff047430;
	Wed, 22 Sep 2004 13:35:30 +0200 (CEST)
	(envelope-from rma@ludd.ltu.se)
Message-Id: <200409221135.i8MBZUff047430@bumblebee.home>
Date: Wed, 22 Sep 2004 13:35:30 +0200 (CEST)
From: Mikael Eklund <rma@ludd.ltu.se>
Reply-To: Mikael Eklund <rma@ludd.ltu.se>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Login shell may unnecessarily print "Exit 1"
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         71994
>Category:       conf
>Synopsis:       [patch] dot.login: login shell may unnecessarily print "Exit 1"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    eadler
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 22 11:40:24 GMT 2004
>Closed-Date:    Thu Nov 01 19:31:34 UTC 2012
>Last-Modified:  Thu Nov 01 19:31:34 UTC 2012
>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@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:
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Thu Nov 1 19:27:54 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71994 
State-Changed-From-To: open->closed 
State-Changed-By: eadler 
State-Changed-When: Thu Nov 1 19:31:32 UTC 2012 
State-Changed-Why:  
it seems this was committed is 2009 without noticing this PR. Sorry for 
the massive delay there! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71994 
>Unformatted:
