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 11506 invoked from network); 3 Apr 2023 16:48:53 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Apr 2023 16:48:53 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1680540533; b=AezdIZZHuft9yFEr2gHV4po2rtXxLw+F/MBCnePlQxo5eeX+rzXdc4zHlXixSM5dEmnEJ9J9Ep Wf/k1uWZMiXyvxQALEwcRlxxTUeaRwvz6/Y1Sf9JOsd5zZpOlXM1mHL5Ylft94eFiSPzpn9gav CAlLPwV8LPJeeROmrTYcpSd6ZD1zhE3qR0Rr9OL2EuTawBcq4stVA8qxU9LKVooLQiUdiLL9jt 6SMom4ahwqW/RkI2jYqRI+mOHGO/UizryarCv0IQ+FWDwpHdYetiXufMwUX5YCWDcs8ibp8UJ/ 93WWd8hHDcfcwrbNMhAOefbPdP6+Cr/pXAtQ0aqO5uFc3A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f54.google.com) smtp.remote-ip=209.85.208.54; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1680540533; bh=VXtXOmemirxQsF9od1mDwbFmf+77xz9KtxzAXGCatXM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=rw3+xwIwsVcp8iYmiWzj2sU5OEfVNwmZXqzD9bAI0/e2Lpeo8o5W50a7pwRl2Tc9CrCe47gCvW /lYG6ZULkWoaInwxEbJ1ilVZpLbhuBbxyS5PuPj2Z2gq2AmNRUf16aPFYY5o0OmG+yK1Rtw+TO /fkLYlwq9RVhDt1dbvE6gGwZbdieqVOrBhIxXUkby8EskoRshkmHaGZacUxWgxaGmXpL9ncP9H 7jKWxBgTo9JkeBCfiajILE0OCuuQNUSQvsd4jwz2iuYHWkQ4+PMXlTUbHJXKZLN5cwDbvz/k41 /JxwZaJ6D0Y38NaMuBi7oM4s/xDfOgJJeh4aW12dftvIBw==; 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:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=lcP8GGflhEIpzDvvQ31J6z3vZF0y97JtyVa73e7tdXQ=; b=VwG85FF4WdNduHMf3gd2w1LMDs sxpHFzKFuI27+9S9kMRepp7dUKE6lWdzE8rGKRSZwTQLoQ4gfx6jGrY5ybNFmLuUW7tVZciJLJbwX oz+fuQTFQqJgUWzWQ6zst3YW3jQ7fwW/BDYi6cpQ4k6BjWHj05kPId7MEiwd7ddj1pPXwIqI0UIwa uxdWK9Rh/u8xqvqrBqHd/zPVA/Em1MfcVlbMGTDgXiqSB/9GwDoE1aa449rLBADEHZoX3Dq5oYRS6 lfkZYdJ6p9rEwk3/Te2N8abCza8KTYwVXbnHZnjcTqNcobeY5jHa538ZdP/y4bZ4io2woKQLiPBp7 KMQW7BGw==; Received: by zero.zsh.org with local id 1pjNMR-000Oub-Od; Mon, 03 Apr 2023 16:48:51 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f54.google.com) smtp.remote-ip=209.85.208.54; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ed1-f54.google.com ([209.85.208.54]:39610) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pjNMA-000Oc4-Pf; Mon, 03 Apr 2023 16:48:36 +0000 Received: by mail-ed1-f54.google.com with SMTP id ek18so119922105edb.6 for ; Mon, 03 Apr 2023 09:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; t=1680540514; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lcP8GGflhEIpzDvvQ31J6z3vZF0y97JtyVa73e7tdXQ=; b=ZdAL+TJw7UT9byB36T5PTMYeuDQWzwwzegMlxkAtL0MVkOMOb13bKW1YghGsLqJ19m W0oMyKCZmdfXy+PHaE+WjLngyZzyHPZTJ9S1ZJSBNBtYkSVESV/iMfhQaGP5tHTN6JwO v3pROSRA78rFDHDlFjs+sYGD8GXy2QZZqzVae8Y++o68MRTMxpwy9jJKBeBWBn4T0Aza GlbjYD7fnY9iBD2F4oLC0avbqwIfiWsgQoP6IHwm9RcfifhOuf2sbtf9LKOnH3lK95Pk b7Ulv+FFvm+dQvy/ubMtWRg8H2xgGzpcMSUDmYSptytWVhshgIe3mW8GN3I4Oiw72w41 nn/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680540514; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lcP8GGflhEIpzDvvQ31J6z3vZF0y97JtyVa73e7tdXQ=; b=w5kxKqs4h+H1az/hOTof9nGY2fZ0or13NVKVjQMIAp4MtURgLyfp5NbWAR6gDv+nNQ zTFhdDJ7j9Iu6xh5mJSJKvwJq0dJDJ6TM8uC+y8SOcKMR/7RqtksI8ry0UQO6Oa21Q/h SDBU1GteOki9XqtPt1Fk+JrWAl+Iyuby1ElUP4iBxodFTn2pOofgZSxJ4ur/Pt4FY6qw kbzmq5gkFdPn9dKqe0CC4+vyK4b0qGYSscBGMRgG+2i1+VOq/2m3skTEuBDCXw0+R8I6 mwJ+hE4ITx2FFA/H9rCSFVkHC0uexD2xcfLL4O+pEv9qfs3mLswJfePB75u9p8aGAeEL O7vw== X-Gm-Message-State: AAQBX9dfNHifW3J3if6rAS/C02K9KOnZbuIv6FJsoGwPejyDx+uvZeOe s8aiL5JqE3xY3TdkMoVKmn8ctLtfrjCORIVQ9W9RPg== X-Google-Smtp-Source: AKy350YkJ5WK3xbRREQ4aJpvz/iqvE/aJQzNxHoRzi+Vb+PUtU0s7sCTY0n4o2txvuEgFNNC1A3reKAXUkg9yfSrVF0= X-Received: by 2002:a17:906:94c2:b0:930:f984:c56f with SMTP id d2-20020a17090694c200b00930f984c56fmr16729850ejy.12.1680540514013; Mon, 03 Apr 2023 09:48:34 -0700 (PDT) MIME-Version: 1.0 References: <20B96AB1-75EB-4DAD-93C5-B56A84CCA045@kba.biglobe.ne.jp> In-Reply-To: <20B96AB1-75EB-4DAD-93C5-B56A84CCA045@kba.biglobe.ne.jp> From: Bart Schaefer Date: Mon, 3 Apr 2023 09:48:22 -0700 Message-ID: Subject: Re: ksh compatibility: initial value of $_ To: "Jun. T" Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 51621 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: On Mon, Apr 3, 2023 at 4:17=E2=80=AFAM Jun. T wrote: > > > 2023/04/01 2:45, Bart Schaefer wrote: > > > > Similar behavior from ksh, so it really is whatever happens to be in > > the environment for '_' rather than an actual pathname. > > Well, I think this is _the_ behavior ksh document specifies. If what > we want to achieve is just the ksh compatibility then this is enough? > > But of course we can do better. The patch below ignores the $_ in > environment and tries to guess the executable/script pathname. > > Or we can use this only if $_ is not in environment (I guess bash > behaves this way). I would choose that last, but I suppose it could also be contingent on emulation mode. RE the draft patch: > + /* search each dir in PARH */ > + const char *path, *sep; > + char *real; > + int pathlen, dirlen; > + path =3D getenv("PATH"); I take it this is happening early enough that zsh's internal setting of the path is not yet done. After consideration I don't think any of my other specific comments would be helpful, so I'll just make the general observation that when I brought up the topic I didn't think it would require this much effort!