zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: ksh compatibility: initial value of $_
Date: Mon, 3 Apr 2023 09:48:22 -0700	[thread overview]
Message-ID: <CAH+w=7Ywqj55EATXmNmoJiRvNY9s-sRZQkqTQ3dKVXx=zijz6A@mail.gmail.com> (raw)
In-Reply-To: <20B96AB1-75EB-4DAD-93C5-B56A84CCA045@kba.biglobe.ne.jp>

On Mon, Apr 3, 2023 at 4:17 AM Jun. T <takimoto-j@kba.biglobe.ne.jp> wrote:
>
> > 2023/04/01 2:45, Bart Schaefer <schaefer@brasslantern.com> 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 = 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!


  reply	other threads:[~2023-04-03 16:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-28  1:52 Bart Schaefer
2023-03-23 10:40 ` Jun T
2023-03-31  8:18   ` Jun T
2023-03-31 14:31     ` Jun. T
2023-03-31 17:45       ` Bart Schaefer
2023-04-03 11:16         ` Jun. T
2023-04-03 16:48           ` Bart Schaefer [this message]
2023-03-31 19:02       ` Bart Schaefer
2023-03-31 19:03         ` Bart Schaefer
2023-04-03 12:13     ` Jun. T
2023-04-03 16:50       ` Bart Schaefer
2023-04-04 16:24         ` Jun. T
2023-04-05  1:03           ` Oliver Kiddle
2023-04-05  8:15             ` zeurkous
2023-04-05  9:00               ` Oliver Kiddle
2023-04-05 16:24             ` Jun. T
2023-04-05  8:14           ` dana
2023-04-05 18:16             ` Jun. T
2023-04-08  4:03               ` dana
2023-04-08 16:22                 ` Oliver Kiddle
2023-04-09 13:30                   ` Jun. T
2023-04-10  0:51                     ` Jun T
2023-04-15  5:02                   ` Felipe Contreras
2023-04-15 22:24               ` Bart Schaefer

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='CAH+w=7Ywqj55EATXmNmoJiRvNY9s-sRZQkqTQ3dKVXx=zijz6A@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).