zsh-workers
 help / color / mirror / code / Atom feed
From: Lyude Paul <lyude@redhat.com>
To: zsh-workers@zsh.org
Subject: Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1
Date: Wed, 02 Mar 2022 17:38:15 -0500	[thread overview]
Message-ID: <5e9cdfc2b807bfc4aa4695938b70156742c2e120.camel@redhat.com> (raw)

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



             reply	other threads:[~2022-03-02 22:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 22:38 Lyude Paul [this message]
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

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=5e9cdfc2b807bfc4aa4695938b70156742c2e120.camel@redhat.com \
    --to=lyude@redhat.com \
    --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).