zsh-workers
 help / color / mirror / Atom feed
* Issue with echo & source to /dev/stdin
@ 2021-01-06  6:27 Anand N
  2021-01-06 16:40 ` Bart Schaefer
  2021-01-06 16:48 ` Bart Schaefer
  0 siblings, 2 replies; 5+ messages in thread
From: Anand N @ 2021-01-06  6:27 UTC (permalink / raw)
  To: zsh-workers

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

Hi All,

My zsh has become very slow after upgrading to Mac Big Sur OS.
It was nvm that was causing the issue. So I researched and found that nvm
can be lazy loaded with the `--no-use` option.

However, even after using --no-use, it was still slow. The reason is a
simple echo command to /dev/stdin. It is taking >5 seconds. Below are the
lines that are causing the issue

```
[ "_$( . /dev/stdin yes 2> /dev/null <<'EOF'
[ $# -gt 0 ] && nvm_echo $1
EOF
)" = "_yes" ]
```

We noticed that even a very basic echo to /dev/stdin is taking more than 5
seconds. For example

```

time ((echo abc) | (. /dev/stdin))

/dev/stdin:1: command not found: abc
( ( echo abc; ) | ( . /dev/stdin; ); )  0.00s user 0.00s system 0% cpu
5.087 total

```

This happens only with shell built-in echo and doesn't happen with
/bin/echo.
We tried many options and a more detailed discussion can be found in the
below github issue
https://github.com/nvm-sh/nvm/issues/2387

Looking forward to your help. You can directly reply in the github thread.
It will help others as well.

Thanks,
Anand

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Issue with echo & source to /dev/stdin
  2021-01-06  6:27 Issue with echo & source to /dev/stdin Anand N
@ 2021-01-06 16:40 ` Bart Schaefer
       [not found]   ` <CAH=D2ePreSUi9VSDqZsXVjAJZbte5ui5c60BMvERRK4gCiZnbA@mail.gmail.com>
  2021-01-06 16:48 ` Bart Schaefer
  1 sibling, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2021-01-06 16:40 UTC (permalink / raw)
  To: Anand N; +Cc: zsh-workers

On Tue, Jan 5, 2021 at 10:27 PM Anand N <anand.mail@gmail.com> wrote:
>
> We noticed that even a very basic echo to /dev/stdin is taking more than 5 seconds.

Has anyone tried using "dtruss" on the process to see which system
calls may be blocking?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Issue with echo & source to /dev/stdin
  2021-01-06  6:27 Issue with echo & source to /dev/stdin Anand N
  2021-01-06 16:40 ` Bart Schaefer
@ 2021-01-06 16:48 ` Bart Schaefer
  1 sibling, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2021-01-06 16:48 UTC (permalink / raw)
  To: Anand N; +Cc: zsh-workers

> We tried many options and a more detailed discussion can be found in the below github issue https://github.com/nvm-sh/nvm/issues/2387

https://github.com/nvm-sh/nvm/issues/2387#issuecomment-755119218 says:
> Well, it looks like there is not going to be a single solution that works for both bash v3 and zsh 5.8 on MacOS short of using another actual file (since bash has a problem with pipes and zsh has a problem with heredocs).

What's the problem zsh has with heredocs?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Fwd: Issue with echo & source to /dev/stdin
       [not found]   ` <CAH=D2ePreSUi9VSDqZsXVjAJZbte5ui5c60BMvERRK4gCiZnbA@mail.gmail.com>
@ 2021-01-06 17:10     ` Anand N
  2021-01-06 20:41       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Anand N @ 2021-01-06 17:10 UTC (permalink / raw)
  To: zsh-workers

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

+zsh-workers@zsh.org <zsh-workers@zsh.org>

---------- Forwarded message ---------
From: Anand N <anand.mail@gmail.com>
Date: Wed, Jan 6, 2021 at 10:39 PM
Subject: Re: Issue with echo & source to /dev/stdin
To: Bart Schaefer <schaefer@brasslantern.com>


Hi Bart,

I tried with dtruss; but it was giving error for built-ins
dtrace: failed to execute echo: (os/kern) failure

There might be other ways, but I am no expert in shell and dtruss.
Please let me know if I can do anything else.

Regarding the discussion in nvm github, can you please post your query over
there?
Like I mentioned above, I am no expert and your inputs there will help the
others in the discussion as well

Thanks,
Anand

On Wed, Jan 6, 2021 at 10:10 PM Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Tue, Jan 5, 2021 at 10:27 PM Anand N <anand.mail@gmail.com> wrote:
> >
> > We noticed that even a very basic echo to /dev/stdin is taking more than
> 5 seconds.
>
> Has anyone tried using "dtruss" on the process to see which system
> calls may be blocking?
>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Issue with echo & source to /dev/stdin
  2021-01-06 17:10     ` Fwd: " Anand N
@ 2021-01-06 20:41       ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2021-01-06 20:41 UTC (permalink / raw)
  To: Anand N; +Cc: zsh-workers

On Wed, Jan 6, 2021 at 9:10 AM Anand N <anand.mail@gmail.com> wrote:
>
> I tried with dtruss; but it was giving error for built-ins
> dtrace: failed to execute echo: (os/kern) failure

You probably have to use
 sudo dtruss zsh -fc '(echo echo foo) | ( . /dev/stdin)'
or something to that effect.

> Regarding the discussion in nvm github, can you please post your query over there?

I don't have a github account and I don't use NVM, so ... I
respectfully decline.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-06 20:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06  6:27 Issue with echo & source to /dev/stdin Anand N
2021-01-06 16:40 ` Bart Schaefer
     [not found]   ` <CAH=D2ePreSUi9VSDqZsXVjAJZbte5ui5c60BMvERRK4gCiZnbA@mail.gmail.com>
2021-01-06 17:10     ` Fwd: " Anand N
2021-01-06 20:41       ` Bart Schaefer
2021-01-06 16:48 ` Bart Schaefer

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git