[samefile] Fix a couple of long-casts and %ld usage for off_t, so file sizes

Michael Schwendt mschwendt at fedoraproject.org
Fri Feb 22 12:29:56 UTC 2013


commit 6030fd3f5906a535cc9d71991b24af63118b85b5
Author: Michael Schwendt <mschwendt at fedoraproject.org>
Date:   Fri Feb 22 13:29:51 2013 +0100

    Fix a couple of long-casts and %ld usage for off_t, so file sizes
    
      are printed correctly, for example.

 samefile-2.13-longlong.patch |   41 +++++++++++++++++++++++++++++++++++++++++
 samefile.spec                |   10 +++++++++-
 2 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/samefile-2.13-longlong.patch b/samefile-2.13-longlong.patch
new file mode 100644
index 0000000..21e2c72
--- /dev/null
+++ b/samefile-2.13-longlong.patch
@@ -0,0 +1,41 @@
+diff -Nur samefile-2.13-orig/samefile.c samefile-2.13/samefile.c
+--- samefile-2.13-orig/samefile.c	2009-03-03 02:13:00.000000000 +0100
++++ samefile-2.13/samefile.c	2013-02-22 13:25:16.965865885 +0100
+@@ -340,8 +340,8 @@
+ 		cfprintf (stderr, "%ld input filename%s.\n",
+ 		plural ((long)input_filenames));
+ 		cfprintf (stderr,
+-		"%ld regular file%s left with size > %ld byte%s.\n",
+-		plural ((long)tree_filenames), plural ((long)minsize));
++		"%ld regular file%s left with size > %lld byte%s.\n",
++		plural ((long)tree_filenames), plural ((long long)minsize));
+ 	}
+ 	if (tree_filenames == 0) {
+ 		err_quit ("no files left");
+@@ -429,7 +429,7 @@
+ 			if (s->st_dev == e->dev && s->st_ino == e->ino) {
+ 				/* yes: want a report? */
+ 				if (links == REPORT) {
+-					cfprintf (stdout, "%ld%s%s%s%s%s[%ld]\n", (long)s->st_size,
++					cfprintf (stdout, "%lld%s%s%s%s%s[%ld]\n", (long long)s->st_size,
+ 					sep, e->name, sep, fname, sep, (long)s->st_nlink);
+ 				}
+ 				/*
+@@ -576,7 +576,7 @@
+ 			flags |= DONT_ALPHASORT;
+ 		break;
+ 		case 'g':
+-			if (sscanf (opt_arg, "%ld", (long *)&minsize) != 1) {
++			if (sscanf (opt_arg, "%lld", (long long *)&minsize) != 1) {
+ 				err_msg ("warning: can't convert -g %s, using -g 0 instead",
+ 				opt_arg);
+ 				minsize = 0;
+@@ -679,7 +679,7 @@
+                 continue;
+ 			switch (compare (filelist[i], filelist[j], &si, &sj)) {
+ 			case 0: /* files are equal */
+-				cfprintf (stdout, "%ld%s%s%s%s", (long)size,
++				cfprintf (stdout, "%lld%s%s%s%s", (long long)size,
+ 				    sep, filelist[i], sep, filelist[j]);
+ 				cfprintf (stdout, "%s%c%s%ld%s%ld\n", sep,
+ 				    si.st_dev == sj.st_dev ? '=' : 'X', sep,
diff --git a/samefile.spec b/samefile.spec
index e4bb319..5feb444 100644
--- a/samefile.spec
+++ b/samefile.spec
@@ -1,6 +1,6 @@
 Name:		samefile
 Version:	2.13
-Release:	4%{?dist}
+Release:	5%{?dist}
 Summary:	Command-line utility to find identical files on the file system
 
 Group:		Applications/System
@@ -8,6 +8,9 @@ License:	BSD
 URL:		http://www.schweikhardt.net/samefile/
 Source0:	http://www.schweikhardt.net/%{name}-%{version}.tar.gz
 
+# reported
+Patch0: samefile-2.13-longlong.patch
+
 %description
 The samefile utility finds files with identical contents, independent of file 
 name. This program is for you if you are notoriously low on disk space, keep 
@@ -18,6 +21,7 @@ a feeling for how much redundant files are there on your system.
 
 %prep
 %setup -q
+%patch0 -p1 -b .long
 
 
 %build
@@ -42,6 +46,10 @@ make test
 
 
 %changelog
+* Fri Feb 22 2013 Michael Schwendt <mschwendt at fedoraproject.org> - 2.13-5
+- Fix a couple of long-casts and %ld usage for off_t, so file sizes
+  are printed correctly, for example.
+
 * Wed Feb 20 2013 Michael Schwendt <mschwendt at fedoraproject.org> - 2.13-4
 - Build with -D_FILE_OFFSET_BITS=64 for LFS as well as stat64 usage.
 - Minor spec cleanup for modern guidelines.


More information about the scm-commits mailing list