๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #63079

Re: NNTP and YENC

#63079
From: Bart Crane
Date: Tue, 14 Jan 2003 00:28
130 lines
6523 bytes
Claus F๏ฟฝrber <claus-usenet-20030110@faerber.muc.de> wrote in message
news:8d$Rtvs3cDD@3247.org...
> Jeremy <jeremy@exit109.com> schrieb/wrote:
> > Phil <PeepingUnder@TheCovers.org> wrote:
> >> The test is taking a piece of C code using stdio.h, compile it on
> >> DOS/Windows or Unix/Linux, and running it on both.  The result should
be
> >> identical.
>
> > But whatever gave you that idea?  C code isn't inherently portable;
>
> No, Phil is right. The problem is that you can't expect it to produce
> the same result without converting the input data to local conventions
> for text and binary files:
> The C specification does only make some guarantees about data written to
> and from text and binary streams but it does not define the mapping from
> these streams to the data that it actually stored on disk.
>
> > you have to make it portable by working around platform-specific
> > quirks. In your case, this is one of them.
>
> It's not platform-specific quirks but making assumptions that the C
> standard does not guarantee.
>
> > If you want to process data from Usenet, you're going to have to open
> > it in binary mode.
>
> Yes, this is the solution because the C standard guarantees that "binary
> streams" are able to save any char values, whereas "text streams" can't
> handle all data allowed by Netnews standards.
>
> But that suddenly exposes us to ...
>
> > Which, in fact, *would* be pretty portable, since Unix systems ignore
> > the "b".
>
> ... the quirks found on Unix systems: On these systems, Netnews data is
> usually stored in what maps to C's "text mode". However, the assumption
> that this is possible is only true on POSIX systems but not guaranteed
> by the C specification.
>
> The original poster is also making the assumption that his platform can
> handle Netnews data as "text streams" and that ports of text utilities
> can handle it. This is true on POSIX systems but not on his system.
> There's *nothing* broken here, except that his assumptions are not valid
> on his non-POSIX system.

This is not a POSIX thing, this is a C thing.

NNTP-data has been, up to now, compatible with what DOS considers
a text-stream to be.  Coincidence?  Not at all.  It was in fact compatible
with what became the the ISO-C definition of a text-stream, which
forbids any ANSI-defined control-codes from appearing in the stream
(excepting for those few that have definition use for formatting text:
VTAB, HTAB, FF, CR and LF).

The following document describes text-streams, C and UNIX,
from the IBM 370 perspective.  I think it helps clarify the definition of
a text-stream, why it is necessary.

http://www.sas.com/service/library/onlinedoc/sasc/doc700/html/lr1/zhbkgrnd.h
tm

I think this wording (from the above link) summarizes my position well:

"ISO/ANSI C I/O Concepts

The definition of the C I/O library contained in the ISO/ANSI
C standard is based on the traditional UNIX standard I/O definition,
but differs from it in many ways. These differences exist to support
efficient I/O implementations on systems other than UNIX, and to
provide some functionality not offered by UNIX. In general, where
definitions of I/O routines differ between ISO/ANSI C and UNIX C,
programs should assume the ISO/ANSI definitions for maximum
portability. The ISO/ANSI definitions are designed for use on many
systems including UNIX, while the applicability of the UNIX
definitions is more limited."

And this wording summarizes the problem with NNTP-server
output containing control-codes:

"The ISO/ANSI I/O model

The following list describes the I/O model for ISO/ANSI C.
The points are listed in the same order as the corresponding
points for the UNIX I/O model, as presented in the previous
section.

A file may be processed in one of two ways: as a text stream,
or as a binary stream. When a file is processed as a binary stream,
it appears to the program as a sequence of characters. It may not
be possible to create a file containing no characters.

A file accessed as a text stream appears to the program as a
sequence of lines separated by occurrences of the new-line character
( '\n' ). The effects of reading or writing control characters using a
text stream are not predictable. An implementation is permitted to
record line separators using some technique other than physical
new-line characters."

As you and whoever reads this can probably surmise, my whole
position is that the phrasing in RFC 977 that the "textual matter"
is "to be displayed on the user's terminal." -- i.e.: terminal control
codes must not appear in the data stream -- the same definitiona
as the the ISO C definition of a "text-stream".  Coincidence?
Not hardly!!!

Thanks for the conversation.  It was illuminating.  Hopefully, we
all now realize the extent to which RFC 977 is being violated with
the recent change to include terminal-control codes in the data
stream (by way of YENC encoding).

Processing nntp-data with text-processing utilities written in stdio-
based portable C should be possible for all computer systems, not
just those that use the Unix I/O model.

Bart.


>
> Claus
> --
> ------------------------
http://www.faerber.muc.de/ ------------------------
> OpenPGP: DSS 1024/639680F0 E7A8 AADB 6C8A 2450 67EA AF68 48A5 0E63 6396
80F0


Technical Details
Message-ID: <aOIU9.101$qk2.63728@news.uswest.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!msc1.onvoy!ply1.onvoy!onvoy.com!feed.news.qwest.net!news.uswest.net.POSTED!not-for-mail
References: <BXLR9.432835$pN3.48082@sccrnsc03><1041772747.319829@ok-corral.gunslinger.net><BiqS9.160$wz1.152433@news.uswest.net><1042007522.340079@ok-corral.gunslinger.net> <8d$Rtvs3cDD@3247.org>

Show Full Headers
Complete Article Headers
Message-ID: <aOIU9.101$qk2.63728@news.uswest.net>
Subject: Re: NNTP and YENC
Date: Mon, 13 Jan 2003 16:28:32 -0800
From: "Bart Crane" <bcrane@iready.com>
References: <BXLR9.432835$pN3.48082@sccrnsc03><1041772747.319829@ok-corral.gunslinger.net><BiqS9.160$wz1.152433@news.uswest.net><1042007522.340079@ok-corral.gunslinger.net> <8d$Rtvs3cDD@3247.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!msc1.onvoy!ply1.onvoy!onvoy.com!feed.news.qwest.net!news.uswest.net.POSTED!not-for-mail
Newsgroups: news.software.nntp
Lines: 129
Organization: iReady Corp.
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
NNTP-Posting-Host: 65.115.68.98
X-Trace: news.uswest.net 1042503942 65.115.68.98 (Mon, 13 Jan 2003 18:25:42 CST)
NNTP-Posting-Date: Mon, 13 Jan 2003 18:25:42 CST