[tree] Keep file size field length constant regardless of whether SI units are used (bug #997937).

Tim Waugh twaugh at fedoraproject.org
Fri Aug 16 15:32:08 UTC 2013


commit 7c0afdfd6d3306d467044f4848565fb69409f365
Author: Tim Waugh <twaugh at redhat.com>
Date:   Fri Aug 16 16:10:52 2013 +0100

    Keep file size field length constant regardless of whether SI units are used (bug #997937).
    
    Resolves: rhbz#997937

 tree-size-field-len.patch |   13 +++++++++++++
 tree.spec                 |   11 ++++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/tree-size-field-len.patch b/tree-size-field-len.patch
new file mode 100644
index 0000000..72331cc
--- /dev/null
+++ b/tree-size-field-len.patch
@@ -0,0 +1,13 @@
+diff -up tree-1.6.0/tree.c.size-field-len tree-1.6.0/tree.c
+--- tree-1.6.0/tree.c.size-field-len	2013-08-16 16:06:00.993593417 +0100
++++ tree-1.6.0/tree.c	2013-08-16 16:09:05.153455440 +0100
+@@ -1106,7 +1106,7 @@ int psize(char *buf, off_t size)
+   if (hflag || siflag) {
+     for (idx=size<usize?0:1; size >= (usize*usize); idx++,size/=usize);
+-    if (!idx) return sprintf(buf, " %4d", (int)size);
+-    else return sprintf(buf, ((size/usize) >= 10)? " %3.0f%c" : " %3.1f%c" , (float)size/(float)usize,unit[idx]);
++    if (!idx) return sprintf(buf, " %5d", (int)size);
++    else return sprintf(buf, ((size/usize) >= 10)? " %4.0f%c" : " %4.1f%c" , (float)size/(float)usize,unit[idx]);
+   } else return sprintf(buf, sizeof(off_t) == sizeof(long long)? " %11lld" : " %9ld", size);
+ }
+ 
diff --git a/tree.spec b/tree.spec
index c399576..bb3db73 100644
--- a/tree.spec
+++ b/tree.spec
@@ -1,7 +1,7 @@
 Summary: File system tree viewer
 Name: tree
 Version: 1.6.0
-Release: 10%{?dist}
+Release: 11%{?dist}
 Group: Applications/File
 License: GPLv2+
 Url: http://mama.indstate.edu/users/ice/tree/
@@ -12,6 +12,7 @@ Patch3: tree-no-color-by-default.patch
 Patch4: tree-args.patch
 Patch5: tree-fixbufsiz.patch
 Patch6: tree-dircolors-ec.patch
+Patch7: tree-size-field-len.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 %description
@@ -39,6 +40,10 @@ utility.
 # Use correct default for dircolors "ec" field (bug #812934).
 %patch6 -p1 -b .dircolors-ec
 
+# Keep file size field length constant regardless of whether SI units
+# are used (bug #997937).
+%patch7 -p1 -b .size-field-len
+
 %build
 make CFLAGS="$RPM_OPT_FLAGS $(getconf LFS_CFLAGS)" %{?_smp_mflags}
 
@@ -62,6 +67,10 @@ rm -rf $RPM_BUILD_ROOT
 %doc README LICENSE
 
 %changelog
+* Fri Aug 16 2013 Tim Waugh <twaugh at redhat.com> - 1.6.0-11
+- Keep file size field length constant regardless of whether SI units
+  are used (bug #997937).
+
 * Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.6.0-10
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 


More information about the scm-commits mailing list