[patchelf] Update to patchelf-0.6 and add patch to preseve acls/attributes

Jeremy Sanders jsanders at fedoraproject.org
Sat Dec 3 10:50:59 UTC 2011


commit dc756c86754c65c28b577e77e7adbb3df2eb6b9b
Author: Jeremy Sanders <jeremy at jeremysanders.net>
Date:   Sat Dec 3 10:49:59 2011 +0000

    Update to patchelf-0.6 and add patch to preseve acls/attributes

 .gitignore               |    1 +
 patchelf-copy-attr.patch |   53 ++++++++++++++++++++++++++++++++++++++
 patchelf.1               |   63 ----------------------------------------------
 patchelf.spec            |   25 ++++++++++--------
 sources                  |    2 +-
 5 files changed, 69 insertions(+), 75 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index bc82c67..5414d04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 patchelf-0.5.tar.bz2
+/patchelf-0.6.tar.gz
diff --git a/patchelf-copy-attr.patch b/patchelf-copy-attr.patch
new file mode 100644
index 0000000..7012c35
--- /dev/null
+++ b/patchelf-copy-attr.patch
@@ -0,0 +1,53 @@
+diff -ur patchelf-0.6-orig/configure.ac patchelf-0.6/configure.ac
+--- patchelf-0.6-orig/configure.ac	1970-01-01 01:00:01.000000000 +0100
++++ patchelf-0.6/configure.ac	2011-12-03 10:27:19.319837878 +0000
+@@ -5,5 +5,13 @@
+ AC_PROG_CC
+ AC_PROG_CXX
+ 
++AC_CHECK_HEADERS([attr/libattr.h attr/error_context.h])
++AC_SEARCH_LIBS(attr_copy_file, attr)
++AC_CHECK_FUNCS([attr_copy_file])
++
++AC_CHECK_HEADERS([sys/acl.h acl/libacl.h])
++AC_SEARCH_LIBS(perm_copy_file, acl)
++AC_CHECK_FUNCS([perm_copy_file])
++
+ AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
+ AC_OUTPUT
+diff -ur patchelf-0.6-orig/src/patchelf.cc patchelf-0.6/src/patchelf.cc
+--- patchelf-0.6-orig/src/patchelf.cc	1970-01-01 01:00:01.000000000 +0100
++++ patchelf-0.6/src/patchelf.cc	2011-12-03 10:36:46.550678791 +0000
+@@ -16,6 +16,16 @@
+ #include <fcntl.h>
+ #include <limits.h>
+ 
++#ifdef HAVE_ATTR_LIBATTR_H
++# include <attr/libattr.h>
++#endif
++#ifdef HAVE_SYS_ACL_H
++# include <sys/acl.h>
++#endif
++#ifdef HAVE_ACL_LIBACL_H
++# include <acl/libacl.h>
++#endif
++
+ #include "elf.h"
+ 
+ using namespace std;
+@@ -361,7 +371,14 @@
+     
+     if (close(fd) != 0) error("close");
+ 
++#if defined(HAVE_ATTR_COPY_FILE)
++    if (attr_copy_file(fileName.c_str(), fileName2.c_str(), 0, 0) != 0) error("attr_copy_file");
++#endif
++#if defined(HAVE_PERM_COPY_FILE)
++    if (perm_copy_file(fileName.c_str(), fileName2.c_str(), 0) != 0) error("perm_copy_file");
++#else
+     if (chmod(fileName2.c_str(), fileMode) != 0) error("chmod");
++#endif
+ 
+     if (rename(fileName2.c_str(), fileName.c_str()) != 0) error("rename");
+ }
+Only in patchelf-0.6/src: patchelf.cc~
diff --git a/patchelf.spec b/patchelf.spec
index c840eae..6ea2f79 100644
--- a/patchelf.spec
+++ b/patchelf.spec
@@ -1,26 +1,29 @@
 Name:           patchelf
-Version:        0.5
-Release:        9%{?dist}
+Version:        0.6
+Release:        1%{?dist}
 Summary:        A utility for patching ELF binaries
 
 Group:          Development/Tools
 License:        GPLv3+
 URL:            http://nixos.org/patchelf.html
-Source0:        http://hydra.nixos.org/build/114505/download/2/%{name}-%{version}.tar.bz2
-Source1:        patchelf.1
+Source0:        http://hydra.nixos.org/build/1524660/download/3/%{name}-%{version}.tar.gz
+Patch0:         patchelf-copy-attr.patch
 
 # make check does not work on these architectures: see bug #627370
 ExcludeArch:    ppc ppc64 sparc64 sparcv9
 
+BuildRequires:  autoconf automake libattr-devel libacl-devel
+
 BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 %description
-PatchELF is a simple utility for modifying existing ELF executables
-and libraries.  It can change the dynamic loader ("ELF interpreter")
-of executables and change the RPATH of executables and libraries.
+PatchELF is a simple utility for modifying an existing ELF executable
+or library.  It can change the dynamic loader ("ELF interpreter")
+of an executable and change the RPATH of an executable or library.
 
 %prep
 %setup -q
+%patch0 -p1 -b .copy-attr
 
 # package ships elf.h - delete to use glibc-headers one
 rm src/elf.h
@@ -40,10 +43,6 @@ make install DESTDIR=%{buildroot}
 # standard way in the docs section below
 rm -rf %{buildroot}/usr/share/doc/%{name}
 
-# install the man page
-mkdir -p %{buildroot}/%{_mandir}/man1
-install --mode=0644 %{SOURCE1} %{buildroot}/%{_mandir}/man1
-
 %clean
 rm -rf %{buildroot}
 
@@ -54,6 +53,10 @@ rm -rf %{buildroot}
 %doc README COPYING
 
 %changelog
+* Sat Dec  3 2011 Jeremy Sanders <jeremy at jeremysanders.net> - 0.6-1
+- Update to patchelf 0.6
+- Preserve ACLs and file based capabilities (fixes #665045)
+
 * Fri Apr  8 2011 Jeremy Sanders <jeremy at jeremysanders.net> - 0.5-9
 - Disable building on sparc64 and sparcv9 as self test fails
 
diff --git a/sources b/sources
index 2bafa54..467fd8e 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-c41fc98091d15dc93ba876c3ef11f43c  patchelf-0.5.tar.bz2
+d77b5e1e4850c8fbb4cbb29fe8f4e88d  patchelf-0.6.tar.gz


More information about the scm-commits mailing list