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_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 25521 invoked from network); 22 Jan 2023 21:25:09 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 22 Jan 2023 21:25:09 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id B140042578; Mon, 23 Jan 2023 07:24:30 +1000 (AEST) Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by minnie.tuhs.org (Postfix) with ESMTPS id B1D3F42572 for ; Mon, 23 Jan 2023 07:24:24 +1000 (AEST) Received: by mail-ej1-f45.google.com with SMTP id bk15so25976767ejb.9 for ; Sun, 22 Jan 2023 13:24:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Y89nH9TeJJeqtcmHiKKpJMJSCMAlM7enNGdfX9vw1ds=; b=H/ZZwJ7NEgFRgpCjv+/BUjMeni+cLFlwiW3kryiP/3nWK4KL6Ijdx49h5jAs9c8U4l 1qFMC3Dzx61oYDZa1oMok8nHQk2w10//qzonfdsqQ/uPECYAjH5fwA2E66w1YJBIJjEx T+avy6hdqbV/GfUK+bzHPGheL489/vDDscEZivCuyuHAxqfiX1kKssXuXvUHedoUuXtW o1EfOUmwqEeNHEdn80mExncs9bS8oTiW043feAWJpg4PkOkuFLr9E0qdHJ3GQDKg+eTA sqdhp2gR+lkumGV+vXLRZe4Ul2r/3Yjt11MqKzCRyFy+9qnUSwrs1Kp4Kw52ZBo6FgIE 8obQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y89nH9TeJJeqtcmHiKKpJMJSCMAlM7enNGdfX9vw1ds=; b=v8X+idhOu9Acq1CFt7PQH6ID87G6xSGlGFUUM7mlLCc6RehJDzpzj5J0uc9cx2pjy/ nlcjuJGOSfUsJFeXfV+Czu/P+hFg3ghnlWJhetwaecMeWVC7Cmj/ViURXfkbiPNuHepd Va4xFsmP6PM/KKP/LB+JDQ1E9iLMrMzDAxstGRuMjAO/wukh2fkYwT8nT2ukiXUVw4ga upYaKbsoML0lSB5vmBGIcdt3KJsPny7cjpykduLhECfyfsSh0tcgC9Ot+rKk+oZE+c+p ycV5df00c6r8Lo3U+rrM/HhEDi9bX2Oor0xDEbzqal/WdXIIJKGLPcOcXEYEZcWS+dKY BGLQ== X-Gm-Message-State: AFqh2kqSs6J6C7J9xeQu0fIh2yN+KqKc+ApBMfB2kkMog+ML7sfglnrp 9HVDven3DpBewNYqHepHBOSQeLeipbJwe8q7wJHSAA== X-Google-Smtp-Source: AMrXdXsK0tuwiGkz9+t1pp29NVawCOlmkXvOiYmerTKBu6kMk6W3yEQDXMMVuu8uRzPDrar4Res5+cX8V43l7aIyOZI= X-Received: by 2002:a17:906:4d13:b0:7c0:c4e6:eff6 with SMTP id r19-20020a1709064d1300b007c0c4e6eff6mr2854894eju.465.1674422603064; Sun, 22 Jan 2023 13:23:23 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Warner Losh Date: Sun, 22 Jan 2023 14:23:11 -0700 Message-ID: To: Clem Cole Content-Type: multipart/alternative; boundary="00000000000075b78105f2e0e41a" Message-ID-Hash: N74W2DDT2NQXCP236DWZSMVWCEO6PVCB X-Message-ID-Hash: N74W2DDT2NQXCP236DWZSMVWCEO6PVCB X-MailFrom: wlosh@bsdimp.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: The Eunuchs Hysterical Society X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: FD 2 List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --00000000000075b78105f2e0e41a Content-Type: text/plain; charset="UTF-8" On Sat, Jan 21, 2023 at 11:37 AM Warner Losh wrote: > > Yea. Like many things, there was a transition... the most important bit is > the shell. And that was more tricky to read through with the phone at > breakfast... > OK. I've dug a bit further and Clem and I have chatted... Here's the summary. We don't have V4's shell, alas, since all we have from that time period is the C kernel a few months before the 4th edition release. V5 /bin/sh closes fd2 and then dups fd1 to fd2. This creates fd2 as something special. V6 closes all FD's larger than 1 (2-15) and then does the dup(1) which it makes sure returns 2 or it closes the file. While there were features in V6 to allow use of fd2/stderr, few programs used then. And neither crypt nor passwd reads from fd2. crypt reads from fd0, while passwd doesn't read. It just replaces the hashed password with the new password. I've also looked at pr because >I do remember that pr -p actually read from FD 2. It probably still does. and that's not true in V7 at least... pr didn't have a 'p' arg :). Maybe later programs started to do these things, but most of what went on with V7 was a transition to most error messages on stderr, which typically went to stdout in V6. So, people remembering it coming in with V7 are right, in the sense it was the first release to do it consistently. And the people remembering V4 or V5 are also right, in a different sense because the shell was ensuring fd2 was a copy of fd1 there, which a couple of programs (diff) used for errors. And I believe that the impetus for the V7 changes was phototypesetting 'file not found' too often... But that last bit is mostly because I want to believe. Warner --00000000000075b78105f2e0e41a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sat, Jan 21, 2023 at 11:37 AM Warn= er Losh <imp@bsdimp.com> wrote:=

Yea. Like many things, there was a transition... t= he most important bit is the shell. And that was more tricky to read throug= h with the phone at breakfast...

OK. I've dug a bit further and Clem and I have chatted...=C2=A0 Here&= #39;s the summary.

We don't have V4's shel= l, alas, since all we have from that time period is the C kernel a few mont= hs before the 4th edition release. V5 /bin/sh closes fd2 and then dups fd1 = to fd2. This creates fd2 as something special. V6 closes all FD's large= r than 1 (2-15) and then does the dup(1) which it makes sure returns 2 or i= t closes the file. While there were features in V6 to allow use of fd2/stde= rr, few programs used then.

And neither crypt nor = passwd reads from fd2. crypt reads from fd0, while passwd doesn't read.= It just replaces the hashed password with the new password. I've also = looked at pr because

>I do remember that pr -p = actually read from FD 2. It probably still does.

and that's no= t true in V7 at least... pr didn't have a 'p' arg :). Maybe lat= er programs started to do these things, but most of what went on with V7 wa= s a transition to most error messages on stderr, which typically went to st= dout in V6.

So, people remembering it coming in with V7 are right,=C2=A0in the se= nse it was the first release to=C2=A0do it consistently. And the people rem= embering V4 or V5 are also right, in a different sense because the shell wa= s ensuring fd2 was a copy of fd1 there, which a couple of programs (diff) u= sed for errors. And I believe that the impetus for the V7 changes was photo= typesetting 'file not found' too often...=C2=A0 But that last bit i= s mostly because I want to believe.

Warner
--00000000000075b78105f2e0e41a--