Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Dec 2019 19:02:11 -0800 (PST)
From:      "Rodney W. Grimes" <freebsd-rwg@gndrsh.dnsmgr.net>
To:        sgk@troutmask.apl.washington.edu
Cc:        freebsd-current@freebsd.org
Subject:   Re: OpenSSL breaks factor(6)
Message-ID:  <201912280302.xBS32BaP041083@gndrsh.dnsmgr.net>
In-Reply-To: <20191227230335.GA61736@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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)
> @@ -36,7 +36,7 @@
>  .\"
>  .\"   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
> @@ -67,11 +67,20 @@
>  .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
> @@ -89,7 +98,7 @@
>  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@freebsd.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912280302.xBS32BaP041083>