NetBSD Problem Report #55695
From gson@gson.org Mon Oct 5 12:49:19 2020
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 29FDA1A923C
for <gnats-bugs@gnats.NetBSD.org>; Mon, 5 Oct 2020 12:49:19 +0000 (UTC)
Message-Id: <20201005124914.CBB0D253EDA@guava.gson.org>
Date: Mon, 5 Oct 2020 15:49:14 +0300 (EEST)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: factor(6) -h option doesn't always work
X-Send-Pr-Version: 3.95
>Number: 55695
>Category: bin
>Synopsis: factor(6) -h option doesn't always work
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Oct 05 12:50:00 +0000 2020
>Closed-Date: Tue Oct 13 16:45:46 +0000 2020
>Last-Modified: Tue Oct 13 16:45:46 +0000 2020
>Originator: Andreas Gustafsson
>Release: NetBSD 9.0; also -current
>Organization:
>Environment:
System: NetBSD
Architecture: x86_64
Machine: amd64
>Description:
The factor(6) man page says:
-h If the -h flag is specified, factors will be printed in "human-
readable" format. If a factor x divides a value n (>1) times, it
will appear as x^n.
but that doesn't actually work for factors greater than 65537:
$ /usr/games/factor -h 4295098369
4295098369: 65537^2
$ /usr/games/factor -h 4295360521
4295360521: 65539 65539
>How-To-Repeat:
See above.
>Fix:
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/55695 CVS commit: src/games/factor
Date: Mon, 5 Oct 2020 17:11:47 -0400
Module Name: src
Committed By: christos
Date: Mon Oct 5 21:11:47 UTC 2020
Modified Files:
src/games/factor: factor.c
Log Message:
PR/55695: Andreas Gustafsson: factor(6) -h option doesn't always work
Handle -h for factors greater than the primes table.
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/games/factor/factor.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Andreas Gustafsson <gson@gson.org>
To: "Christos Zoulas" <christos@netbsd.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: PR/55695 CVS commit: src/games/factor
Date: Sat, 10 Oct 2020 11:46:06 +0300
Christos Zoulas committed:
> Modified Files:
> src/games/factor: factor.c
>
> Log Message:
> PR/55695: Andreas Gustafsson: factor(6) -h option doesn't always work
> Handle -h for factors greater than the primes table.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.33 -r1.34 src/games/factor/factor.c
This does fix the reported problem, but it introduces a new one: now
large repeated factors are printed as x^n even when the -h option is
not specified:
# /usr/games/factor 4295360521
4295360521: 65539^2
--
Andreas Gustafsson, gson@gson.org
From: Andreas Gustafsson <gson@gson.org>
To: "Christos Zoulas" <christos@netbsd.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: PR/55695 CVS commit: src/games/factor
Date: Sun, 11 Oct 2020 18:34:17 +0300
Also, the games/t_factor/loop2 test case now fails. This is not just
a case of factor(6) failing to use the requested output format, but
here it is actually giving incorrect results.
Fail: stdout does not match golden output
--- expout 2020-10-11 12:40:38.330291334 +0000
+++ /tmp/check.xkTpvj/stdout 2020-10-11 12:40:38.375734743 +0000
@@ -1 +1 @@
-99999999999991: 7 13 769231 1428571
+99999999999991: 7 13 1428571 1428571
--
Andreas Gustafsson, gson@gson.org
State-Changed-From-To: open->closed
State-Changed-By: gson@NetBSD.org
State-Changed-When: Tue, 13 Oct 2020 16:45:46 +0000
State-Changed-Why:
Confirmed fixed, including the regressions introduced by the initial fixes. Thanks.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.