From e95f529da3bb99d6e773697b83d9eac8eb3bece8 Mon Sep 17 00:00:00 2001 From: Radek Brich Date: Feb 14 2008 14:10:51 +0000 Subject: related: #430835 --- diff --git a/cpio-2.9-dir_perm.patch b/cpio-2.9-dir_perm.patch new file mode 100644 index 0000000..3bb210d --- /dev/null +++ b/cpio-2.9-dir_perm.patch @@ -0,0 +1,101 @@ +diff -up cpio-2.9/src/extern.h.orig cpio-2.9/src/extern.h +--- cpio-2.9/src/extern.h.orig 2007-06-28 14:59:38.000000000 +0200 ++++ cpio-2.9/src/extern.h 2008-02-13 15:24:37.000000000 +0100 +@@ -211,7 +211,7 @@ uintmax_t from_ascii (char const *where, + + void delay_set_stat (char const *file_name, struct stat *st, + mode_t invert_permissions); +-void repair_delayed_set_stat (char const *dir, ++int repair_delayed_set_stat (char const *dir, + struct stat *dir_stat_info); + void apply_delayed_set_stat (void); + +diff -up cpio-2.9/src/copyin.c.orig cpio-2.9/src/copyin.c +--- cpio-2.9/src/copyin.c.orig 2007-06-28 12:51:09.000000000 +0200 ++++ cpio-2.9/src/copyin.c 2008-02-14 10:28:33.000000000 +0100 +@@ -570,6 +570,7 @@ static void + copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir) + { + int res; /* Result of various function calls. */ ++ struct stat file_stat; + #ifdef HPUX_CDF + int cdf_flag; /* True if file is a CDF. */ + int cdf_char; /* Index of `+' char indicating a CDF. */ +@@ -626,7 +627,6 @@ copyin_directory (struct cpio_file_stat + create_all_directories(), so the mkdir will fail + because the directory exists. If that's the case, + don't complain about it. */ +- struct stat file_stat; + if (errno != EEXIST) + { + mkdir_error (file_hdr->c_name); +@@ -645,7 +645,11 @@ copyin_directory (struct cpio_file_stat + } + } + +- set_perms (-1, file_hdr); ++ /* if the directory is queued for delayed_set_stat, ++ fix permissions in the queue, otherwise set the permissions now */ ++ cpio_to_stat(file_hdr, &file_stat); ++ if (repair_delayed_set_stat(file_hdr->c_name, &file_stat)) ++ set_perms (-1, file_hdr); + } + + static void +diff -up cpio-2.9/src/makepath.c.orig cpio-2.9/src/makepath.c +diff -up cpio-2.9/src/util.c.orig cpio-2.9/src/util.c +--- cpio-2.9/src/util.c.orig 2007-06-28 15:04:51.000000000 +0200 ++++ cpio-2.9/src/util.c 2008-02-14 13:24:37.000000000 +0100 +@@ -1265,6 +1265,16 @@ stat_to_cpio (struct cpio_file_stat *hdr + hdr->c_tar_linkname = NULL; + } + ++void ++cpio_to_stat (struct cpio_file_stat *hdr, struct stat *st) ++{ ++ stat (hdr->c_name, st); ++ st->st_mode = hdr->c_mode; ++ st->st_uid = CPIO_UID(hdr->c_uid); ++ st->st_gid = CPIO_GID(hdr->c_gid); ++ st->st_mtime = hdr->c_mtime; ++} ++ + #ifndef HAVE_FCHOWN + # define fchown(fd, uid, gid) (-1) + #endif +@@ -1389,7 +1399,7 @@ delay_set_stat (char const *file_name, s + created within the file name of DIR. The intermediate directory turned + out to be the same as this directory, e.g. due to ".." or symbolic + links. *DIR_STAT_INFO is the status of the directory. */ +-void ++int + repair_delayed_set_stat (char const *dir, + struct stat *dir_stat_info) + { +@@ -1400,22 +1410,19 @@ repair_delayed_set_stat (char const *dir + if (stat (data->stat.c_name, &st) != 0) + { + stat_error (data->stat.c_name); +- return; ++ return 0; + } + + if (st.st_dev == dir_stat_info->st_dev + && st.st_ino == dir_stat_info->st_ino) + { + stat_to_cpio (&data->stat, dir_stat_info); +- data->invert_permissions = +- ((dir_stat_info->st_mode ^ st.st_mode) +- & MODE_RWX & ~ newdir_umask); +- return; ++ data->invert_permissions = 0; ++ return 0; + } + } + +- ERROR ((0, 0, _("%s: Unexpected inconsistency when making directory"), +- quotearg_colon (dir))); ++ return -1; + } + + void diff --git a/cpio-2.9-gcc43.patch b/cpio-2.9-gcc43.patch new file mode 100644 index 0000000..b324f72 --- /dev/null +++ b/cpio-2.9-gcc43.patch @@ -0,0 +1,32 @@ +diff -up tar-1.19/lib/argp-fmtstream.h.gcc43 tar-1.19/lib/argp-fmtstream.h +--- tar-1.19/lib/argp-fmtstream.h.gcc43 2007-09-28 15:11:36.000000000 +0200 ++++ tar-1.19/lib/argp-fmtstream.h 2008-02-13 16:56:58.000000000 +0100 +@@ -198,7 +198,11 @@ extern int __argp_fmtstream_ensure (argp + #endif + + #ifndef ARGP_FS_EI +-#define ARGP_FS_EI extern inline ++# ifdef __GNUC_STDC_INLINE__ ++# define ARGP_FS_EI extern inline __attribute__((__gnu_inline__)) ++# else ++# define ARGP_FS_EI extern inline ++# endif + #endif + + ARGP_FS_EI size_t +diff -up tar-1.19/lib/argp.h.gcc43 tar-1.19/lib/argp.h +--- tar-1.19/lib/argp.h.gcc43 2007-09-28 15:11:36.000000000 +0200 ++++ tar-1.19/lib/argp.h 2008-02-13 16:55:36.000000000 +0100 +@@ -580,7 +580,11 @@ extern void *__argp_input (const struct + # endif + + # ifndef ARGP_EI +-# define ARGP_EI extern __inline__ ++# if defined __GNUC_STDC_INLINE__ ++# define ARGP_EI extern __inline__ __attribute__((__gnu_inline__)) ++# else ++# define ARGP_EI extern __inline__ ++# endif + # endif + + ARGP_EI void diff --git a/cpio.spec b/cpio.spec index f975e3c..9065646 100644 --- a/cpio.spec +++ b/cpio.spec @@ -3,7 +3,7 @@ Summary: A GNU archiving program Name: cpio Version: 2.9 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv3+ Group: Applications/Archiving URL: http://www.gnu.org/software/cpio/ @@ -14,6 +14,8 @@ Patch2: cpio-2.9-rh.patch Patch3: cpio-2.9-chmodRaceC.patch Patch4: cpio-2.9-exitCode.patch Patch5: cpio-2.9-safer_name_suffix.patch +Patch6: cpio-2.9-gcc43.patch +Patch7: cpio-2.9-dir_perm.patch Requires(post): /sbin/install-info Requires(preun): /sbin/install-info BuildRequires: texinfo, autoconf, gettext @@ -40,6 +42,8 @@ Install cpio if you need a program to manage file archives. %patch3 -p1 -b .chmodRaceC %patch4 -p1 -b .exitCode %patch5 -p1 -b .safer_name_suffix +%patch6 -p1 -b .gcc43 +%patch7 -p1 -b .dir_perm autoheader @@ -80,6 +84,11 @@ fi %{_infodir}/*.info* %changelog +* Thu Feb 14 2008 Radek Brich 2.9-6 +- when extracting archive created with 'find -depth', + restore the permissions of directories properly (bz#430835) +- fix for GCC 4.3 + * Thu Nov 01 2007 Radek Brich 2.9-5 - upstream patch for CVE-2007-4476 (stack crashing in safer_name_suffix)