Accepting request 337422 from Archiving

1

OBS-URL: https://build.opensuse.org/request/show/337422
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cpio?expand=0&rev=51
This commit is contained in:
Dominique Leuenberger 2015-10-14 14:34:57 +00:00 committed by Git OBS Bridge
commit 56b2fe7b31
14 changed files with 249 additions and 436 deletions

View File

@ -1,234 +0,0 @@
From 746f3ff670dcfcdd28fcc990e79cd6fccc7ae48d Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org.ua>
Date: Mon, 1 Dec 2014 15:15:28 +0200
Subject: [PATCH] Fix memory overrun on reading improperly created link
records.
See http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
* src/copyin.c (get_link_name): New function.
(list_file, copyin_link): use get_link_name
* tests/symlink-bad-length.at: New file.
* tests/symlink-long.at: New file.
* tests/Makefile.am: Add new files.
* tests/testsuite.at: Likewise.
---
src/copyin.c | 50 ++++++++++++++++++++++++++++-----------------
tests/Makefile.am | 2 ++
tests/symlink-bad-length.at | 49 ++++++++++++++++++++++++++++++++++++++++++++
tests/symlink-long.at | 46 +++++++++++++++++++++++++++++++++++++++++
tests/testsuite.at | 2 ++
5 files changed, 130 insertions(+), 19 deletions(-)
create mode 100644 tests/symlink-bad-length.at
create mode 100644 tests/symlink-long.at
Index: cpio-2.11/src/copyin.c
===================================================================
--- cpio-2.11.orig/src/copyin.c 2014-12-01 16:59:33.863928107 +0100
+++ cpio-2.11/src/copyin.c 2014-12-01 16:59:35.339946156 +0100
@@ -124,10 +124,30 @@ tape_skip_padding (int in_file_des, off_
if (pad != 0)
tape_toss_input (in_file_des, pad);
}
+
+static char *
+get_link_name (struct cpio_file_stat *file_hdr, int in_file_des)
+{
+ off_t n = file_hdr->c_filesize + 1;
+ char *link_name;
+ if (n == 0 || n > SIZE_MAX)
+ {
+ error (0, 0, _("%s: stored filename length too big"), file_hdr->c_name);
+ link_name = NULL;
+ }
+ else
+ {
+ link_name = xmalloc (n);
+ tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
+ link_name[file_hdr->c_filesize] = '\0';
+ tape_skip_padding (in_file_des, file_hdr->c_filesize);
+ }
+ return link_name;
+}
static void
-list_file(struct cpio_file_stat* file_hdr, int in_file_des)
+list_file (struct cpio_file_stat* file_hdr, int in_file_des)
{
if (verbose_flag)
{
@@ -136,21 +156,16 @@ list_file(struct cpio_file_stat* file_hd
{
if (archive_format != arf_tar && archive_format != arf_ustar)
{
- char *link_name = NULL; /* Name of hard and symbolic links. */
-
- link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
- link_name[file_hdr->c_filesize] = '\0';
- tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
- long_format (file_hdr, link_name);
- free (link_name);
- tape_skip_padding (in_file_des, file_hdr->c_filesize);
- return;
+ char *link_name = get_link_name (file_hdr, in_file_des);
+ if (link_name)
+ {
+ long_format (file_hdr, link_name);
+ free (link_name);
+ }
}
else
- {
- long_format (file_hdr, file_hdr->c_tar_linkname);
- return;
- }
+ long_format (file_hdr, file_hdr->c_tar_linkname);
+ return;
}
else
#endif
@@ -650,10 +665,7 @@ copyin_link(struct cpio_file_stat *file_
if (archive_format != arf_tar && archive_format != arf_ustar)
{
- link_name = (char *) xmalloc ((unsigned int) file_hdr->c_filesize + 1);
- link_name[file_hdr->c_filesize] = '\0';
- tape_buffered_read (link_name, in_file_des, file_hdr->c_filesize);
- tape_skip_padding (in_file_des, file_hdr->c_filesize);
+ link_name = get_link_name (file_hdr, in_file_des);
}
else
{
Index: cpio-2.11/tests/Makefile.am
===================================================================
--- cpio-2.11.orig/tests/Makefile.am 2014-12-01 16:59:35.339946156 +0100
+++ cpio-2.11/tests/Makefile.am 2014-12-01 17:00:02.491278156 +0100
@@ -52,6 +52,8 @@ TESTSUITE_AT = \
setstat04.at\
setstat05.at\
symlink.at\
+ symlink-bad-length.at\
+ symlink-long.at\
version.at
TESTSUITE = $(srcdir)/testsuite
Index: cpio-2.11/tests/symlink-bad-length.at
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ cpio-2.11/tests/symlink-bad-length.at 2014-12-01 16:59:35.339946156 +0100
@@ -0,0 +1,49 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Copyright (C) 2014 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)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+
+# Cpio v2.11 did segfault with badly set symlink length.
+# References:
+# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
+
+AT_SETUP([symlink-bad-length])
+AT_KEYWORDS([symlink-long copyout])
+
+AT_DATA([ARCHIVE.base64],
+[x3EjAIBAtIEtJy8nAQAAAHRUYW0FAAAADQBGSUxFAABzb21lIGNvbnRlbnQKAMdxIwBgQ/+hLScv
+JwEAAAB0VEhuBQD/////TElOSwAARklMRcdxAAAAAAAAAAAAAAEAAAAAAAAACwAAAAAAVFJBSUxF
+UiEhIQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+])
+
+AT_CHECK([
+base64 -d ARCHIVE.base64 > ARCHIVE || AT_SKIP_TEST
+cpio -ntv < ARCHIVE
+test $? -eq 2
+],
+[0],
+[-rw-rw-r-- 1 10029 10031 13 Nov 25 13:52 FILE
+],[cpio: LINK: stored filename length too big
+cpio: premature end of file
+])
+
+AT_CLEANUP
Index: cpio-2.11/tests/symlink-long.at
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ cpio-2.11/tests/symlink-long.at 2014-12-01 16:59:35.340946169 +0100
@@ -0,0 +1,46 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Copyright (C) 2014 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)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+
+# Cpio v2.11.90 changed the way symlink name is read from archive.
+# References:
+# http://lists.gnu.org/archive/html/bug-cpio/2014-11/msg00007.html
+
+AT_SETUP([symlink-long])
+AT_KEYWORDS([symlink-long copyout])
+
+AT_CHECK([
+
+# len(dirname) > READBUFSIZE
+dirname=
+for i in {1..52}; do
+ dirname="xxxxxxxxx/$dirname"
+ mkdir "$dirname"
+done
+ln -s "$dirname" x || AT_SKIP_TEST
+
+echo x | cpio -o > ar
+list=`cpio -tv < ar | sed 's|.*-> ||'`
+test "$list" = "$dirname" && echo success || echo fail
+],
+[0],
+[success
+],[2 blocks
+2 blocks
+])
+
+AT_CLEANUP
Index: cpio-2.11/tests/testsuite.at
===================================================================
--- cpio-2.11.orig/tests/testsuite.at 2014-12-01 16:59:33.864928120 +0100
+++ cpio-2.11/tests/testsuite.at 2014-12-01 16:59:35.340946169 +0100
@@ -31,6 +31,8 @@ m4_include([version.at])
m4_include([inout.at])
m4_include([symlink.at])
+m4_include([symlink-bad-length.at])
+m4_include([symlink-long.at])
m4_include([interdir.at])
m4_include([setstat01.at])

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bb820bfd96e74fc6ce43104f06fe733178517e7f5d1cdee553773e8eff7d5bbd
size 1018483

View File

@ -1,7 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iD8DBQBLl5uDNgKwf1XQxzIRAn4uAJ9d8avkqDsyPc3llwzWxSKtWSSrjgCggdrN
RI9g+2/ng6bspf1ZS0+dYS4=
=Lp8g
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,12 @@
Index: cpio-2.12/src/util.c
===================================================================
--- cpio-2.12.orig/src/util.c
+++ cpio-2.12/src/util.c
@@ -812,6 +812,7 @@ get_inode_and_dev (struct cpio_file_stat
hdr->c_dev_maj = major (st->st_dev);
hdr->c_dev_min = minor (st->st_dev);
}
+ return 0;
}

3
cpio-2.12.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:70998c5816ace8407c8b101c9ba1ffd3ebbecba1f5031046893307580ec1296e
size 1258605

7
cpio-2.12.tar.bz2.sig Normal file
View File

@ -0,0 +1,7 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEABECAAYFAlX0Dh4ACgkQNgKwf1XQxzLTigCeO+MKFk1BRjca0CU1jaYwC5y7
qOcAnAy9Th86/Do4aIy12NoJxlMDDF2X
=jXgF
-----END PGP SIGNATURE-----

View File

@ -1,8 +1,8 @@
Index: cpio-2.11/src/copyin.c
Index: cpio-2.12/src/copyin.c
===================================================================
--- cpio-2.11.orig/src/copyin.c 2014-07-01 14:02:39.991007263 +0200
+++ cpio-2.11/src/copyin.c 2014-07-22 16:05:28.171344584 +0200
@@ -686,6 +686,51 @@ copyin_link(struct cpio_file_stat *file_
--- cpio-2.12.orig/src/copyin.c
+++ cpio-2.12/src/copyin.c
@@ -695,6 +695,51 @@ copyin_link (struct cpio_file_stat *file
free (link_name);
}
@ -54,7 +54,7 @@ Index: cpio-2.11/src/copyin.c
static void
copyin_file (struct cpio_file_stat *file_hdr, int in_file_des)
{
@@ -1463,6 +1508,23 @@ process_copy_in ()
@@ -1474,6 +1519,23 @@ process_copy_in ()
{
/* Copy the input file into the directory structure. */
@ -78,10 +78,10 @@ Index: cpio-2.11/src/copyin.c
/* Do we need to rename the file? */
if (rename_flag || rename_batch_file)
{
Index: cpio-2.11/src/global.c
Index: cpio-2.12/src/global.c
===================================================================
--- cpio-2.11.orig/src/global.c 2014-07-17 16:33:09.768900927 +0200
+++ cpio-2.11/src/global.c 2014-07-21 17:45:58.563494706 +0200
--- cpio-2.12.orig/src/global.c
+++ cpio-2.12/src/global.c
@@ -187,6 +187,9 @@ bool to_stdout_option = false;
/* The name this program was run with. */
char *program_name;
@ -92,21 +92,19 @@ Index: cpio-2.11/src/global.c
/* A pointer to either lstat or stat, depending on whether
dereferencing of symlinks is done for input files. */
int (*xstat) ();
Index: cpio-2.11/src/main.c
Index: cpio-2.12/src/main.c
===================================================================
--- cpio-2.11.orig/src/main.c 2014-07-01 14:02:39.840005051 +0200
+++ cpio-2.11/src/main.c 2014-07-17 20:33:47.839215571 +0200
@@ -57,7 +57,8 @@ enum cpio_options {
FORCE_LOCAL_OPTION,
--- cpio-2.12.orig/src/main.c
+++ cpio-2.12/src/main.c
@@ -59,6 +59,7 @@ enum cpio_options {
DEBUG_OPTION,
BLOCK_SIZE_OPTION,
- TO_STDOUT_OPTION
+ TO_STDOUT_OPTION,
+ EXTRACT_OVER_SYMLINKS
};
const char *program_authors[] =
@@ -222,6 +223,8 @@ static struct argp_option options[] = {
TO_STDOUT_OPTION,
+ EXTRACT_OVER_SYMLINKS,
RENUMBER_INODES_OPTION,
IGNORE_DEVNO_OPTION,
DEVICE_INDEPENDENT_OPTION
@@ -243,6 +244,8 @@ static struct argp_option options[] = {
N_("Create leading directories where needed"), GRID+1 },
{"no-preserve-owner", NO_PRESERVE_OWNER_OPTION, 0, 0,
N_("Do not change the ownership of the files"), GRID+1 },
@ -115,7 +113,7 @@ Index: cpio-2.11/src/main.c
{"unconditional", 'u', NULL, 0,
N_("Replace all files unconditionally"), GRID+1 },
{"sparse", SPARSE_OPTION, NULL, 0,
@@ -413,6 +416,10 @@ crc newc odc bin ustar tar (all-caps als
@@ -433,6 +436,10 @@ crc newc odc bin ustar tar (all-caps als
no_chown_flag = true;
break;
@ -125,28 +123,28 @@ Index: cpio-2.11/src/main.c
+
case 'o': /* Copy-out mode. */
if (copy_function != 0)
error (PAXEXIT_FAILURE, 0, _("Mode already defined"));
Index: cpio-2.11/src/extern.h
USAGE_ERROR ((0, 0, _("Mode already defined")));
Index: cpio-2.12/src/extern.h
===================================================================
--- cpio-2.11.orig/src/extern.h 2014-07-01 14:02:39.907006032 +0200
+++ cpio-2.11/src/extern.h 2014-07-17 17:11:20.948908806 +0200
@@ -95,6 +95,7 @@ extern char input_is_special;
--- cpio-2.12.orig/src/extern.h
+++ cpio-2.12/src/extern.h
@@ -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 bool extract_over_symlinks;
extern int (*xstat) ();
extern void (*copy_function) ();
Index: cpio-2.11/doc/cpio.1
extern char *change_directory_option;
Index: cpio-2.12/doc/cpio.1
===================================================================
--- cpio-2.11.orig/doc/cpio.1 2009-02-14 19:15:50.000000000 +0100
+++ cpio-2.11/doc/cpio.1 2014-07-21 23:00:33.878746855 +0200
@@ -22,6 +22,7 @@ cpio \- copy files to and from archives
[\-\-owner=[user][:.][group]] [\-\-no-preserve-owner] [\-\-message=message]
[\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-sparse]
[\-\-only\-verify\-crc] [\-\-to\-stdout] [\-\-quiet] [\-\-rsh-command=command]
+[\-\-extract\-over\-symlinks]
[\-\-help] [\-\-version] [pattern...] [< archive]
--- cpio-2.12.orig/doc/cpio.1
+++ cpio-2.12/doc/cpio.1
@@ -50,6 +50,7 @@ cpio \- copy files to and from archives
[\fB\-\-force\-local\fR] [\fB\-\-no\-absolute\-filenames\fR] [\fB\-\-sparse\fR]
[\fB\-\-only\-verify\-crc\fR] [\fB\-\-to\-stdout\fR] [\fB\-\-quiet\fR]
[\fB\-\-rsh\-command=\fICOMMAND\fR]
+[\fB\-\-extract\-over\-symlinks\fR]
[\fIpattern\fR...] [\fB<\fR \fIarchive\fR]
.B cpio

View File

@ -1,77 +1,79 @@
--- src/util.c
+++ src/util.c
@@ -188,8 +188,15 @@ tape_fill_input_buffer (int in_des, int
input_size = rmtread (in_des, input_buffer, num_bytes);
if (input_size == 0 && input_is_special)
{
- get_next_reel (in_des);
+ if (!tape_eof (in_des))
+ get_next_reel (in_des);
input_size = rmtread (in_des, input_buffer, num_bytes);
+ if (input_size == 0)
+ {
+ if (tape_eod (in_des))
+ get_next_reel (in_des);
+ input_size = rmtread (in_des, input_buffer, num_bytes);
+ }
}
if (input_size < 0)
error (1, errno, _("read error"));
@@ -354,8 +361,15 @@ tape_buffered_peek (char *peek_buf, int
{
if (input_is_special)
{
- get_next_reel (in_des);
+ if (!tape_eof (in_des))
+ get_next_reel (in_des);
tmp_input_size = rmtread (in_des, append_buf, io_block_size);
+ if (tmp_input_size == 0)
+ {
+ if (tape_eod (in_des))
+ get_next_reel (in_des);
+ tmp_input_size = rmtread (in_des, append_buf, io_block_size);
+ }
}
else
break;
@@ -828,6 +842,40 @@ tape_offline (int tape_des)
#endif
}
+int
+tape_eof( int tape_des)
+{
+ struct mtget status;
+
+ if (rmtioctl (tape_des, MTIOCGET, (char*)&status) == -1) {
+ error (1, errno, "Cannot get tape status");
+ return 0;
+ }
+
+ if (GMT_EOF(status.mt_gstat)) {
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+tape_eod( int tape_des)
+{
+ struct mtget status;
+
+ if (rmtioctl (tape_des, MTIOCGET, (char*)&status) == -1) {
+ error (1, errno, "Cannot get tape status");
+ return 1;
+ }
+
+ if (GMT_EOD(status.mt_gstat)) {
+ return 1;
+ }
+
+ return 0;
+}
+
/* The file on file descriptor TAPE_DES is assumed to be magnetic tape
(or floppy disk or other device) and the end of the medium
has been reached. Ask the user for to mount a new "tape" to continue
Index: src/util.c
===================================================================
--- src/util.c.orig
+++ src/util.c
@@ -203,8 +203,15 @@ tape_fill_input_buffer (int in_des, int
input_size = rmtread (in_des, input_buffer, num_bytes);
if (input_size == 0 && input_is_special)
{
- get_next_reel (in_des);
+ if (!tape_eof (in_des))
+ get_next_reel (in_des);
input_size = rmtread (in_des, input_buffer, num_bytes);
+ if (input_size == 0)
+ {
+ if (tape_eod (in_des))
+ get_next_reel (in_des);
+ input_size = rmtread (in_des, input_buffer, num_bytes);
+ }
}
if (input_size == SAFE_READ_ERROR)
error (PAXEXIT_FAILURE, errno, _("read error"));
@@ -366,8 +373,15 @@ tape_buffered_peek (char *peek_buf, int
{
if (input_is_special)
{
- get_next_reel (in_des);
+ if (!tape_eof (in_des))
+ get_next_reel (in_des);
tmp_input_size = rmtread (in_des, append_buf, io_block_size);
+ if (tmp_input_size == 0)
+ {
+ if (tape_eod (in_des))
+ get_next_reel (in_des);
+ tmp_input_size = rmtread (in_des, append_buf, io_block_size);
+ }
}
else
break;
@@ -842,6 +856,40 @@ tape_offline (int tape_des)
#endif
}
+int
+tape_eof( int tape_des)
+{
+ struct mtget status;
+
+ if (rmtioctl (tape_des, MTIOCGET, (char*)&status) == -1) {
+ error (1, errno, "Cannot get tape status");
+ return 0;
+ }
+
+ if (GMT_EOF(status.mt_gstat)) {
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+tape_eod( int tape_des)
+{
+ struct mtget status;
+
+ if (rmtioctl (tape_des, MTIOCGET, (char*)&status) == -1) {
+ error (1, errno, "Cannot get tape status");
+ return 1;
+ }
+
+ if (GMT_EOD(status.mt_gstat)) {
+ return 1;
+ }
+
+ return 0;
+}
+
/* The file on file descriptor TAPE_DES is assumed to be magnetic tape
(or floppy disk or other device) and the end of the medium
has been reached. Ask the user for to mount a new "tape" to continue

View File

@ -2,74 +2,88 @@ Index: doc/mt.1
===================================================================
--- doc/mt.1.orig
+++ doc/mt.1
@@ -76,9 +76,6 @@ Absolute space to file number
.IR count .
@@ -100,10 +100,6 @@ Absolute space to file number
Equivalent to rewind followed by fsf
.IR count .
-.IP seek
.TP
-.B seek
-Seek to block number
-.IR count .
.IP eom
-.TP
.B eom
Space to the end of the recorded media on the tape
(for appending files onto tapes).
@@ -93,6 +90,69 @@ Rewind the tape, then wind it to the end
then rewind it again.
.IP erase
@@ -123,6 +119,82 @@ then rewind it again.
.TP
.B erase
Erase the tape.
+.IP fss
+.TP
+.B fss
+(SCSI tapes) Forward space
+.I count
+setmarks.
+.IP bss
+.TP
+.B bss
+(SCSI tapes) Backward space
+.I count
+setmarks.
+.IP "wset"
+.TP
+.B "wset"
+(SCSI tapes) Write
+.I count
+setmarks at current position (only SCSI tape).
+.IP "eod, seod"
+.TP
+.B "eod, seod"
+Space to end of valid data. Used on streamer tape
+drives to append data to the logical and of tape.
+.IP setblk
+.TP
+.B setblk
+(SCSI tapes) Set the block size of the drive to
+.I count
+bytes per record.
+.IP setdensity
+.TP
+.B setdensity
+(SCSI tapes) Set the tape density code to
+.I count.
+The proper codes to use with each drive should be looked up from the
+drive documentation.
+.IP drvbuffer
+.TP
+.B drvbuffer
+(SCSI tapes) Set the tape drive buffer code to
+.I number.
+The proper value for unbuffered operation is zero and "normal" buffered
+operation one. The meanings of other values can be found in the drive
+documentation or, in case of a SCSI-2 drive, from the SCSI-2 standard.
+.IP stoptions
+.TP
+.B stoptions
+(SCSI tapes) Set the driver options bits to
+.I count
+for the device.
+The bits can be set by oring the following values: 1 to enable write
+buffering, 2 to enable asynchronous writes, 4 to enable read ahead,
+8 to enable debugging output (if it has been compiled to the driver).
+.IP stwrthreshold
+.TP
+.B stwrthreshold
+(SCSI tapes) The write threshold for the tape device is set to
+.I count
+kilobytes. The value must be smaller than or equal to the driver
+buffer size.
+.IP seek
+.TP
+.B seek
+(SCSI tapes) Seek to the
+.I count
+block on the tape. This operation is available on some
+Tandberg and Wangtek streamers and some SCSI-2 tape drives.
+.IP tell
+.TP
+.B tell
+(SCSI tapes) Tell the current block on tape. This operation is available on some
+Tandberg and Wangtek streamers and some SCSI-2 tape drives.
+.IP densities
+.TP
+.B densities
+(SCSI tapes) Write explanation of some common density codes to
+standard output.
+.IP datcompression
+.TP
+.B datcompression
+(some SCSI-2 DAT tapes) Inquire or set the compression status
+(on/off). If the
+.I count
@ -86,12 +100,12 @@ Index: lib/system.h
===================================================================
--- lib/system.h.orig
+++ lib/system.h
@@ -431,10 +431,11 @@ char *getenv ();
@@ -438,10 +438,11 @@ char *getenv ();
#if HAVE_LOCALE_H
# include <locale.h>
-#endif
+#else
+#else
#if !HAVE_SETLOCALE
# define setlocale(category, locale) /* empty */
#endif
@ -99,24 +113,11 @@ Index: lib/system.h
#include <time.h>
#ifdef TIME_WITH_SYS_TIME
Index: src/Makefile.am
===================================================================
--- src/Makefile.am.orig
+++ src/Makefile.am
@@ -19,7 +19,7 @@
INCLUDES=-I. -I.. -I$(top_srcdir)/gnu -I$(top_builddir)/gnu -I$(top_srcdir)/lib -I$(top_builddir)/lib
-bin_PROGRAMS=cpio @CPIO_MT_PROG@
+bin_PROGRAMS=cpio mt
EXTRA_PROGRAMS=mt
cpio_SOURCES = \
Index: src/copyin.c
===================================================================
--- src/copyin.c.orig
+++ src/copyin.c
@@ -689,7 +689,7 @@ copyin_link(struct cpio_file_stat *file_
@@ -698,7 +698,7 @@ copyin_link (struct cpio_file_stat *file
static void
copyin_file (struct cpio_file_stat *file_hdr, int in_file_des)
{
@ -125,7 +126,7 @@ Index: src/copyin.c
if (!to_stdout_option
&& try_existing_file (file_hdr, in_file_des, &existing_dir) < 0)
@@ -1278,6 +1278,7 @@ process_copy_in ()
@@ -1287,6 +1287,7 @@ process_copy_in ()
int in_file_des; /* Input file descriptor. */
char skip_file; /* Flag for use with patterns. */
int i; /* Loop index variable. */
@ -133,7 +134,7 @@ Index: src/copyin.c
newdir_umask = umask (0); /* Reset umask to preserve modes of
created files */
@@ -1386,8 +1387,10 @@ process_copy_in ()
@@ -1397,8 +1398,10 @@ process_copy_in ()
for (i = 0; i < num_patterns
&& skip_file == copy_matching_files; i++)
{
@ -187,7 +188,7 @@ Index: src/mt.c
+ enable asynchronous writes, 4 to enable read ahead, 8
+ to enable debugging output (if it has been compiled to
+ the driver).
+ stwrthreshold
+ stwrthreshold
+ (SCSI tapes) The write threshold for the tape device
+ is set to COUNT kilobytes. The value must be smaller
+ than or equal to the driver buffer size.
@ -425,11 +426,10 @@ Index: src/mt.c
print_status (char *dev, int desc)
{
struct mtget status;
-
+ #ifdef MT_TAPE_INFO
+ struct mt_tape_info *mt;
+ #endif
+
if (rmtioctl (desc, MTIOCGET, (char*)&status) == -1)
error (MT_EXIT_FAILURE, errno, _("%s: rmtioctl failed"), dev);
@ -442,7 +442,7 @@ Index: src/mt.c
+ }
+ else
+ #endif
+
+
printf ("drive type = %d\n", (int) status.mt_type);
#if defined(hpux) || defined(__hpux)
printf ("drive status (high) = %d\n", (int) status.mt_dsreg1);

View File

@ -1,17 +1,17 @@
Index: cpio-2.11/src/copyin.c
Index: cpio-2.12/src/copyin.c
===================================================================
--- cpio-2.11.orig/src/copyin.c 2010-08-10 16:45:19.000000000 +0200
+++ cpio-2.11/src/copyin.c 2010-08-10 16:45:34.000000000 +0200
@@ -862,6 +862,8 @@ read_pattern_file ()
--- cpio-2.12.orig/src/copyin.c
+++ cpio-2.12/src/copyin.c
@@ -871,6 +871,8 @@ read_pattern_file ()
pattern_fp = fopen (pattern_file_name, "r");
if (pattern_fp == NULL)
open_error (pattern_file_name);
open_fatal (pattern_file_name);
+ else
+ {
while (ds_fgetstr (pattern_fp, &pattern_name, '\n') != NULL)
{
if (new_num_patterns >= max_new_patterns)
@@ -876,6 +878,7 @@ read_pattern_file ()
@@ -885,6 +887,7 @@ read_pattern_file ()
}
if (ferror (pattern_fp) || fclose (pattern_fp) == EOF)
close_error (pattern_file_name);

View File

@ -1,15 +0,0 @@
Index: cpio-2.11/gnu/stdio.in.h
===================================================================
--- cpio-2.11.orig/gnu/stdio.in.h
+++ cpio-2.11/gnu/stdio.in.h
@@ -138,8 +138,10 @@ _GL_WARN_ON_USE (fflush, "fflush is not
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
+#if HAVE_RAW_DECL_GETS
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@

View File

@ -2,24 +2,54 @@ Index: doc/cpio.info
===================================================================
--- doc/cpio.info.orig
+++ doc/cpio.info
@@ -266,7 +266,8 @@ File: cpio.info, Node: Options, Prev:
Set the I/O block size to BLOCK-SIZE * 512 bytes.
@@ -216,7 +216,8 @@ option, e.g.:
'-B'
Set the I/O block size to 5120 bytes.
'-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.
'-C NUMBER'
'--io-size=NUMBER'
Set the I/O block size to the given NUMBER of bytes.
@@ -296,7 +297,8 @@ option.
'-B'
Set the I/O block size to 5120 bytes.
'-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.
'-C NUMBER'
'--io-size=NUMBER'
Set the I/O block size to the given NUMBER of bytes.
@@ -406,7 +408,8 @@ option.
'-B'
Set the I/O block size to 5120 bytes.
'-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.
'-C NUMBER'
'--io-size=NUMBER'
Set the I/O block size to the given NUMBER of bytes.
@@ -554,7 +557,8 @@ option is valid.
`-c'
'-c'
[*note copy-in::,*note copy-out::,*note 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.
`-C IO-SIZE'
`--io-size=IO-SIZE'
'-C IO-SIZE'
'--io-size=IO-SIZE'
Index: src/main.c
===================================================================
--- src/main.c.orig
+++ src/main.c
@@ -339,6 +339,7 @@ parse_opt (int key, char *arg, struct ar
@@ -329,6 +329,7 @@ parse_opt (int key, char *arg, struct ar
case 'c': /* Use the old portable ASCII format. */
if (archive_format != arf_unknown)
error (0, EXIT_FAILURE, _("Archive format multiply defined"));
USAGE_ERROR ((0, 0, _("Archive format multiply defined")));
+#define SVR4_COMPAT
#ifdef SVR4_COMPAT
archive_format = arf_newascii; /* -H newc. */

View File

@ -1,3 +1,25 @@
-------------------------------------------------------------------
Thu Oct 8 11:57:19 UTC 2015 - kstreitova@suse.com
- update to 2.12
* Improved documentation
* Manpages are installed by make install
* New options for copy-out mode: --ignore-devno,
--renumber-inodes, --device-independent, --reproducible
* update
* cpio-use_new_ascii_format.patch
* cpio-mt.patch
* cpio-eof_tape_handling.patch
* cpio-pattern-file-sigsegv.patch
* cpio-check_for_symlinks.patch
* remove (no longer needed)
* cpio-stdio.in.patch
* 0001-Fix-memory-overrun-on-reading-improperly-created-lin.patch
* add
* cpio-2.12-util.c_no_return_in_nonvoid_fnc.patch to add missing
return to the nonvoid get_inode_and_dev() function
- use spec-cleaner
-------------------------------------------------------------------
Mon Mar 16 18:54:59 UTC 2015 - mpluskal@suse.com

View File

@ -17,7 +17,7 @@
Name: cpio
Version: 2.11
Version: 2.12
Release: 0
Summary: A Backup and Archiving Utility
License: GPL-3.0
@ -39,11 +39,10 @@ Patch18: cpio-default_tape_dev.patch
#PATCH-FIX-UPSTREAM cpio-2.10-close_files_after_copy.patch
Patch20: cpio-close_files_after_copy.patch
Patch21: cpio-pattern-file-sigsegv.patch
Patch22: cpio-stdio.in.patch
Patch23: paxutils-rtapelib_mtget.patch
Patch24: cpio-check_for_symlinks.patch
Patch25: cpio-fix_truncation_check.patch
Patch26: 0001-Fix-memory-overrun-on-reading-improperly-created-lin.patch
Patch26: cpio-2.12-util.c_no_return_in_nonvoid_fnc.patch
BuildRequires: autoconf
BuildRequires: automake
Requires(post): %{install_info_prereq}
@ -76,7 +75,6 @@ provided by cpio, install the 'dump' package as well.
%patch18
%patch20
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
@ -93,7 +91,7 @@ LDFLAGS="-pie" \
./configure \
--with-rmt="%{_sysconfdir}/rmt" \
--enable-mt \
--prefix=/usr \
--prefix=%{_prefix} \
--mandir=%{_mandir} \
--infodir=%{_infodir} \
--libdir=%{_libdir} \
@ -102,7 +100,7 @@ make %{?_smp_mflags}
%install
mkdir -p %{buildroot}/{usr/bin,bin}
make prefix=%{buildroot}/usr infodir=%{buildroot}/%{_infodir} mandir=%{buildroot}/%{_mandir} install
make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}/%{_infodir} mandir=%{buildroot}/%{_mandir} install
#UsrMerge
ln -sf %{_bindir}/cpio %{buildroot}/bin
#EndUsrMerge
@ -121,9 +119,9 @@ ln -sf %{_bindir}/cpio %{buildroot}/bin
#EndUsrMerge
%{_bindir}/cpio
%{_bindir}/mt
%doc %{_infodir}/cpio.info.gz
%doc %{_mandir}/man1/cpio.1.gz
%doc %{_mandir}/man1/mt.1.gz
%{_infodir}/cpio.info.gz
%{_mandir}/man1/cpio.1.gz
%{_mandir}/man1/mt.1.gz
#/usr/share/locale/*/LC_MESSAGES/cpio.mo
%files lang -f %{name}.lang