From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4458 invoked from network); 6 Apr 2023 06:23:02 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Apr 2023 06:23:02 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1680762182; b=TyAd4d9KYeZBSUWqNEaBMRY5DnQB3UJIzRAYFWIO7lq6F4y5zzlOGAWHxPKedwoaSgFvodb2i3 5hR4L6NepSl1L/0l2vDnxaJgwKKkFZFnYXIAuHHz6md9EWZHK0j/vC4oI6YmZu12xBdUt/+aen js9gMDPvSwzK7nQ4nBsMuSovb/1hFEoSah7nfX4jdoj1IqMwhuY+wuV4xdfRUMipv3b29ygNkb p6Y3OQ1V1s1h73EHnoz++quNFV7yQRki4bHqQw6yg7DXPG/tBnufHto5f9ZhzQm11u78ul9/bG XNdJxsvWXz9U+qPzYS9qle/b5+nM2VRX69FAqiGZzUa1VA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd00012-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.12; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1680762182; bh=iuiV1lkSUFiZCg18BFiR7SNznUsEKaNcGUeiM4wb0fE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:To:Date:Message-ID:Subject:MIME-Version: Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=DocNbEQiC1BjYHO872omX7ndLB84qLLYhMQ3W/tqRZQC7099y//PsENA2BfWbF+qZx9AnnwqrO WjBAmaVDQ3KxHdKcVkA1d/vmt/Ee/RBKs5YZPYiDYxLdAuqJcZFV51tGt0Kip2o7tLxKpadDYb 1hnzCRs980DTS5WOteF4ZRgJ25ii3fJ3QyZaGu8MNW4OXNjXaWWX4YqjRVykoL18G7cq1/VUsy SJVP8Ar+SGd2M2GrqJiOGdcY2nrfDxNQkEoGtM+FEdzsQms40xWQd2w/vnguuSbaJmmFb6elmi xkP1KhHCWP/MfnPCCq7bBsGTT9PNSpMEdRC7883kgH0G4A==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:To:Date:Message-Id:Subject: Mime-Version:Content-Transfer-Encoding:Content-Type:From:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=aKTtEVQDAif9IqbAt8V2q+wuDIvcTA2p7/skLq9yhLo=; b=srwx/f7tBFYu3bHwDVhWDyzj4S XZ6Bykpu4vXW6OKVy2KOoI0QzkWYVfHyDyagdACKBDg0InpoBuWU2+jmjYux7Y2It8CT3moQHVwYd zG+zE4go80N1L7XpSTGq54Yml4l3NyjkJUkVrNFYrre9+P0x04C4evFhSdg/3xEQx9mOMTvf+irsi XQtlk5wRUDa06+VLPcewdDpGChq0hfdVZ/krVgu5yDR9fbNOxykgd+pJFPutihGGLxOhVRXur7Pzc +rYPtLVRvVG/h9BufUv4Lc4oVqTE4zbHjgqlezs0QxNnsI/xEziyKcMx+mIJrBRBSoX9u/veJXF/f aWQb5bzA==; Received: by zero.zsh.org with local id 1pkJ1O-000Okl-6K; Thu, 06 Apr 2023 06:22:58 +0000 Authentication-Results: zsh.org; iprev=pass (snd00012-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.12; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd00012-bg.im.kddi.ne.jp ([27.86.113.12]:40449 helo=dfmta0015.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1pkJ0m-000OPI-Rj; Thu, 06 Apr 2023 06:22:23 +0000 Received: from mail.biglobe.ne.jp by omta0015.biglobe.ne.jp with ESMTP id <20230406062214114.WPNJ.37982.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Thu, 6 Apr 2023 15:22:14 +0900 From: Jun T Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: [PATCH] unmetafy $_ when exporting it to child Message-Id: <6B8D9DF2-A8D4-4551-BA9D-55408342CF5B@kba.biglobe.ne.jp> Date: Thu, 6 Apr 2023 15:22:13 +0900 To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 51632 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: While testing my patch for the initialization of $_, I've noticed that zsh exports _ to child without unmetafying pwd. For example: % mkdir -p /tmp/=E6=BC=A2=E5=AD=97 && cd /tmp/=E6=BC=A2=E5=AD=97 % echo $'#!/bin/ksh\necho $_' > foo % chmod u+x foo % ./foo | od -t c -t x1 0000000 / t m p / 346 274 203 202 345 255 203 267 / . / 2f 74 6d 70 2f e6 bc 83 82 e5 ad 83 b7 2f 2e 2f 0000020 f o o \n 66 6f 6f 0a % echo =E6=BC=A2=E5=AD=97 | od -t c -t x1 0000000 346 274 242 345 255 227 \n e6 bc a2 e5 ad 97 0a You can see that 'echo $_' outputs metafied value: a2 -> 83 82. BTW, if we use ksh % ksh $ ./foo ./foo So zsh exports _=3D/tmp/=E6=BC=A2=E5=AD=97/./foo, but ksh exports = _=3D./foo. diff --git a/Src/exec.c b/Src/exec.c index 4328975b9..3b3d1235e 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -519,7 +519,7 @@ zexecve(char *pth, char **argv, char **newenvp) if (*pth =3D=3D '/') strcpy(buf + 2, pth); else - sprintf(buf + 2, "%s/%s", pwd, pth); + sprintf(buf + 2, "%s/%s", unmeta(pwd), pth); zputenv(buf); #ifndef FD_CLOEXEC closedumps();