[sharutils] Fix MD5 checksum generation on big-endian machines
Petr Pisar
ppisar at fedoraproject.org
Thu Jan 3 16:37:09 UTC 2013
commit 51e7ca94b9ac08d0534c0d0a200ca95f0c57783c
Author: Petr Písař <ppisar at redhat.com>
Date: Thu Jan 3 17:33:48 2013 +0100
Fix MD5 checksum generation on big-endian machines
....13.1-Fix-swapping-on-big-endian-machines.patch | 38 ++++++++++++++++++++
sharutils.spec | 8 ++++-
2 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/sharutils-4.13.1-Fix-swapping-on-big-endian-machines.patch b/sharutils-4.13.1-Fix-swapping-on-big-endian-machines.patch
new file mode 100644
index 0000000..b415cc9
--- /dev/null
+++ b/sharutils-4.13.1-Fix-swapping-on-big-endian-machines.patch
@@ -0,0 +1,38 @@
+From 069fbf819d748f6e433dca3e8eb3eb72b354cda0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Thu, 3 Jan 2013 17:20:55 +0100
+Subject: [PATCH] [sharutils] Fix swapping on big-endian machines
+
+4.13.1 release replaced SWAP() macro with function. However there were
+two bugs. First the function always retuned 0 because it ignored
+input argument. Second it indexed input array off-by-one. As
+result, shar-1 test failed on S390 or PPC.
+
+This patch fixes it.
+---
+ lib/md5.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/md5.c b/lib/md5.c
+index 076f6ef..6dea827 100644
+--- a/lib/md5.c
++++ b/lib/md5.c
+@@ -54,10 +54,11 @@ SWAP(md5_uint32 n)
+ md5_uint32 uiv;
+ } v, res;
+
+- res.cv[0] = v.cv[sizeof(md5_uint32) - 0];
+- res.cv[1] = v.cv[sizeof(md5_uint32) - 1];
+- res.cv[2] = v.cv[sizeof(md5_uint32) - 2];
+- res.cv[3] = v.cv[sizeof(md5_uint32) - 3];
++ v.uiv = n;
++ res.cv[0] = v.cv[sizeof(md5_uint32) - 1];
++ res.cv[1] = v.cv[sizeof(md5_uint32) - 2];
++ res.cv[2] = v.cv[sizeof(md5_uint32) - 3];
++ res.cv[3] = v.cv[sizeof(md5_uint32) - 4];
+ return res.uiv;
+ }
+
+--
+1.7.11.7
+
diff --git a/sharutils.spec b/sharutils.spec
index 539d30c..ddd0f0b 100644
--- a/sharutils.spec
+++ b/sharutils.spec
@@ -1,10 +1,12 @@
Summary: The GNU shar utilities for packaging and unpackaging shell archives
Name: sharutils
Version: 4.13.1
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv3+ and LGPLv2+ and Public Domain
Group: Applications/Archiving
Source: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.bz2
+# Regression in 4.13.1, reporterd to <bug-gnu-utils at gnu.org>
+Patch0: sharutils-4.13.1-Fix-swapping-on-big-endian-machines.patch
URL: http://www.gnu.org/software/%{name}/
BuildRequires: gettext
Requires(post): info
@@ -26,6 +28,7 @@ shar files.
%prep
%setup -q
+%patch0 -p1 -b .bigendian
# convert TODO, THANKS to UTF-8
for i in TODO THANKS; do
@@ -65,6 +68,9 @@ fi
%{_mandir}/man5/*
%changelog
+* Thu Jan 03 2013 Petr Pisar <ppisar at redhat.com> - 4.13.1-2
+- Fix MD5 checksum generation on big-endian machines
+
* Thu Jan 03 2013 Petr Pisar <ppisar at redhat.com> - 4.13.1-1
- 4.13.1 bump
More information about the scm-commits
mailing list