Re: OpenSSL breaks factor(6)

From: Rodney W. Grimes <freebsd-rwg_at_gndrsh.dnsmgr.net>
Date: Fri, 27 Dec 2019 19:02:11 -0800 (PST)
> On Fri, Dec 27, 2019 at 02:42:12PM -0800, Steve Kargl wrote:
> > On Fri, Dec 27, 2019 at 01:47:17PM -0800, Steve Kargl wrote:
> > > On Fri, Dec 27, 2019 at 01:25:30PM -0800, Steve Kargl wrote:
> > > > The use of OpenSSL in factor(6) breaks factor(6) with respect to
> > > > its documentation.
> > > > 
> > > > % man factor
> > > >   ...
> > > >   Numbers may be preceded by a single '+'.
> > > >   ...
> > > > 
> > > > % factor +125
> > > > factor: +125: illegal numeric format.
> > > > 
> > > 
> > > This fixes factor(6) for the above issue.  The issue with
> > > hexadecimal is not easily fixed.
> > >
> >  
> > This patch now includes a fix for hexadecimal conversion.  It
> > simple scans the string for a hex digit in [a,...,f] and assumes
> > that a hexadecimal string has been entered.  A string that includes
> > character from the decimal digits is assumed to by a decimal
> > representation.  
> 
> Might as well fix the documentation.  Acknowledges that factor(6)
> can deal with hexidecimal strings, and as a bonus fixes the bogus
> information about the maximum value considered by primes(6).
> 
> Index: factor.6
> ===================================================================
> --- factor.6	(revision 355983)
> +++ factor.6	(working copy)
> _at__at_ -36,7 +36,7 _at__at_
>  .\"
>  .\"   chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
>  .\"
> -.Dd October 10, 2002
> +.Dd December 27, 2019
>  .Dt FACTOR 6
>  .Os
>  .Sh NAME
> _at__at_ -67,11 +67,20 _at__at_
>  .Nm
>  is invoked with no arguments,
>  .Nm
> -reads numbers, one per line, from standard input, until end of file or error.
> +reads numbers, one per line, from standard input, until end of file or 0
> +is entered or an error occurs.
>  Leading white-space and empty lines are ignored.
>  Numbers may be preceded by a single
>  .Ql + .
>  Numbers are terminated by a non-digit character (such as a newline).
> +Numbers can be either decimal or hexadecimal strings.
> +If the string contains only decimal digits, it is treated as a
> +decimal representation for a number.
> +A hexadecimal string should not a
                                  ^contain? s/a/an/

> +.Em 0x
> +or
> +.Em 0X
> +prefix.
>  After a number is read, it is factored.
>  .Pp
>  The
> _at__at_ -89,7 +98,7 _at__at_
>  value must not be greater than the maximum.
>  The default and maximum value of
>  .Ar stop
> -is 3825123056546413050.
> +is 18446744073709551615.
>  .Pp
>  When the
>  .Nm primes
> 
> -- 
> Steve

-- 
Rod Grimes                                                 rgrimes_at_freebsd.org
Received on Sat Dec 28 2019 - 02:02:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:22 UTC