Package: cpio
Version: 2.9-13
Severity: important
Tags: patch
User: [EMAIL PROTECTED]
Usertags: origin-ubuntu intrepid ubuntu-patch
Hi,
In the unstable/testing version of cpio --owner doesn't accept user or
group names.
# cpio --owner root
cpio: root: invalid user
This bug was reported in Ubuntu at
https://bugs.launchpad.net/bugs/273259/
and the reporter, Jason Wessel, noted that the reason for this was that
the package compiles in a dummy version of getpwnam, as HAVE_GETPWNAM
is not defined during the build.
I found other instances where dummy functions would be used due
to mismatches between the code and the build system. The attached
patch is my proposed way of fixing this in the minimal way possible
for all the occurrences I could find.
I believe this is fixed in experimental, as upstream has changed
this area of the code, but it may be worth double checking that.
I would appreciate any suggested improvements for the patch,
and also checking that I did not miss any definitions that should be
added.
Thanks,
James
diff -u cpio-2.9/configure cpio-2.9/configure
--- cpio-2.9/configure
+++ cpio-2.9/configure
@@ -7585,7 +7585,7 @@
-for ac_func in fchmod fchown chown link symlink getuid geteuid setuid getgid setgid mknod pipe
+for ac_func in fchmod fchown chown link symlink getpwnam getgrnam getpwuid getgrgid getuid geteuid setuid getgid setgid mknod pipe fork
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
diff -u cpio-2.9/lib/system.c cpio-2.9/lib/system.c
--- cpio-2.9/lib/system.c
+++ cpio-2.9/lib/system.c
@@ -23,7 +23,7 @@
#include <unistd.h>
#include <errno.h>
-#ifndef HAVE_PWUID
+#ifndef HAVE_GETPWUID
struct passwd *
getpwuid (uid_t uid __attribute__ ((unused)))
{
diff -u cpio-2.9/configure.ac cpio-2.9/configure.ac
--- cpio-2.9/configure.ac
+++ cpio-2.9/configure.ac
@@ -47,7 +47,7 @@
AC_HEADER_STDC
AC_HEADER_DIRENT
-AC_CHECK_FUNCS([fchmod fchown chown link symlink getuid geteuid setuid getgid setgid mknod pipe])
+AC_CHECK_FUNCS([fchmod fchown chown link symlink getpwnam getgrnam getpwuid getgrgid getuid geteuid setuid getgid setgid mknod pipe fork])
# gnulib modules
gl_INIT
diff -u cpio-2.9/config.h.in cpio-2.9/config.h.in
--- cpio-2.9/config.h.in
+++ cpio-2.9/config.h.in
@@ -334,6 +334,9 @@
/* Define to 1 if you have the `flockfile' function. */
#undef HAVE_FLOCKFILE
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
/* Define to 1 if you have the `funlockfile' function. */
#undef HAVE_FUNLOCKFILE
@@ -352,6 +355,12 @@
/* Define to 1 if you have the `getgid' function. */
#undef HAVE_GETGID
+/* Define to 1 if you have the `getgrgid' function. */
+#undef HAVE_GETGRGID
+
+/* Define to 1 if you have the `getgrnam' function. */
+#undef HAVE_GETGRNAM
+
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
@@ -361,6 +370,12 @@
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
+/* Define to 1 if you have the `getpwnam' function. */
+#undef HAVE_GETPWNAM
+
+/* Define to 1 if you have the `getpwuid' function. */
+#undef HAVE_GETPWUID
+
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
diff -u cpio-2.9/debian/changelog cpio-2.9/debian/changelog
--- cpio-2.9/debian/changelog
+++ cpio-2.9/debian/changelog
@@ -1,3 +1,13 @@
+cpio (2.9-14) unstable; urgency=low
+
+ * Make sure that HAVE_GETPWNAM, HAVE_GETGRNAM, HAVE_GETPWUID and
+ HAVE_GETGRGID are defined so that the real functions are used, rather
+ than dummy ones. Having HAVE_GETPWNAM defined makes --owner work with
+ user and group names again.
+ - Also switch lib/system.h to use HAVE_GETPWUID instead of HAVE_PWUID.
+
+ -- James Westby <[EMAIL PROTECTED]> Fri, 26 Sep 2008 18:22:01 +0100
+
cpio (2.9-13) unstable; urgency=low
* Remove pre-sarge fixup from postinst, and remove preinst entirely.