[NNTP] 32 bit article counters

Russ Allbery rra at stanford.edu
Thu Jul 14 07:59:35 PDT 2005


Steve Walker <nntp at nntpserver.com> writes:

> I totally disagree.  This is a major issue that must be resolved.  You
> can not push forward a proposed standard that is so completely broken
> that it specifies a limit without any corrective action.  Changing two
> lines of text fixes the problem forever (well, almost forever).

Well, no, changing two lines of text does not fix the problem.  Your
argument is rather that changing two lines of text will get software
authors to fix the problem in all of their code so that 64-bit article
counters will then be usable.

Standards text has no magical effect on running software.  It's possible
(and in fact I believe it is likely) that 64-bit article counters will not
be usable in practice in the forseeable future even if our document
requires them.  That's a key part of this discussion that I don't want
people to miss.  If we say that article counters are 64-bit, but in
practice nearly all clients are 32-bit, we're not actually doing anyone
any favors; if that is the case, anyone implementing 64-bit article
counters following our standard will encounter significant breakage as
soon as they exercise that facility without any warning at all from the
standard.

The purpose of standards is to get people to do the right thing, yes, but
it's also to ensure interoperability.

Out of curiosity, and to be sure I wasn't overestimating the problem, I
checked slrn, a widely used Unix news reader for which it was easy to find
the source.  Here is the function that implements GROUP:

int nntp_select_group (NNTP_Type *s, char *name, int *minp, int *maxp)
{
   int estim;
   int min, max;
   
   switch (nntp_server_vcmd (s, "GROUP %s", name))
     {
      case -1:
        return -1;

      case OK_GROUP:

        if (3 != sscanf(s->rspbuf + 4, "%d %d %d", &estim, &min, &max))
          return -1;

        if (minp != NULL) *minp = min;
        if (maxp != NULL) *maxp = max;

        slrn_strncpy (s->group_name, name, NNTP_MAX_GROUP_NAME_LEN);
        break;
        
      case ERR_ACCESS:
      default:
        break;
     }

   if (NNTP_Try_Authentication == 2)
     NNTP_Try_Authentication = 1;
   return s->code;
}

Note that this fails silently with 64-bit article numbers in ways that are
likely to cause unexpected behavior in the rest of the program, and note
that there is no portable way to easily fix this code since there is no
portable sscanf directive for reading a 64-bit article number that works
on all of the platforms to which slrn has been ported.  This code would
need to be redone to use either Autoconf macros to determine the right
sscanf directive or to use strtoull with a fallback for platforms without
long long.

Note also that, as one might guess from the above, int is used all over
the slrn code base for article numbers.

I would expect to see similar things in most widely used news readers.

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>



More information about the ietf-nntp mailing list