commit 38f8004e9a2d1859972acc4076e2e7f942855580 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:35:51 2019 -0400 Package init diff --git a/Fix-out-of-bounds-read.patch b/Fix-out-of-bounds-read.patch new file mode 100644 index 0000000..1cbb88f --- /dev/null +++ b/Fix-out-of-bounds-read.patch @@ -0,0 +1,71 @@ +From 7d55037f89ab630125c37e6fc571cf36bb0a94c3 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Thu, 10 Nov 2016 12:48:19 +0200 +Subject: [PATCH 02/15] Fix out-of-bounds read + +* src/copyin.c (process_copy_in): Skip records with zero filename length. +--- + src/copyin.c | 41 +++++++++++++++++++++++------------------ + 1 file changed, 23 insertions(+), 18 deletions(-) + +diff --git a/src/copyin.c b/src/copyin.c +index cde911e..05279d2 100644 +--- a/src/copyin.c ++++ b/src/copyin.c +@@ -1378,30 +1378,35 @@ process_copy_in () + + } + #endif +- /* Is this the header for the TRAILER file? */ +- if (strcmp (CPIO_TRAILER_NAME, file_hdr.c_name) == 0) ++ if (file_hdr.c_namesize == 0) ++ skip_file = true; ++ else + { +- done = true; +- break; +- } ++ /* Is this the header for the TRAILER file? */ ++ if (strcmp (CPIO_TRAILER_NAME, file_hdr.c_name) == 0) ++ { ++ done = true; ++ break; ++ } + +- cpio_safer_name_suffix (file_hdr.c_name, false, !no_abs_paths_flag, +- false); ++ cpio_safer_name_suffix (file_hdr.c_name, false, !no_abs_paths_flag, ++ false); + +- /* Does the file name match one of the given patterns? */ +- if (num_patterns <= 0) +- skip_file = false; +- else +- { +- skip_file = copy_matching_files; +- for (i = 0; i < num_patterns +- && skip_file == copy_matching_files; i++) ++ /* Does the file name match one of the given patterns? */ ++ if (num_patterns <= 0) ++ skip_file = false; ++ else + { +- if (fnmatch (save_patterns[i], file_hdr.c_name, 0) == 0) +- skip_file = !copy_matching_files; ++ skip_file = copy_matching_files; ++ for (i = 0; i < num_patterns ++ && skip_file == copy_matching_files; i++) ++ { ++ if (fnmatch (save_patterns[i], file_hdr.c_name, 0) == 0) ++ skip_file = !copy_matching_files; ++ } + } + } +- ++ + if (skip_file) + { + /* If we're skipping a file with links, there might be other +-- +1.8.3.1 + diff --git a/Fix-signed-integer-overflow-big-block-sizes.patch b/Fix-signed-integer-overflow-big-block-sizes.patch new file mode 100644 index 0000000..dcf595c --- /dev/null +++ b/Fix-signed-integer-overflow-big-block-sizes.patch @@ -0,0 +1,25 @@ +From 404600ebb4d417238bfabf7ec1561a62dc83c168 Mon Sep 17 00:00:00 2001 +From: grajagandev +Date: Mon, 8 Feb 2016 07:58:45 -0800 +Subject: [PATCH 04/15] Fix signed integer overflow - big block sizes + +--- + src/main.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/main.c b/src/main.c +index a13861f..5a30a7b 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -321,7 +321,7 @@ parse_opt (int key, char *arg, struct argp_state *state) + + case BLOCK_SIZE_OPTION: /* --block-size */ + io_block_size = atoi (arg); +- if (io_block_size < 1) ++ if (io_block_size < 1 || io_block_size > INT_MAX/512) + USAGE_ERROR ((0, 0, _("invalid block size"))); + io_block_size *= 512; + break; +-- +1.8.3.1 + diff --git a/cpio-2.10-longnames-split.patch b/cpio-2.10-longnames-split.patch new file mode 100644 index 0000000..6f4ba6e --- /dev/null +++ b/cpio-2.10-longnames-split.patch @@ -0,0 +1,27 @@ +From: Pavel Raiskup +Date: Mon, 14 Sep 2015 09:49:12 +0200 +Subject: [PATCH 6/7] Fix for splitting long file names while creating ustar + archive + +Resolves: #866467 + +diff --git a/src/tar.c b/src/tar.c +index a2ce171..e2b5f45 100644 +--- a/src/tar.c ++++ b/src/tar.c +@@ -49,10 +49,12 @@ split_long_name (const char *name, size_t length) + { + size_t i; + +- if (length > TARPREFIXSIZE) +- length = TARPREFIXSIZE+2; ++ if (length > TARPREFIXSIZE + 1) ++ length = TARPREFIXSIZE + 1; ++ else if (ISSLASH (name[length - 1])) ++ length--; + for (i = length - 1; i > 0; i--) +- if (name[i] == '/') ++ if (ISSLASH (name[i])) + break; + return i; + } diff --git a/cpio-2.10-patternnamesigsegv.patch b/cpio-2.10-patternnamesigsegv.patch new file mode 100644 index 0000000..27e3742 --- /dev/null +++ b/cpio-2.10-patternnamesigsegv.patch @@ -0,0 +1,49 @@ +From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= +Date: Mon, 14 Sep 2015 09:47:05 +0200 +Subject: [PATCH 5/7] fix segfault with nonexisting file with patternnames + (#567022) + +diff --git a/src/copyin.c b/src/copyin.c +index 12bd27c..183b5b5 100644 +--- a/src/copyin.c ++++ b/src/copyin.c +@@ -870,21 +870,24 @@ read_pattern_file () + + pattern_fp = fopen (pattern_file_name, "r"); + if (pattern_fp == NULL) +- open_fatal (pattern_file_name); +- while (ds_fgetstr (pattern_fp, &pattern_name, '\n') != NULL) +- { +- if (new_num_patterns >= max_new_patterns) +- { +- max_new_patterns += 1; +- new_save_patterns = (char **) +- xrealloc ((char *) new_save_patterns, +- max_new_patterns * sizeof (char *)); +- } +- new_save_patterns[new_num_patterns] = xstrdup (pattern_name.ds_string); +- ++new_num_patterns; +- } +- if (ferror (pattern_fp) || fclose (pattern_fp) == EOF) +- close_error (pattern_file_name); ++ open_error (pattern_file_name); ++ else ++ { ++ while (ds_fgetstr (pattern_fp, &pattern_name, '\n') != NULL) ++ { ++ if (new_num_patterns >= max_new_patterns) ++ { ++ max_new_patterns += 1; ++ new_save_patterns = (char **) ++ xrealloc ((char *) new_save_patterns, ++ max_new_patterns * sizeof (char *)); ++ } ++ new_save_patterns[new_num_patterns] = xstrdup (pattern_name.ds_string); ++ ++new_num_patterns; ++ } ++ if (ferror (pattern_fp) || fclose (pattern_fp) == EOF) ++ close_error (pattern_file_name); ++ } + + for (i = 0; i < num_patterns; ++i) + new_save_patterns[i] = save_patterns[i]; diff --git a/cpio-2.11-crc-fips-nit.patch b/cpio-2.11-crc-fips-nit.patch new file mode 100644 index 0000000..bd447b5 --- /dev/null +++ b/cpio-2.11-crc-fips-nit.patch @@ -0,0 +1,19 @@ +From: Pavel Raiskup +Date: Mon, 14 Sep 2015 09:51:12 +0200 +Subject: [PATCH 7/7] Note that cpio uses Sum32 checksum only + +Related to Package Wrangler and FIPS check. + +diff --git a/src/main.c b/src/main.c +index a875a13..13cdfcf 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -167,7 +167,7 @@ static struct argp_option options[] = { + {"pattern-file", 'E', N_("FILE"), 0, + N_("Read additional patterns specifying filenames to extract or list from FILE"), 210}, + {"only-verify-crc", ONLY_VERIFY_CRC_OPTION, 0, 0, +- N_("When reading a CRC format archive, only verify the CRC's of each file in the archive, don't actually extract the files"), 210}, ++ N_("When reading a CRC format archive, only verify the checksum of each file in the archive, don't actually extract the files"), 210}, + {"rename", 'r', 0, 0, + N_("Interactively rename files"), GRID+1 }, + {"rename-batch-file", RENAME_BATCH_FILE_OPTION, N_("FILE"), OPTION_HIDDEN, diff --git a/cpio-2.12.tar.bz2 b/cpio-2.12.tar.bz2 new file mode 100644 index 0000000..80bda2b Binary files /dev/null and b/cpio-2.12.tar.bz2 differ diff --git a/cpio-2.9-dev_number.patch b/cpio-2.9-dev_number.patch new file mode 100644 index 0000000..cf6d242 --- /dev/null +++ b/cpio-2.9-dev_number.patch @@ -0,0 +1,28 @@ +From: Kamil Dudka +Date: Mon, 14 Sep 2015 09:37:15 +0200 +Subject: [PATCH 3/7] Support major/minor device numbers over 127 (bz#450109) + +diff --git a/src/copyin.c b/src/copyin.c +index cde911e..12bd27c 100644 +--- a/src/copyin.c ++++ b/src/copyin.c +@@ -1196,15 +1196,15 @@ read_in_binary (struct cpio_file_stat *file_hdr, + swab_array ((char *) short_hdr, 13); + } + +- file_hdr->c_dev_maj = major (short_hdr->c_dev); +- file_hdr->c_dev_min = minor (short_hdr->c_dev); ++ file_hdr->c_dev_maj = major ((unsigned short)short_hdr->c_dev); ++ file_hdr->c_dev_min = minor ((unsigned short)short_hdr->c_dev); + file_hdr->c_ino = short_hdr->c_ino; + file_hdr->c_mode = short_hdr->c_mode; + file_hdr->c_uid = short_hdr->c_uid; + file_hdr->c_gid = short_hdr->c_gid; + file_hdr->c_nlink = short_hdr->c_nlink; +- file_hdr->c_rdev_maj = major (short_hdr->c_rdev); +- file_hdr->c_rdev_min = minor (short_hdr->c_rdev); ++ file_hdr->c_rdev_maj = major ((unsigned short)short_hdr->c_rdev); ++ file_hdr->c_rdev_min = minor ((unsigned short)short_hdr->c_rdev); + file_hdr->c_mtime = (unsigned long) short_hdr->c_mtimes[0] << 16 + | short_hdr->c_mtimes[1]; + diff --git a/cpio-2.9-exitCode.patch b/cpio-2.9-exitCode.patch new file mode 100644 index 0000000..e4a4781 --- /dev/null +++ b/cpio-2.9-exitCode.patch @@ -0,0 +1,18 @@ +From: Peter Vrabec +Date: Mon, 14 Sep 2015 09:31:08 +0200 +Subject: [PATCH 2/7] set exit code to 1 when cpio fails to store file > 4GB + (#183224) + +diff --git a/src/copyout.c b/src/copyout.c +index 1f0987a..dcae449 100644 +--- a/src/copyout.c ++++ b/src/copyout.c +@@ -287,7 +287,7 @@ to_ascii (char *where, uintmax_t v, size_t digits, unsigned logbase) + static void + field_width_error (const char *filename, const char *fieldname) + { +- error (0, 0, _("%s: field width not sufficient for storing %s"), ++ error (1, 0, _("%s: field width not sufficient for storing %s"), + filename, fieldname); + } + diff --git a/cpio-2.9-rh.patch b/cpio-2.9-rh.patch new file mode 100644 index 0000000..23d70db --- /dev/null +++ b/cpio-2.9-rh.patch @@ -0,0 +1,69 @@ +From: Pavel Raiskup +Date: Mon, 14 Sep 2015 09:27:21 +0200 +Subject: [PATCH 1/7] make '-c' equivalent to '-H newc' + +diff --git a/doc/cpio.texi b/doc/cpio.texi +index e631934..a788b5d 100644 +--- a/doc/cpio.texi ++++ b/doc/cpio.texi +@@ -261,7 +261,8 @@ Sets the I/O block size to @var{block-size} * 512 bytes. + @item -B + Set the I/O block size to 5120 bytes. + @item -c +-Use the old portable (ASCII) archive format. ++Identical to "-H newc", use the new (SVR4) portable format. If you wish the old ++portable (ASCII) archive format, use "-H odc" instead. + @item -C @var{number} + @itemx --io-size=@var{number} + Set the I/O block size to the given @var{number} of bytes. +@@ -343,7 +344,8 @@ Equivalent to @option{-sS}. + @item -B + Set the I/O block size to 5120 bytes. + @item -c +-Use the old portable (ASCII) archive format. ++Identical to "-H newc", use the new (SVR4) portable format. If you wish the old ++portable (ASCII) archive format, use "-H odc" instead. + @item -C @var{number} + @itemx --io-size=@var{number} + Set the I/O block size to the given @var{number} of bytes. +@@ -454,7 +456,8 @@ Sets the I/O block size to @var{block-size} * 512 bytes. + @item -B + Set the I/O block size to 5120 bytes. + @item -c +-Use the old portable (ASCII) archive format. ++Identical to "-H newc", use the new (SVR4) portable format. If you wish the old ++portable (ASCII) archive format, use "-H odc" instead. + @item -C @var{number} + @itemx --io-size=@var{number} + Set the I/O block size to the given @var{number} of bytes. +@@ -600,7 +603,8 @@ block size is 512 bytes. + + @item -c + [@ref{copy-in},@ref{copy-out},@ref{copy-pass}] +-@*Use the old portable (ASCII) archive format. ++@*Identical to "-H newc", use the new (SVR4) portable format. If you wish the ++old portable (ASCII) archive format, use "-H odc" instead. + + @item -C @var{io-size} + @itemx --io-size=@var{io-size} +diff --git a/src/main.c b/src/main.c +index a13861f..a875a13 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -124,7 +124,7 @@ static struct argp_option options[] = { + {"block-size", BLOCK_SIZE_OPTION, N_("BLOCK-SIZE"), 0, + N_("Set the I/O block size to BLOCK-SIZE * 512 bytes"), GRID+1 }, + {NULL, 'c', NULL, 0, +- N_("Use the old portable (ASCII) archive format"), GRID+1 }, ++ N_("Identical to \"-H newc\", use the new (SVR4) portable format. If you wish the old portable (ASCII) archive format, use \"-H odc\" instead."), GRID+1 }, + {"dot", 'V', NULL, 0, + N_("Print a \".\" for each file processed"), GRID+1 }, + {"io-size", 'C', N_("NUMBER"), 0, +@@ -329,6 +329,7 @@ parse_opt (int key, char *arg, struct argp_state *state) + case 'c': /* Use the old portable ASCII format. */ + if (archive_format != arf_unknown) + USAGE_ERROR ((0, 0, _("Archive format multiply defined"))); ++#define SVR4_COMPAT + #ifdef SVR4_COMPAT + archive_format = arf_newascii; /* -H newc. */ + #else diff --git a/cpio-2.9.90-defaultremoteshell.patch b/cpio-2.9.90-defaultremoteshell.patch new file mode 100644 index 0000000..01dbd5d --- /dev/null +++ b/cpio-2.9.90-defaultremoteshell.patch @@ -0,0 +1,20 @@ +From: =?UTF-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= +Date: Mon, 14 Sep 2015 09:39:13 +0200 +Subject: [PATCH 4/7] define default remote shell as /usr/bin/ssh(#452904), use + /etc/rmt as default rmt command + +diff --git a/lib/rtapelib.c b/lib/rtapelib.c +index 7213031..7d0bd52 100644 +--- a/lib/rtapelib.c ++++ b/lib/rtapelib.c +@@ -59,6 +59,10 @@ + # include + #endif + ++#ifndef REMOTE_SHELL ++# define REMOTE_SHELL "/usr/bin/ssh" ++#endif ++ + #include + #include + diff --git a/cpio.spec b/cpio.spec new file mode 100644 index 0000000..4dccb70 --- /dev/null +++ b/cpio.spec @@ -0,0 +1,88 @@ +Name: cpio +Version: 2.12 +Release: 13 +Summary: A GNU archiving program + +License: GPLv3+ +URL: https://www.gnu.org/software/cpio +Source0: https://ftp.gnu.org/gnu/cpio/%{name}-%{version}.tar.bz2 + +Patch0: cpio-2.9-rh.patch +Patch1: cpio-2.9-exitCode.patch +Patch2: cpio-2.9-dev_number.patch +Patch3: cpio-2.9.90-defaultremoteshell.patch +Patch4: cpio-2.10-patternnamesigsegv.patch +Patch5: cpio-2.10-longnames-split.patch +Patch6: cpio-2.11-crc-fips-nit.patch +Patch6000: Fix-out-of-bounds-read.patch +Patch6001: Fix-signed-integer-overflow-big-block-sizes.patch + +Provides: bundled(gnulib) +Provides: /bin/cpio +BuildRequires: gcc texinfo gettext gettext-devel rmt + +%description +GNU cpio copies files into or out of a cpio or tar archive. +The archive can be another file on the disk, a magnetic +tape, or a pipe. + +%package_help + +%prep +%autosetup -n %{name}-%{version} -p1 + +%build +%configure +%make_build + +%install +rm -rf %RPM_BUILD_ROOT +%make_install +rm -rf %{buildroot}/usr/share/man/man8* +rm -rf %{buildroot}/usr/libexec/ +rm -rf %{buildroot}/usr/share/info/dir + +%check +make check + +%files +%defattr(-,root,root) +%doc AUTHORS ChangeLog README +%license COPYING +%{_bindir}/%{name}* +%{_datadir}/info/*.info* +%{_datadir}/locale/*/LC_MESSAGES/cpio.mo + +%files help +%doc NEWS TODO THANKS +%{_datadir}/man/man1/%{name}.1.gz + +%changelog +* Tue Sep 24 2019 shenyangyang - 2.12-13 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:add help package + +* Tue Aug 27 2019 openEuler Builteam - 2.12-12 +- Type:NA +- ID:NA +- SUG:NA +- DESC: Rewrite Spec File + +* Thu Mar 21 2019 Zhipeng Xie - 2.12-11 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:modify patch name + +* Fri Mar 15 2019 zhangyujing - 2.12-10 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Fix out of bounds read + Fix signed integer overflow big block sizes + +* Thu Jul 12 2018 openEuler Builteam - 2.12-9 +- Package Initialization +