Package: durep
Version: 0.9-3
Severity: normal
Tags: patch upstream
Dear Maintainer,
"durep -hs 1G" does not work as expected, though the documentation says
it should:
dev2.iserv.eu ~ # durep --help | grep hide-size
-hs, --hide-size=N[bkmg] do not display entries using N Bytes/Kb/Mb/Gb
For example in this folder, durep -hs 1G will list both bigfile (as expected)
but also smallfile:
dev2.iserv.eu ~/test # ll
total 1.1G
-rw-r--r-- 1 root root 1.0G Mar 7 10:46 bigfile
-rw-r--r-- 1 root root 1.0M Mar 7 10:46 smallfile
dev2.iserv.eu ~/test # durep -hs 1G .
[ /var/lib/iserv/remote-support/iserv-martin.von.wittich/test 1.0G (2
files, 0 dirs) ]
1.0G [############################# ] 99.90% bigfile
1.0M [ ] 0.10% smallfile
The cause is a bug in the processSizeOption function in the durep code. The
code to handle gigabyte sizes is there, but it is never reached:
if(defined $temp) {
if($temp =~ m/^[kK]/) {
return $size * 1024;
}
elsif ($temp =~ m/^[mM]/) {
return $size * 1048576;
}
elsif ($temp =~ m/^[mM]/) {
return $size * 1048576 * 1024;
}
return $size;
}
I've attached a patch that fixes this. The fixed durep behaves as expected:
dev2.iserv.eu ~/test # ~/durep.fixed -hs 1G .
[ /var/lib/iserv/remote-support/iserv-martin.von.wittich/test 1.0G (2
files, 0 dirs) ]
1.0G [############################# ] 99.90% bigfile
-- System Information:
Debian Release: 8.7
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (x86_64)
Foreign Architectures: amd64
Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages durep depends on:
ii debconf [debconf-2.0] 1.5.56
ii perl 5.20.2-3+deb8u6
Versions of packages durep recommends:
ii libmldbm-perl 2.05-1
durep suggests no packages.
-- debconf information:
durep/makereports: false
durep/filesystems: .
* durep/httpfileroot:
--- /usr/bin/durep 2014-08-02 11:19:05.000000000 +0200
+++ durep.fixed 2017-03-07 10:43:16.631568385 +0100
@@ -375,7 +375,7 @@
elsif ($temp =~ m/^[mM]/) {
return $size * 1048576;
}
- elsif ($temp =~ m/^[mM]/) {
+ elsif ($temp =~ m/^[gG]/) {
return $size * 1048576 * 1024;
}
return $size;