From: Andreas Schwab <schwab@linux-m68k.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, evgeny <illumsoft.org@gmail.com>,
git@vger.kernel.org
Subject: Re: t0005-signals.sh fails with ksh
Date: Sat, 09 May 2015 10:20:18 +0200 [thread overview]
Message-ID: <m2h9rmupq5.fsf@linux-m68k.org> (raw)
In-Reply-To: <xmqqk2wiiwa3.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Fri, 08 May 2015 14:39:32 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> That is fun. And doing
>
> $ mkdir -p git/objects
>
> just before you create and chdir into subdir does tell me that the
> last "cd ../.git/objects" is turned into "cd ../git/objects".
This has been fixed in ksh93v. Looking at the diff between openSUSE
13.1 and 13.2 version of ksh, this hunk from
src/cmd/ksh93/bltins/cd_pwd.c is responsible:
@@ -109,34 +155,22 @@
if(!oldpwd)
oldpwd = path_pwd(shp,1);
}
- if(*dir=='.')
+ if(dirfd==shp->pwdfd && *dir!='/')
{
- /* test for pathname . ./ .. or ../ */
- int n=0;
- char *sp;
- for(dp=dir; *dp=='.'; dp++)
- {
- if(*++dp=='.' && (*++dp=='/' || *dp==0))
- n++;
- else if(*dp && *dp!='/')
- break;
- if(*dp==0)
- break;
- }
- if(n)
- {
- cdpath = 0;
- sp = oldpwd + strlen(oldpwd);
- while(n--)
- {
- while(--sp > oldpwd && *sp!='/');
- if(sp==oldpwd)
- break;
-
- }
- sfwrite(shp->strbuf,oldpwd,sp+1-oldpwd);
- sfputr(shp->strbuf,dp,0);
- dir = sfstruse(shp->strbuf);
+ /* check for leading .. */
+
+ char *cp;
+
+ j = sfprintf(shp->strbuf,"%s",dir);
+ cp = sfstruse(shp->strbuf);
+ pathcanon(cp, j + 1, 0);
+ if(cp[0]=='.' && cp[1]=='.' && (cp[2]=='/' || cp[2]==0))
+ {
+ if(!shp->strbuf2)
+ shp->strbuf2 = sfstropen();
+ j = sfprintf(shp->strbuf2,"%s/%s",oldpwd,cp);
+ dir = sfstruse(shp->strbuf2);
+ pathcanon(dir, j + 1, 0);
}
}
rval = -1;
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2015-05-09 8:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 20:15 t0005-signals.sh fails with ksh evgeny
2015-05-08 20:34 ` Junio C Hamano
2015-05-08 20:55 ` Jeff King
2015-05-08 21:14 ` Jeff King
2015-05-08 21:39 ` Junio C Hamano
2015-05-08 23:43 ` evgeny
2015-05-09 8:20 ` Andreas Schwab [this message]
2015-05-08 21:16 ` Junio C Hamano
2015-05-08 21:21 ` Jeff King
2015-05-09 20:01 ` brian m. carlson
2015-05-08 23:05 ` evgeny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2h9rmupq5.fsf@linux-m68k.org \
--to=schwab@linux-m68k.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=illumsoft.org@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.