summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-06-01 23:04:32 +0000
committerMike Frysinger <vapier@gentoo.org>2008-06-01 23:04:32 +0000
commitdd7f2eda76ed1d1bb7713ca4e13aa7ec690bdd02 (patch)
tree1a952003cf5ce8c558073418e71ef894687e1950 /app-arch
parentmake xml2po FHS compliant, bug #190798. (diff)
downloadgentoo-2-dd7f2eda76ed1d1bb7713ca4e13aa7ec690bdd02.tar.gz
gentoo-2-dd7f2eda76ed1d1bb7713ca4e13aa7ec690bdd02.tar.bz2
gentoo-2-dd7f2eda76ed1d1bb7713ca4e13aa7ec690bdd02.zip
Add fix from upstream for restoring perms/owners properly #218040 by alexsaa.
(Portage version: 2.2_pre5.spank.spunk)
Diffstat (limited to 'app-arch')
-rw-r--r--app-arch/cpio/ChangeLog10
-rw-r--r--app-arch/cpio/cpio-2.9-r2.ebuild40
-rw-r--r--app-arch/cpio/files/cpio-2.9-restore-perms-owners.patch101
3 files changed, 149 insertions, 2 deletions
diff --git a/app-arch/cpio/ChangeLog b/app-arch/cpio/ChangeLog
index 44a8d2c52f08..f9ae1345c3c5 100644
--- a/app-arch/cpio/ChangeLog
+++ b/app-arch/cpio/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for app-arch/cpio
-# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-arch/cpio/ChangeLog,v 1.89 2007/11/18 02:43:01 vapier Exp $
+# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-arch/cpio/ChangeLog,v 1.90 2008/06/01 23:04:31 vapier Exp $
+
+*cpio-2.9-r2 (01 Jun 2008)
+
+ 01 Jun 2008; Mike Frysinger <vapier@gentoo.org>
+ +files/cpio-2.9-restore-perms-owners.patch, +cpio-2.9-r2.ebuild:
+ Add fix from upstream for restoring perms/owners properly #218040 by alexsaa.
18 Nov 2007; Mike Frysinger <vapier@gentoo.org>
+files/cpio-2.9-gnu-inline.patch, cpio-2.9-r1.ebuild:
diff --git a/app-arch/cpio/cpio-2.9-r2.ebuild b/app-arch/cpio/cpio-2.9-r2.ebuild
new file mode 100644
index 000000000000..40e203eb3a8c
--- /dev/null
+++ b/app-arch/cpio/cpio-2.9-r2.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-arch/cpio/cpio-2.9-r2.ebuild,v 1.1 2008/06/01 23:04:31 vapier Exp $
+
+inherit eutils
+
+DESCRIPTION="A file archival tool which can also read and write tar files"
+HOMEPAGE="http://www.gnu.org/software/cpio/cpio.html"
+SRC_URI="mirror://gnu/cpio/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE="nls"
+
+DEPEND=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-CVE-2007-4476.patch #196978
+ epatch "${FILESDIR}"/${P}-gnu-inline.patch #198817
+ epatch "${FILESDIR}"/${P}-restore-perms-owners.patch #218040
+}
+
+src_compile() {
+ econf \
+ $(use_enable nls) \
+ --bindir=/bin \
+ --with-rmt=/usr/sbin/rmt \
+ || die
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ dodoc ChangeLog NEWS README
+ rm -f "${D}"/usr/share/man/man1/mt.1
+ rmdir "${D}"/usr/libexec || die
+}
diff --git a/app-arch/cpio/files/cpio-2.9-restore-perms-owners.patch b/app-arch/cpio/files/cpio-2.9-restore-perms-owners.patch
new file mode 100644
index 000000000000..83e6351608db
--- /dev/null
+++ b/app-arch/cpio/files/cpio-2.9-restore-perms-owners.patch
@@ -0,0 +1,101 @@
+http://bugs.gentoo.org/218040
+
+fix from upstream to restore owners/perms in some situations
+
+--- cpio-2.9/src/extern.h
++++ cpio-2.9/src/extern.h
+@@ -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);
+
+--- cpio-2.9/src/copyin.c
++++ cpio-2.9/src/copyin.c
+@@ -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 */
++ void cpio_to_stat (struct cpio_file_stat *hdr, struct stat *st); 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
+--- cpio-2.9/src/util.c
++++ cpio-2.9/src/util.c
+@@ -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