Bugzilla – Attachment 125275 Details for
Bug 29078
Division by zero in touch_all scripts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29078: Resolve division by zero in touch_all scripts
Bug-29078-Resolve-division-by-zero-in-touchall-scr.patch (text/plain), 2.02 KB, created by
Martin Renvoize (ashimema)
on 2021-09-24 15:29:37 UTC
(
hide
)
Description:
Bug 29078: Resolve division by zero in touch_all scripts
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-09-24 15:29:37 UTC
Size:
2.02 KB
patch
obsolete
>From 4a1cda3b0e82e066285337b50afd61e4749d0a59 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 22 Sep 2021 14:06:07 +0000 >Subject: [PATCH] Bug 29078: Resolve division by zero in touch_all scripts > >Illegal division by zero at misc/maintenance/touch_all_biblios.pl line 102. > >Trivial fix. >Funny that the percentage is not even shown without verbose flag ;) > >Test plan: >Run misc/maintenance/touch_all_biblios.pl -where 'biblionumber<0' >You should now see: >Good: 0, Bad: 0 (of 0) in 0 seconds > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > misc/maintenance/touch_all_biblios.pl | 2 +- > misc/maintenance/touch_all_items.pl | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/misc/maintenance/touch_all_biblios.pl b/misc/maintenance/touch_all_biblios.pl >index be349cfb193..2c725ae5e85 100755 >--- a/misc/maintenance/touch_all_biblios.pl >+++ b/misc/maintenance/touch_all_biblios.pl >@@ -101,7 +101,7 @@ close($fh); > # Benchmarking > my $endtime = time(); > my $time = $endtime-$startime; >-my $accuracy = ($goodcount / $totalcount) * 100; # this is a percentage >+my $accuracy = $totalcount ? ($goodcount / $totalcount) * 100 : 0; # this is a percentage > my $averagetime = 0; > $averagetime = $time / $totalcount if $totalcount; > print "Good: $goodcount, Bad: $badcount (of $totalcount) in $time seconds\n"; >diff --git a/misc/maintenance/touch_all_items.pl b/misc/maintenance/touch_all_items.pl >index 087914498ed..c253959959c 100755 >--- a/misc/maintenance/touch_all_items.pl >+++ b/misc/maintenance/touch_all_items.pl >@@ -109,7 +109,7 @@ close($fh); > # Benchmarking > my $endtime = time(); > my $time = $endtime-$startime; >-my $accuracy = ($goodcount / $totalcount) * 100; # this is a percentage >+my $accuracy = $totalcount ? ($goodcount / $totalcount) * 100 : 0; # this is a percentage > my $averagetime = 0; > $averagetime = $time / $totalcount if $totalcount; > print "Good: $goodcount, Bad: $badcount (of $totalcount) in $time seconds\n"; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29078
:
125133
| 125275