From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27347 invoked from network); 3 Jul 2022 00:23:46 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 3 Jul 2022 00:23:46 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 6A2DC40F6A; Sun, 3 Jul 2022 10:23:23 +1000 (AEST) Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by minnie.tuhs.org (Postfix) with ESMTPS id AE72840E75 for ; Sun, 3 Jul 2022 10:23:12 +1000 (AEST) Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-31c1d580e4bso54486947b3.3 for ; Sat, 02 Jul 2022 17:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HpntKTHBSCzKauS3Yk8S7o99kFdX4fjMMTPwLRSDQ9A=; b=IzH46mEsHdkN1aDagXC+YaPQH+1tqRXkyufxN5hR+q/2L2Ou0NkgEFiT3mLlQY43+1 JMyfTNiFXzwBpjLGjhvAEIBRr2hGEXw19rfUKwYPNth+3D8R0u/peXWj5CzU2BjujZ8D RBNJLfsxfvjqygT6AaOzSegeb86R8UDbbG0T4BI7qFzsY+OEPzX5hpGTjm9BQPmyQMjC 1B1rSnlilfC+FJv0TW+0xO8+0pOoPd7TekLw5btuC0gjQICKZuwapF2xIg28l1UuMb44 WExtFzYbcK1Vu9GfSTChqspDU/o6Ma3hchYly+Yn0W2HceP7NaJzUFaLXTtxzzMWuQCu fAkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HpntKTHBSCzKauS3Yk8S7o99kFdX4fjMMTPwLRSDQ9A=; b=YtQ0/ioVDySfxX/IlZl7X/6NrMx7hiJjvi9h95u8jw/qb9c/FuBTcYs7IVmdHqCnep MEI+LKkKw1CTa5kpQiRIONTSWRS7DykNEXsGRjI8yZhe+TscKmhKPpiidZFEe9TLcSwv rG3zF2gUXRVJzCoPm/E74iUNlDqcXmsoETIYrX3aeYX1d0w5+ybnurZnu3P4SMjDEYgb /sb+eGMJiUVhw9CjaERfJt+su88T8YQ6HWzoTrcPKqtZrX3CCh0M+DlRV+BkvgCxoMpU 13JzqMlu8OwHmByxMXx0+I5K/iwZqG85KoOhLNubJN37EVnxLHFAcYKxhgVdskaTQmLZ 0gKA== X-Gm-Message-State: AJIora8mcs2MNwe4dI+k2rAmpVagC5ivVeXkjce/23wG3tAA3CnI08rj lGful8iKlgGIlYJRAh2/+aWaC2dQVWrbmJTJo8clqtzHOVudcg== X-Google-Smtp-Source: AGRyM1ssG4CWlgbdNDeBjh0LBgfmauakaHFuqb5exbEdxfZDE3DyWFutR+DodDVwUgUUaNmoyD/808NUBpIa74xySk8= X-Received: by 2002:a0d:df0f:0:b0:31b:e000:7942 with SMTP id i15-20020a0ddf0f000000b0031be0007942mr23655762ywe.320.1656807731808; Sat, 02 Jul 2022 17:22:11 -0700 (PDT) MIME-Version: 1.0 References: <874jzz8fyc.fsf@vuxu.org> In-Reply-To: <874jzz8fyc.fsf@vuxu.org> From: "John P. Linderman" Date: Sat, 2 Jul 2022 20:22:00 -0400 Message-ID: To: Leah Neukirchen Content-Type: multipart/alternative; boundary="00000000000050d40905e2db9cf7" Message-ID-Hash: RC2CBEYK7MMXBVRB4JIXGFLLZMVFQGES X-Message-ID-Hash: RC2CBEYK7MMXBVRB4JIXGFLLZMVFQGES X-MailFrom: jpl.jpl@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: TUHS X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: "9 skills our grandkids won't have" - Is this a TUHS topic? List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --00000000000050d40905e2db9cf7 Content-Type: text/plain; charset="UTF-8" But that's a common misconception and not how Ctrl-D works on Unix. Ctrl-D is part of the terminal discipline and causes an immediate stop of the current read(2) syscall. If nothing is in the input buffer, this causes a zero-length read which is detected as end of file. I once read a Patricia Cornwell novel in which the plot hinged around some crooked person typing cat > ttya Somebody is coming meaning to send a message to /dev/ttya, but instead, creating a file named "ttya". (I almost surely have the details wrong, but I'm too lazy to go searching for the real quote, which isn't relevant here.) Cornwell said the ttya file was of size 18, so, being an obsessive nit-picker, I sent her a letter saying that it could have been 18 bytes long, but that would imply that the sender terminated the message with CTRL-D rather than a newline and then terminating the command, the latter of which seemed much more plausible for a novice user. Rather than ignoring my letter, or telling me where to shove my letter, she sent me a gracious thank you note, and an FBI hat, which I still own. On Sat, Jul 2, 2022 at 3:37 PM Leah Neukirchen wrote: > Clem Cole writes: > > > On Fri, Jul 1, 2022 at 10:03 AM Steve Nickolas > wrote: > > > >> On Fri, 1 Jul 2022, Nelson H. F. Beebe wrote: > >> > >> > Ctrl-D signifies end of transmission. Some other O/Ses have used > >> > Ctrl-Z for that purpose, presumably because Z is the final letter > >> > of numerous alphabets. > >> > >> I thought only CP/M and its descendants did that. :o (Of course that > >> includes DOS and Windows) > >> > > Steve - The social disease spread of DOS-11, RT-11, CP/M, and MS/PS-DOS > > used ^Z as an EOF character in their text file format. The key is that > > they stored a block count, not a byte count in the META. Thus the last > > byte needs a marker to tell the OS to stop reading. [Early DEC OS's may > > have done that also, but I never looked at their FS formats]. > > > > Unix, of course, never made any distinction to the core OS WRT to 'type' > > [other than Regular/Directory/Special] and Ken stored a character count. > > So there was no need to signal EOF with a markered stored on disk.. > > > > A pipe or the shell on the other hand does have a need to signal the end > of > > a transaction, and 'End of Transmission,' as Nelson points out, is the > > ASCII character reserved for the same. > > But that's a common misconception and not how Ctrl-D works on Unix. > Ctrl-D is part of the terminal discipline and causes an immediate stop > of the current read(2) syscall. If nothing is in the input buffer, > this causes a zero-length read which is detected as end of file. > > You can verify this e.g. by typing "foo" into cat(1). It will > print "foo", but not exit. Another Ctrl-D will then quit cat(1) due > to the empty read. > > In no case, a ASCII Ctrl-D 0x4 is sent over a pipe or to a shell. > (Over the pty, yes.) > > cheers, > -- > Leah Neukirchen https://leahneukirchen.org/ > --00000000000050d40905e2db9cf7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
But that's= a common misconception and not how Ctrl-D works on Unix.
Ctrl-D is part of the terminal= discipline and causes an immediate stop

of the current read(2) syscall.=C2=A0 If nothing is in the = input buffer,
t= his causes a zero-length read which is detected as end of file.

I once re= ad a Patricia Cornwell novel in which the plot hinged around=C2=A0some croo= ked person typing

=C2=A0 = =C2=A0cat > ttya
Somebody is coming

m= eaning to send a message to /dev/ttya, but instead, creating a file named &= quot;ttya".
(I almost surely have the details=C2=A0wrong, but I'm too lazy to go = searching for the real quote, which isn't=C2=A0relevant=C2=A0here.)

Cornwell said the ttya file = was of size 18, so, being an obsessive nit-picker, I sent her a letter sayi= ng that it could have been 18 bytes long,
but that would imply=C2=A0that the sender termin= ated the message with CTRL-D rather than a newline and then terminating the= command,
the l= atter of which seemed much more plausible for a novice user. Rather than ig= noring my letter, or telling me where to shove my letter,
she sent me a gracious thank y= ou note, and an FBI hat, which I still own.

On Sat, Jul 2, 2022 at 3:3= 7 PM Leah Neukirchen <leah@vuxu.org> wrote:
Clem Cole <clemc@ccc.com> writes:

> On Fri, Jul 1, 2022 at 10:03 AM Steve Nickolas <usotsuki@buric.co> wrote:
>
>> On Fri, 1 Jul 2022, Nelson H. F. Beebe wrote:
>>
>> > Ctrl-D signifies end of transmission.=C2=A0 Some other O/Ses = have used
>> > Ctrl-Z for that purpose, presumably because Z is the final le= tter
>> > of numerous alphabets.
>>
>> I thought only CP/M and its descendants did that. :o (Of course th= at
>> includes DOS and Windows)
>>
> Steve - The social disease spread of DOS-11, RT-11, CP/M, and MS/PS-DO= S
> used ^Z as an EOF character in their text file format.=C2=A0 The key i= s that
> they stored a block count, not a byte count in the META.=C2=A0 =C2=A0T= hus the last
> byte needs a marker to tell the OS to stop reading. [Early DEC OS'= s may
> have done that also, but I never looked at their FS formats].
>
> Unix, of course, never made any distinction to the core OS WRT to '= ;type'
> [other than Regular/Directory/Special]=C2=A0 and Ken stored a characte= r count.
> So there was no need to signal EOF with a markered stored on disk.. >
> A pipe or the shell on the other hand does have a need to signal the e= nd of
> a transaction, and 'End of Transmission,' as Nelson points out= , is the
> ASCII character reserved for the same.

But that's a common misconception and not how Ctrl-D works on Unix.
Ctrl-D is part of the terminal discipline and causes an immediate stop
of the current read(2) syscall.=C2=A0 If nothing is in the input buffer, this causes a zero-length read which is detected as end of file.

You can verify this e.g. by typing "foo<Ctrl-D>" into cat(1= ).=C2=A0 It will
print "foo", but not exit.=C2=A0 Another Ctrl-D will then quit ca= t(1) due
to the empty read.

In no case, a ASCII Ctrl-D 0x4 is sent over a pipe or to a shell.
(Over the pty, yes.)

cheers,
--
Leah Neukirchen=C2=A0 <leah@vuxu.org>=C2=A0 https://leahneukirchen.org/
--00000000000050d40905e2db9cf7--