Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #270344

Re: About dash as sh

From Nicolas George <george@nsup.org>
Newsgroups linux.debian.user
Subject Re: About dash as sh
Date 2024-06-21 13:50 +0200
Message-ID <IRKWe-4uW5-9@gated-at.bofh.it> (permalink)
References <IRys1-4n5U-15@gated-at.bofh.it> <IRJx7-4u74-5@gated-at.bofh.it> <IRKCR-4uPg-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Greg Wooledge (12024-06-21):
> The original message began with the assertion that the OP had run
> across a bug in dash, and gave two URLs, with no description of the bug
> or the impact it was having on their life.
> 
> I read one of the URLs, and the bug is rather obscure.  It involves a
> second script embedded inside a here document inside the first script,
> with the second script being passed to an interpreter process on stdin.
> I'm not surprised that nobody knew about the bug for many years.

The purported bug boils down to this: if you pipe to a non-interactive
shell a command and data for that command, then the non-interactive
shell might read more than just the command as part of its input
buffering and leave less or nothing as data to the command itself.

It is indeed a bug, since the standard says:

  When the shell is using standard input and it invokes a command that
  also uses standard input, the shell shall ensure that the standard
  input file pointer points directly after the command it has read when
  the command begins execution.

But I consider this clause is misguided, it should apply only when the
input is a tty. Relying on it is a terrible idea.

Regards,

-- 
  Nicolas George

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

About dash as sh Ilya Kazakevich <ilya.kazakevich@jetbrains.com> - 2024-06-21 00:30 +0200
  Re: About dash as sh Mike Castle <dalgoda+debian@gmail.com> - 2024-06-21 09:00 +0200
  Re: About dash as sh Michael Kjörling <2695bd53d63c@ewoof.net> - 2024-06-21 12:20 +0200
    Re: About dash as sh Greg Wooledge <greg@wooledge.org> - 2024-06-21 13:30 +0200
      Re: About dash as sh Nicolas George <george@nsup.org> - 2024-06-21 13:50 +0200
        Re: About dash as sh Greg Wooledge <greg@wooledge.org> - 2024-06-21 14:00 +0200
          Re: About dash as sh Mike Castle <dalgoda+debian@gmail.com> - 2024-06-21 18:50 +0200
            Re: About dash as sh Greg Wooledge <greg@wooledge.org> - 2024-06-21 19:20 +0200
        Re: About dash as sh Stefan Monnier <monnier@iro.umontreal.ca> - 2024-06-22 01:30 +0200
          Re: About dash as sh Nicolas George <george@nsup.org> - 2024-06-24 08:20 +0200
            Re: About dash as sh Jeffrey Walton <noloader@gmail.com> - 2024-06-24 08:40 +0200
              [OFFTOPIC] Re: About dash as sh Stefan Monnier <monnier@iro.umontreal.ca> - 2024-06-24 15:00 +0200
  Re: About dash as sh Ilya Kazakevich <ilya.kazakevich@jetbrains.com> - 2024-06-26 20:20 +0200
    Re: About dash as sh Max Nikulin <manikulin@gmail.com> - 2024-06-28 05:00 +0200

csiph-web