zsh-users
 help / color / mirror / code / Atom feed
From: vapnik spaknik <vapniks@yahoo.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Bug? piping ls to anonymous function changes subsequent behaviour of ls
Date: Mon, 28 Sep 2020 01:02:06 +0000 (UTC)	[thread overview]
Message-ID: <1678353929.1101107.1601254926037@mail.yahoo.com> (raw)
In-Reply-To: <CAH+w=7a2sPR8mecmaV8YuotyUJ9Ma90NxyyPrsL+SH6xJyC0yw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 988 bytes --]

 

On Monday, September 28, 2020, 01:41:10 AM GMT+1, Bart Schaefer <schaefer@brasslantern.com> wrote:

>Not reproducible for me with "zsh -f".

>Have you tried running "whence -a ls" to find out if or to what it has
>been redefined?

Yep, it was aliased, but that isn't the problem. I've found that the anonymous function is being assigned to the left hand side of the pipe, but only the first time that pipeline is run in a new shell. Very strange.

From a new shell:
> which -a ls 
ls: aliased to ls --color=auto
/bin/ls
> /bin/ls | () {echo foo}
foo
> /bin/ls
foo
> which /bin/ls
/bin/ls () {
 echo foo
}
> unfunction /bin/ls
> /bin/ls
Downloads Documents etc...
> # Yay! now try again in the same shell:
> /bin/ls | () {echo foo}
foo
> /bin/ls
Downloads Documents etc...
> # back to normal behaviour!

If I start a new shell the same thing happens again, i.e. the first time I pipe to the anonymous function it is actually assigned to the left hand side, but subsequently it isn't.
  

[-- Attachment #2: Type: text/html, Size: 1311 bytes --]

  reply	other threads:[~2020-09-28  1:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1846474183.1100394.1601253063804.ref@mail.yahoo.com>
2020-09-28  0:31 ` vapnik spaknik
2020-09-28  0:40   ` Bart Schaefer
2020-09-28  1:02     ` vapnik spaknik [this message]
2020-09-28  2:36       ` Bart Schaefer
2020-09-29 19:06         ` vapnik spaknik

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=1678353929.1101107.1601254926037@mail.yahoo.com \
    --to=vapniks@yahoo.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@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).