From 4689c77dc92cab339bc9bb107b3ea29bd52b4278 Mon Sep 17 00:00:00 2001 From: jmtd Date: Wed, 6 Sep 2023 09:44:48 -0400 Subject: [PATCH] uninitialized value warning with attachment plugin --- ...out_division_with_uninitialized_value.mdwn | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 doc/bugs/filecheck.pm:_warnings_about_division_with_uninitialized_value.mdwn diff --git a/doc/bugs/filecheck.pm:_warnings_about_division_with_uninitialized_value.mdwn b/doc/bugs/filecheck.pm:_warnings_about_division_with_uninitialized_value.mdwn new file mode 100644 index 000000000..dff77a00d --- /dev/null +++ b/doc/bugs/filecheck.pm:_warnings_about_division_with_uninitialized_value.mdwn @@ -0,0 +1,20 @@ +If you enable [[plugins/filecheck]] *and* [[plugins/attachment]], then IkiWiki (e.g. via wrapper) will throw a lot of the following errors on stderr + + Use of uninitialized value $size in division (/) at /.../filecheck.pm line 73. + +73 is + +``` +sub humansize ($) { + my $size=shift; + + foreach my $unit (reverse sort { $units{$a} <=> $units{$b} || $b cmp $a } keys %units) { + if ($size / $units{$unit} > 0.25) { + return (int($size / $units{$unit} * 10)/10).$unit; + } + } + return $size; # near zero, or negative +} +``` + +Disabling *attachment* is sufficient to stop this. *— [[Jon]] 2023-09-06*