From owner-freebsd-current@FreeBSD.ORG Fri Mar 26 08:19:51 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 86E7E16A4CE for ; Fri, 26 Mar 2004 08:19:51 -0800 (PST) Received: from bspu.secna.ru (bspu.secna.ru [212.192.2.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6B84543D2F for ; Fri, 26 Mar 2004 08:19:43 -0800 (PST) (envelope-from swp@uni-altai.ru) Received: from uni-altai.ru (swp.bspu.secna.ru [212.192.2.73]) (authenticated login=swp bits=0) by bspu.secna.ru (8.12.11/8.12.11) with ESMTP id i2QGJXWx078862 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 26 Mar 2004 22:19:34 +0600 (NOVT) (envelope-from swp@uni-altai.ru) Message-ID: <40645814.7040306@uni-altai.ru> Date: Fri, 26 Mar 2004 22:19:32 +0600 From: "a.s. mitrohin" Organization: BSPU User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7a) Gecko/20040307 X-Accept-Language: ru, en-us, en MIME-Version: 1.0 To: freebsd-current@freebsd.org References: <405EFC28.1020905@uni-altai.ru> <20040325035420.GA39519@darkbeer.org> <40628F46.3060900@mail.ru> In-Reply-To: <40628F46.3060900@mail.ru> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Sat, 27 Mar 2004 05:02:24 -0800 cc: Denis Antrushin Subject: Re: sh bug X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: swp@uni-altai.ru List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Mar 2004 16:19:51 -0000 Denis Antrushin wrote: >>> builtin cd unable change work directory buf curdir grow anyway. >> I found this bug as well years back and ended up mentioning it to Jeff >> Roberson, >> I'm not sure how far he got on figuring out what it was. He did have >> some >> idea's though. It happens in more than just 'sh', sevral shell's have >> this >> issue so i'm not sure that it's a problem with sh. > In /usr/src/bin/sh/cd.c (cdlogical(), at line 206): > > INTOFF; > if (updatepwd(badstat ? NULL : dest) < 0 || chdir(curdir) < 0) { > INTON; > return (-1); > } > INTON; > return(0); > > Here, updatepwd() updates curdir and prevdir variables and *after* that > sh tries to actually change current directory. And when chdir() fails, > we don't revert curdir/prevdir changes. :-) my "quick fix" here... http://bspu.secna.ru/~swp/freebsd/patches/sh/patch-cd.c ? /swp