From sada@bsdclub.org  Fri Jun 23 10:40:03 2000
Return-Path: <sada@bsdclub.org>
Received: from home.bsdclub.org (home.bsdclub.org [202.227.26.94])
	by hub.freebsd.org (Postfix) with ESMTP id 12D1B37BA4C
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 23 Jun 2000 10:40:01 -0700 (PDT)
	(envelope-from sada@bsdclub.org)
Received: (from sada@localhost) by home.bsdclub.org (8.9.3/3.7W)
	id CAA97797; Sat, 24 Jun 2000 02:39:55 +0900 (JST)
Message-Id: <200006231739.CAA97797@home.bsdclub.org>
Date: Sat, 24 Jun 2000 02:39:55 +0900 (JST)
From: sada@FreeBSD.org
Sender: sada@bsdclub.org
Reply-To: sada@FreeBSD.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: /bin/sh: sometimes fails with alias
X-Send-Pr-Version: 3.2

>Number:         19475
>Category:       bin
>Synopsis:       /bin/sh sometimes says "not fould" with registered alias.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sada
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 23 10:50:01 PDT 2000
>Closed-Date:    Wed Jul 19 08:30:51 PDT 2000
>Last-Modified:  Wed Jul 19 08:32:21 PDT 2000
>Originator:     SADA Kenji
>Release:        FreeBSD 3.4-RELEASE/5.0-CURRENT i386
>Organization:
private
>Environment:

	FreeBSD 5.0-CURRENT
	FreeBSD 3.4-RELEASE

>Description:

	/bin/sh sometimes fails looking-up alias.

>How-To-Repeat:

	NOTE: This doesn't occur everytime, every alias.
	Some alias would go, others fail.

	$ alias lcvs
	alias lcvs=time nice cvs -d /ncvs -R 
	$ type lcvs
	lcvs not found
	$ lcvs
	lcvs: not found

>Fix:
	
	/bin/sh records its aliases in structures named "alias" (alias.h).
	The structure's integer member "flag" includes "ALIASINUSE" bit
	and it controls if that alias would be replaced or not.
	"ALIASINUSE" bit is expected to be set only when that alias is
	being replaced, so it stops limit-less replacing.
	But sometimes the flag is set when alias command is executed,
	and never unset until shell is aborted.
	This problem would be solved by just clearing the member "flag"
	at its creation point.

diff -u -w -B -b -r1.12 alias.c
--- alias.c	1999/08/27 23:15:07	1.12
+++ alias.c	2000/06/23 15:57:07
@@ -109,6 +109,7 @@
 	ap->val[len+1] = '\0';
 	}
 #endif
+	ap->flag = 0;
 	ap->next = *app;
 	*app = ap;
 	INTON;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->cracauer 
Responsible-Changed-By: asmodai 
Responsible-Changed-When: Sat Jun 24 01:01:35 PDT 2000 
Responsible-Changed-Why:  
Over to Mr. Shell. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19475 

From: SADA Kenji <sada@bsdclub.org>
To: cracauer@FreeBSD.org, asmodai@FreeBSD.org,
	freebsd-gnats-submit@FreeBSD.org, sada@FreeBSD.org
Cc: sada@bsdclub.org
Subject: Re: bin/19475: /bin/sh sometimes says "not found" with registered alias.
Date: Sun, 2 Jul 2000 13:53:36 +0900 (JST)

 This is clear problem and easy to verify.
 If "Mr. Shell" has no time to work with and no arguments would be present,
 I'll commit it myself.
 

From: Martin Cracauer <cracauer@cons.org>
To: SADA Kenji <sada@bsdclub.org>
Cc: cracauer@FreeBSD.ORG, asmodai@FreeBSD.ORG,
	freebsd-gnats-submit@FreeBSD.ORG, sada@FreeBSD.ORG
Subject: Re: bin/19475: /bin/sh sometimes says "not found" with registered alias.
Date: Sun, 2 Jul 2000 12:32:20 +0200

 In <200007020453.NAA89879@home.bsdclub.org>, SADA Kenji wrote: 
 > This is clear problem and easy to verify.
 > If "Mr. Shell" has no time to work with and no arguments would be present,
 > I'll commit it myself.
 
 It's clear that the provided patch fixes the problem.  I had no time
 to look if it introduces new problems, hence I didn't commit it.
 
 Feel free to commit it after you build a world with it and ran some
 big GNU configure scripts while comparing results from one shell
 without and one with the patch.
 
 Martin
 -- 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/
 BSD User Group Hamburg, Germany     http://www.bsdhh.org/
 
State-Changed-From-To: open->closed 
State-Changed-By: sada 
State-Changed-When: Sat Jul 15 07:35:33 PDT 2000 
State-Changed-Why:  
Committed. 
Martin Cracauer approved this PR with 2 conditions. 
1. Build world with the patch. 
-> Succeeded with 3, 4, and 5 branch. 
2. Check some big GNU configure's log output. 
-> Equaled with bison, emacs, and gcc. 


Responsible-Changed-From-To: cracauer->sada 
Responsible-Changed-By: sada 
Responsible-Changed-When: Sat Jul 15 07:35:33 PDT 2000 
Responsible-Changed-Why:  
Martin Cracauer has approved my checkin. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19475 
State-Changed-From-To: closed->analyzed 
State-Changed-By: sada 
State-Changed-When: Tue Jul 18 09:05:39 PDT 2000 
State-Changed-Why:  
Should be kept opening until MFC. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19475 
State-Changed-From-To: analyzed->closed 
State-Changed-By: sada 
State-Changed-When: Wed Jul 19 08:30:51 PDT 2000 
State-Changed-Why:  
Committed. 

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