new upstream release 2.11, removed applied patches, run test suite

This commit is contained in:
Ondrej Vasik 2010-03-11 13:21:24 +00:00
parent cafa4c2707
commit 9aeb2ae9a5
8 changed files with 28 additions and 381 deletions

View File

@ -1,2 +1,2 @@
cpio-2.10.tar.bz2
cpio.1
cpio-2.11.tar.bz2

View File

@ -1,13 +0,0 @@
diff -urNp cpio-2.10-orig/lib/rtapelib.c cpio-2.10/lib/rtapelib.c
--- cpio-2.10-orig/lib/rtapelib.c 2010-03-10 14:41:41.000000000 +0100
+++ cpio-2.10/lib/rtapelib.c 2010-03-10 14:44:54.000000000 +0100
@@ -580,6 +580,9 @@ rmt_read__ (int handle, char *buffer, si
|| (status = get_status (handle)) == SAFE_READ_ERROR)
return SAFE_READ_ERROR;
+ if (status > length)
+ return SAFE_READ_ERROR;
+
for (counter = 0; counter < status; counter += rlen, buffer += rlen)
{
rlen = safe_read (READ_SIDE (handle), buffer, status - counter);

View File

@ -1,29 +0,0 @@
diff -urNp cpio-2.10-orig/gnu/utimens.c cpio-2.10/gnu/utimens.c
--- cpio-2.10-orig/gnu/utimens.c 2009-02-14 19:18:01.000000000 +0100
+++ cpio-2.10/gnu/utimens.c 2010-01-06 14:43:29.000000000 +0100
@@ -122,16 +122,17 @@ gl_futimens (int fd ATTRIBUTE_UNUSED,
}
#endif
#if HAVE_FUTIMENS
- {
- int result = futimens (fd, timespec);
+ if (0 <= fd)
+ {
+ int result = futimens (fd, timespec);
# ifdef __linux__
- /* Work around the same bug as above. */
- if (0 < result)
- errno = ENOSYS;
+ /* Work around the same bug as above. */
+ if (0 < result)
+ errno = ENOSYS;
# endif
- if (result == 0 || errno != ENOSYS)
- return result;
- }
+ if (result == 0 || errno != ENOSYS)
+ return result;
+ }
#endif
/* The platform lacks an interface to set file timestamps with

View File

@ -1,139 +0,0 @@
--- cpio-2.9/src/copypass.c.chmodRaceC 2007-06-28 14:10:01.000000000 +0200
+++ cpio-2.9/src/copypass.c 2007-07-19 10:43:26.000000000 +0200
@@ -239,15 +239,23 @@ process_copy_pass ()
cdf_flag = 1;
}
#endif
- res = mkdir (output_name.ds_string, in_file_stat.st_mode);
+ res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
}
else
- res = 0;
+ {
+ if (!no_chown_flag && (out_file_stat.st_mode & 077) != 0
+ && chmod (output_name.ds_string, out_file_stat.st_mode & 07700) < 0)
+ {
+ error (0, errno, "%s: chmod", output_name.ds_string);
+ continue;
+ }
+ res = 0;
+ }
if (res < 0 && create_dir_flag)
{
create_all_directories (output_name.ds_string);
- res = mkdir (output_name.ds_string, in_file_stat.st_mode);
+ res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
}
if (res < 0)
{
@@ -290,12 +298,12 @@ process_copy_pass ()
if (link_res < 0)
{
- res = mknod (output_name.ds_string, in_file_stat.st_mode,
+ res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
in_file_stat.st_rdev);
if (res < 0 && create_dir_flag)
{
create_all_directories (output_name.ds_string);
- res = mknod (output_name.ds_string, in_file_stat.st_mode,
+ res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
in_file_stat.st_rdev);
}
if (res < 0)
--- cpio-2.9/src/copyin.c.chmodRaceC 2007-06-28 12:51:09.000000000 +0200
+++ cpio-2.9/src/copyin.c 2007-07-19 10:37:50.000000000 +0200
@@ -186,11 +186,12 @@ list_file(struct cpio_file_stat* file_hd
static int
try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des,
- int *existing_dir)
+ int *existing_dir, mode_t *existing_mode)
{
struct stat file_stat;
*existing_dir = false;
+ *existing_mode = 0;
if (lstat (file_hdr->c_name, &file_stat) == 0)
{
if (S_ISDIR (file_stat.st_mode)
@@ -200,6 +201,7 @@ try_existing_file (struct cpio_file_stat
we are trying to create, don't complain about
it. */
*existing_dir = true;
+ *existing_mode = file_stat.st_mode;
return 0;
}
else if (!unconditional_flag
@@ -567,7 +569,7 @@ copyin_regular_file (struct cpio_file_st
}
static void
-copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir)
+copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir, mode_t existing_mode)
{
int res; /* Result of various function calls. */
#ifdef HPUX_CDF
@@ -610,14 +612,22 @@ copyin_directory (struct cpio_file_stat
cdf_flag = 1;
}
#endif
- res = mkdir (file_hdr->c_name, file_hdr->c_mode);
+ res = mkdir (file_hdr->c_name, file_hdr->c_mode & ~077);
}
else
- res = 0;
+ {
+ if (!no_chown_flag && (existing_mode & 077) != 0
+ && chmod (file_hdr->c_name, existing_mode & 07700) < 0)
+ {
+ error (0, errno, "%s: chmod", file_hdr->c_name);
+ return;
+ }
+ res = 0;
+ }
if (res < 0 && create_dir_flag)
{
create_all_directories (file_hdr->c_name);
- res = mkdir (file_hdr->c_name, file_hdr->c_mode);
+ res = mkdir (file_hdr->c_name, file_hdr->c_mode & ~077);
}
if (res < 0)
{
@@ -692,12 +702,12 @@ copyin_device (struct cpio_file_stat* fi
return;
}
- res = mknod (file_hdr->c_name, file_hdr->c_mode,
+ res = mknod (file_hdr->c_name, file_hdr->c_mode & ~077,
makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
if (res < 0 && create_dir_flag)
{
create_all_directories (file_hdr->c_name);
- res = mknod (file_hdr->c_name, file_hdr->c_mode,
+ res = mknod (file_hdr->c_name, file_hdr->c_mode & ~077,
makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
}
if (res < 0)
@@ -772,9 +782,10 @@ static void
copyin_file (struct cpio_file_stat* file_hdr, int in_file_des)
{
int existing_dir;
+ mode_t existing_mode;
if (!to_stdout_option
- && try_existing_file (file_hdr, in_file_des, &existing_dir) < 0)
+ && try_existing_file (file_hdr, in_file_des, &existing_dir, &existing_mode) < 0)
return;
/* Do the real copy or link. */
@@ -785,7 +796,7 @@ copyin_file (struct cpio_file_stat* file
break;
case CP_IFDIR:
- copyin_directory (file_hdr, existing_dir);
+ copyin_directory(file_hdr, existing_dir, existing_mode);
break;
case CP_IFCHR:

View File

@ -37,126 +37,9 @@ diff -up cpio-2.9/src/util.c.dir_perm cpio-2.9/src/util.c
free (dir);
}
diff -up cpio-2.9/src/copyin.c.dir_perm cpio-2.9/src/copyin.c
--- cpio-2.9/src/copyin.c.dir_perm 2008-03-03 11:45:00.000000000 +0100
+++ cpio-2.9/src/copyin.c 2008-03-03 11:45:00.000000000 +0100
@@ -186,12 +186,11 @@ list_file(struct cpio_file_stat* file_hd
static int
try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des,
- int *existing_dir, mode_t *existing_mode)
+ int *existing_dir)
{
struct stat file_stat;
*existing_dir = false;
- *existing_mode = 0;
if (lstat (file_hdr->c_name, &file_stat) == 0)
{
if (S_ISDIR (file_stat.st_mode)
@@ -201,7 +200,6 @@ try_existing_file (struct cpio_file_stat
we are trying to create, don't complain about
it. */
*existing_dir = true;
- *existing_mode = file_stat.st_mode;
return 0;
}
else if (!unconditional_flag
@@ -569,7 +567,7 @@ copyin_regular_file (struct cpio_file_st
}
static void
-copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir, mode_t existing_mode)
+copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir)
{
int res; /* Result of various function calls. */
#ifdef HPUX_CDF
@@ -612,22 +610,14 @@ copyin_directory (struct cpio_file_stat
cdf_flag = 1;
}
#endif
- res = mkdir (file_hdr->c_name, file_hdr->c_mode & ~077);
+ res = mkdir (file_hdr->c_name, file_hdr->c_mode);
}
else
- {
- if (!no_chown_flag && (existing_mode & 077) != 0
- && chmod (file_hdr->c_name, existing_mode & 07700) < 0)
- {
- error (0, errno, "%s: chmod", file_hdr->c_name);
- return;
- }
- res = 0;
- }
+ res = 0;
if (res < 0 && create_dir_flag)
{
create_all_directories (file_hdr->c_name);
- res = mkdir (file_hdr->c_name, file_hdr->c_mode & ~077);
+ res = mkdir (file_hdr->c_name, file_hdr->c_mode);
}
if (res < 0)
{
@@ -702,12 +692,12 @@ copyin_device (struct cpio_file_stat* fi
return;
}
- res = mknod (file_hdr->c_name, file_hdr->c_mode & ~077,
+ res = mknod (file_hdr->c_name, file_hdr->c_mode,
makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
if (res < 0 && create_dir_flag)
{
create_all_directories (file_hdr->c_name);
- res = mknod (file_hdr->c_name, file_hdr->c_mode & ~077,
+ res = mknod (file_hdr->c_name, file_hdr->c_mode,
makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min));
}
if (res < 0)
@@ -782,10 +772,9 @@ static void
copyin_file (struct cpio_file_stat* file_hdr, int in_file_des)
{
int existing_dir;
- mode_t existing_mode;
if (!to_stdout_option
- && try_existing_file (file_hdr, in_file_des, &existing_dir, &existing_mode) < 0)
+ && try_existing_file (file_hdr, in_file_des, &existing_dir) < 0)
return;
/* Do the real copy or link. */
@@ -796,7 +785,7 @@ copyin_file (struct cpio_file_stat* file
break;
case CP_IFDIR:
- copyin_directory(file_hdr, existing_dir, existing_mode);
+ copyin_directory (file_hdr, existing_dir);
break;
case CP_IFCHR:
@@ -1573,8 +1562,6 @@ process_copy_in ()
if (dot_flag)
fputc ('\n', stderr);
- apply_delayed_set_stat ();
-
if (append_flag)
return;
diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
--- cpio-2.9/src/makepath.c.dir_perm 2007-06-28 15:09:47.000000000 +0200
+++ cpio-2.9/src/makepath.c 2008-03-03 11:45:00.000000000 +0100
@@ -1,9 +1,9 @@
/* makepath.c -- Ensure that a directory path exists.
- Copyright (C) 1990, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1990, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
+ the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
@@ -29,15 +29,14 @@
#include <stdio.h>
#include <sys/types.h>
@ -396,57 +279,3 @@ diff -up cpio-2.9/src/makepath.c.dir_perm cpio-2.9/src/makepath.c
+ umask (oldmask);
return retval;
}
diff -up cpio-2.9/src/copypass.c.dir_perm cpio-2.9/src/copypass.c
--- cpio-2.9/src/copypass.c.dir_perm 2008-03-03 11:45:00.000000000 +0100
+++ cpio-2.9/src/copypass.c 2008-03-03 11:45:00.000000000 +0100
@@ -239,23 +239,15 @@ process_copy_pass ()
cdf_flag = 1;
}
#endif
- res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
+ res = mkdir (output_name.ds_string, in_file_stat.st_mode);
}
else
- {
- if (!no_chown_flag && (out_file_stat.st_mode & 077) != 0
- && chmod (output_name.ds_string, out_file_stat.st_mode & 07700) < 0)
- {
- error (0, errno, "%s: chmod", output_name.ds_string);
- continue;
- }
- res = 0;
- }
+ res = 0;
if (res < 0 && create_dir_flag)
{
create_all_directories (output_name.ds_string);
- res = mkdir (output_name.ds_string, in_file_stat.st_mode & ~077);
+ res = mkdir (output_name.ds_string, in_file_stat.st_mode);
}
if (res < 0)
{
@@ -298,12 +290,12 @@ process_copy_pass ()
if (link_res < 0)
{
- res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
+ res = mknod (output_name.ds_string, in_file_stat.st_mode,
in_file_stat.st_rdev);
if (res < 0 && create_dir_flag)
{
create_all_directories (output_name.ds_string);
- res = mknod (output_name.ds_string, in_file_stat.st_mode & ~077,
+ res = mknod (output_name.ds_string, in_file_stat.st_mode,
in_file_stat.st_rdev);
}
if (res < 0)
@@ -373,8 +365,6 @@ process_copy_pass ()
if (dot_flag)
fputc ('\n', stderr);
- apply_delayed_set_stat ();
-
if (!quiet_flag)
{
size_t blocks = (output_bytes + io_block_size - 1) / io_block_size;

View File

@ -1,10 +1,10 @@
diff -urp cpio-2.9.90-orig/src/extern.h cpio-2.9.90/src/extern.h
--- cpio-2.9.90-orig/src/extern.h 2008-08-25 16:42:48.000000000 +0200
+++ cpio-2.9.90/src/extern.h 2009-02-10 16:29:34.000000000 +0100
@@ -96,6 +96,7 @@ extern char output_is_special;
@@ -96,6 +96,7 @@ extern char input_is_special;
extern char output_is_special;
extern char input_is_seekable;
extern char output_is_seekable;
extern char *program_name;
+extern mode_t sys_umask;
extern int (*xstat) ();
extern void (*copy_function) ();

View File

@ -2,8 +2,8 @@
Summary: A GNU archiving program
Name: cpio
Version: 2.10
Release: 6%{?dist}
Version: 2.11
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/cpio/
@ -11,27 +11,20 @@ Source: ftp://ftp.gnu.org/gnu/cpio/cpio-%{version}.tar.bz2
Source1: cpio.1
#We use SVR4 portable format as default .
Patch1: cpio-2.9-rh.patch
#fix race condition (#155749)
Patch2: cpio-2.9-chmodRaceC.patch
#fix warn_if_file_changed() and set exit code to 1 when cpio
# fails to store file > 4GB (#183224)
Patch3: cpio-2.9-exitCode.patch
Patch2: cpio-2.9-exitCode.patch
#when extracting archive created with 'find -depth',
# restore the permissions of directories properly (bz#430835)
Patch4: cpio-2.9-dir_perm.patch
Patch3: cpio-2.9-dir_perm.patch
#Support major/minor device numbers over 127 (bz#450109)
Patch5: cpio-2.9-dev_number.patch
Patch4: cpio-2.9-dev_number.patch
#make -d honor system umask(#484997)
Patch6: cpio-2.9-sys_umask.patch
Patch5: cpio-2.9-sys_umask.patch
#define default remote shell as /usr/bin/ssh(#452904)
Patch7: cpio-2.9.90-defaultremoteshell.patch
#do not fail with new POSIX 2008 utimens() glibc call(#552320)
Patch8: cpio-2.10-utimens.patch
Patch6: cpio-2.9.90-defaultremoteshell.patch
#fix segfault with nonexisting file with patternnames(#567022)
Patch9: cpio-2.10-patternnamesigsegv.patch
# CVE-2010-0624 fix heap-based buffer overflow by expanding
# a specially-crafted archive(#572150)
Patch10: cpio-2.10-rtapeliboverflow.patch
Patch7: cpio-2.10-patternnamesigsegv.patch
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
BuildRequires: texinfo, autoconf, gettext, rmt
@ -53,16 +46,13 @@ Install cpio if you need a program to manage file archives.
%prep
%setup -q
%patch1 -p1 -b .rh
%patch2 -p1 -b .chmodRaceC
%patch3 -p1 -b .exitCode
%patch4 -p1 -b .dir_perm
%patch5 -p1 -b .dev_number
%patch6 -p1 -b .sys_umask
%patch7 -p1 -b .defaultremote
%patch8 -p1 -b .utimens
%patch9 -p1 -b .patternsegv
%patch10 -p1 -b .rtapelib
%patch1 -p1 -b .rh
%patch2 -p1 -b .exitCode
%patch3 -p1 -b .dir_perm
%patch4 -p1 -b .dev_number
%patch5 -p1 -b .sys_umask
%patch6 -p1 -b .defaultremote
%patch7 -p1 -b .patternsegv
autoheader
@ -87,6 +77,11 @@ install -c -p -m 0644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_mandir}/man1
%clean
rm -rf ${RPM_BUILD_ROOT}
%check
rm -f ${RPM_BUILD_ROOT}/test/testsuite
make check
%post
if [ -f %{_infodir}/cpio.info.gz ]; then
/sbin/install-info %{_infodir}/cpio.info.gz %{_infodir}/dir || :
@ -107,6 +102,10 @@ fi
%{_infodir}/*.info*
%changelog
* Thu Mar 11 2010 Ondrej Vasik <ovasik@redhat.com> 2.11-1
- new upstream release 2.11
- removed applied patches, run test suite
* Wed Mar 10 2010 Ondrej Vasik <ovasik@redhat.com> 2.10-6
- CVE-2010-0624 fix heap-based buffer overflow by expanding
a specially-crafted archive(#572150)

View File

@ -1,2 +1,2 @@
edd8d956a5dfb9a3b308fa07f302f691 cpio-2.10.tar.bz2
df0cc989cf5d0c65af7eaa5f0de88ac9 cpio.1
20fc912915c629e809f80b96b2e75d7d cpio-2.11.tar.bz2