zsh-workers
 help / color / mirror / code / Atom feed
* Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1
@ 2022-03-02 22:38 Lyude Paul
  2022-03-02 22:59 ` Bart Schaefer
  2022-03-03  9:39 ` Peter Stephenson
  0 siblings, 2 replies; 5+ messages in thread
From: Lyude Paul @ 2022-03-02 22:38 UTC (permalink / raw)
  To: zsh-workers

Hi! I'm reporting this here because after some discussion in #zsh, it was
determined this is likely both a regression, and also isn't POSIX compliant.
Keep in mind I don't have as clear of an understanding of what's happening
below the hood here as I'd like, so I'm not 100% the subject line here is
correct. I've got plenty of examples to clarify though :)

Basically, what seems to be happening is that since 5.8.1 zsh no longer seems
to correctly handle input from stdin unless the terminal is in interactive
mode.

Here's a simple example script that demonstrates what I mean:

   printf '%s\n' 'echo Shell is $$' sh 'echo Shell is $$' | zsh

Running on zsh 5.8 returns:

   Shell is 70
   Shell is 71

Running on zsh 5.8.1 however, returns:

   Shell is 86396
   Shell is 86396

This can end up being an issue when trying to do things like (assuming sudo is
configured on this system to not request a password, and zsh is the default
shell):

   ssh foo <<- _EOF_
   whoami
   sudo -s
   whoami
   _EOF_

While that's maybe not the best way of doing such things in shell, I have
quite a number of scripts that rely on this working and have for quite some
time. According to llua from #zsh as well, this is also likely not POSIX
compliant according to:

   https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html (see the
   section labeled "INPUT FILES")

llua suggested that this breakage may have come from
e5cd2dd980302f328d232d933f646c3dc02828bf ("49290: Replace stdio for buffered
shell input."), which I've confirmed to be true by bisecting this locally. 

For reference: I originally reproduced this on Fedora 35, although I have a
feeling that probably doesn't matter too much here. If there's any other
information I can provide that would help with getting this fixed, don't
hesistate to ask. And thank you ahead of time!
-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat



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

end of thread, other threads:[~2022-03-03 22:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 22:38 Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1 Lyude Paul
2022-03-02 22:59 ` Bart Schaefer
2022-03-03  9:39 ` Peter Stephenson
2022-03-03 11:52   ` Peter Stephenson
2022-03-03 22:59     ` Lyude Paul

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).