SHA256
1
0
forked from pool/cpio

Updating link to change in openSUSE:Factory/cpio revision 25.0

OBS-URL: https://build.opensuse.org/package/show/Archiving/cpio?expand=0&rev=ec6713ec3ebe5e0f61b02764b7cf96a9
This commit is contained in:
OBS User buildservice-autocommit 2010-03-25 23:54:28 +00:00 committed by Git OBS Bridge
parent 4b644cb704
commit 6600438bbd
16 changed files with 213 additions and 536 deletions

View File

@ -1,139 +0,0 @@
--- src/copypass.c
+++ src/copypass.c
@@ -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)
--- src/copyin.c
+++ src/copyin.c
@@ -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=0;
+ 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

@ -1,52 +0,0 @@
From 9bc39283e4cc6ab9e5913ccbf766998eab4ff093 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org.ua>
Date: Mon, 01 Mar 2010 08:49:03 +0000
Subject: Bugfixes in rtapelib
* lib/rmt.h (rmtcreat): Use fcntl O_ macros insead of
their hardcoded values.
* lib/rtapelib.c (rmt_read__,rmt_ioctl__): Prevent
potential overflow.
---
diff --git a/lib/rmt.h b/lib/rmt.h
index 50f037c..2ce9dc5 100644
--- a/lib/rmt.h
+++ b/lib/rmt.h
@@ -61,7 +61,7 @@ extern bool force_local_option;
#define rmtcreat(dev_name, mode, command) \
(_remdev (dev_name) \
- ? rmt_open__ (dev_name, 1 | O_CREAT, __REM_BIAS, command) \
+ ? rmt_open__ (dev_name, O_CREAT | O_WRONLY, __REM_BIAS, command) \
: creat (dev_name, mode))
#define rmtlstat(dev_name, muffer) \
diff --git a/lib/rtapelib.c b/lib/rtapelib.c
index 02ad1e7..cb645db 100644
--- a/lib/rtapelib.c
+++ b/lib/rtapelib.c
@@ -573,7 +573,8 @@ rmt_read__ (int handle, char *buffer, size_t length)
sprintf (command_buffer, "R%lu\n", (unsigned long) length);
if (do_command (handle, command_buffer) == -1
- || (status = get_status (handle)) == SAFE_READ_ERROR)
+ || (status = get_status (handle)) == SAFE_READ_ERROR
+ || status > length)
return SAFE_READ_ERROR;
for (counter = 0; counter < status; counter += rlen, buffer += rlen)
@@ -709,6 +710,12 @@ rmt_ioctl__ (int handle, int operation, char *argument)
|| (status = get_status (handle), status == -1))
return -1;
+ if (status > sizeof (struct mtop))
+ {
+ errno = EOVERFLOW;
+ return -1;
+ }
+
for (; status > 0; status -= counter, argument += counter)
{
counter = safe_read (READ_SIDE (handle), argument, status);
--
cgit v0.8.2.1

View File

@ -1,8 +0,0 @@
--- lib/Makefile.am.orig 2009-07-09 09:41:26.000000000 +0200
+++ lib/Makefile.am 2009-07-09 09:41:17.000000000 +0200
@@ -37,4 +37,5 @@
sysdep.c\
system.h\
error.c\
+ ../src/fatal.c \
names.c

View File

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

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

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

View File

@ -2,22 +2,24 @@ Index: src/copyin.c
=================================================================== ===================================================================
--- src/copyin.c.orig --- src/copyin.c.orig
+++ src/copyin.c +++ src/copyin.c
@@ -1565,6 +1565,19 @@ process_copy_in () @@ -1484,7 +1484,20 @@ process_copy_in ()
if (dot_flag)
fputc ('\n', stderr); fputc ('\n', stderr);
apply_delayed_set_stat ();
-
+
+ if (tty_in) + if (tty_in)
+ { + {
+ fclose(tty_in); + fclose(tty_in);
+ } + }
+ if (tty_out) + if (tty_out)
+ { + {
+ fclose(tty_out); + fclose(tty_out);
+ } + }
+ if (rename_in) + if (rename_in)
+ { + {
+ fclose(rename_in); + fclose(rename_in);
+ } + }
+ +
if (append_flag) if (append_flag)
return; return;

View File

@ -1,12 +1,17 @@
--- src/mt.c Index: src/mt.c
===================================================================
--- src/mt.c.orig
+++ src/mt.c +++ src/mt.c
@@ -664,11 +664,20 @@ @@ -413,11 +413,18 @@ parse_opt (int key, char *arg, struct ar
{ {
tapedev = getenv ("TAPE"); tapedev = getenv ("TAPE");
if (tapedev == NULL) if (tapedev == NULL)
-#ifdef DEFTAPE /* From sys/mtio.h. */ -#ifdef DEFTAPE /* From sys/mtio.h. */
- tapedev = DEFTAPE; - tapedev = DEFTAPE;
-#else -#else
- error (MT_EXIT_INVOP, 0, _("no tape device specified"));
-#endif
+
+/* Suse doesn't have /dev/tape as link to /dev/nst0 any more. +/* Suse doesn't have /dev/tape as link to /dev/nst0 any more.
+Instead it uses udev and creates different names in /dev/tape/by-id/ directory. +Instead it uses udev and creates different names in /dev/tape/by-id/ directory.
+If it is SCSI tape storage then it creates /dev/tape/by-id/scsi--nst +If it is SCSI tape storage then it creates /dev/tape/by-id/scsi--nst
@ -18,10 +23,6 @@
+/* #ifdef DEFTAPE * From sys/mtio.h. * */ +/* #ifdef DEFTAPE * From sys/mtio.h. * */
+# define DEFSUSETAPE "/dev/nst0" +# define DEFSUSETAPE "/dev/nst0"
+ tapedev = DEFSUSETAPE; + tapedev = DEFSUSETAPE;
+/* #else }
error (1, 0, _("no tape device specified")); break;
-#endif
+#endif */
}
#ifdef MTDENS

View File

@ -1,163 +1,13 @@
--- cpio-2.9/src/copyin.c Redhat-bugzilla: 430835
+++ cpio-2.9/src/copyin.c
@@ -186,12 +186,11 @@ * revert make_path code to previous state, which worked better
* this can be dropped when permission issues are solved in upstream
static int
try_existing_file (struct cpio_file_stat* file_hdr, int in_file_des,
- int *existing_dir, mode_t *existing_mode) diff -up cpio-2.9/src/extern.h.dir_perm cpio-2.9/src/extern.h
+ int *existing_dir) --- cpio-2.9/src/extern.h.dir_perm 2007-06-28 14:59:38.000000000 +0200
{ +++ cpio-2.9/src/extern.h 2008-03-03 11:57:43.000000000 +0100
struct stat file_stat; @@ -140,8 +140,8 @@ void process_args (int argc, char *argv[
*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 @@
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 @@
}
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 @@
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 @@
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 @@
copyin_file (struct cpio_file_stat* file_hdr, int in_file_des)
{
int existing_dir=0;
- 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 @@
break;
case CP_IFDIR:
- copyin_directory(file_hdr, existing_dir, existing_mode);
+ copyin_directory (file_hdr, existing_dir);
break;
case CP_IFCHR:
@@ -1576,8 +1565,6 @@
if (dot_flag)
fputc ('\n', stderr);
- apply_delayed_set_stat ();
-
if (append_flag)
return;
--- cpio-2.9/src/copypass.c
+++ cpio-2.9/src/copypass.c
@@ -239,23 +239,15 @@
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 @@
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 @@
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;
--- cpio-2.9/src/extern.h
+++ cpio-2.9/src/extern.h
@@ -140,8 +140,8 @@
void initialize_buffers (void); void initialize_buffers (void);
/* makepath.c */ /* makepath.c */
@ -168,9 +18,36 @@
/* tar.c */ /* tar.c */
void write_out_tar_header (struct cpio_file_stat *file_hdr, int out_des); void write_out_tar_header (struct cpio_file_stat *file_hdr, int out_des);
--- cpio-2.9/src/makepath.c diff -up cpio-2.9/src/util.c.dir_perm cpio-2.9/src/util.c
+++ cpio-2.9/src/makepath.c --- cpio-2.9/src/util.c.dir_perm 2007-06-28 15:04:51.000000000 +0200
@@ -36,8 +36,10 @@ +++ cpio-2.9/src/util.c 2008-03-03 11:45:00.000000000 +0100
@@ -618,14 +618,7 @@ create_all_directories (char *name)
error (2, 0, _("virtual memory exhausted"));
if (dir[0] != '.' || dir[1] != '\0')
- {
- const char *fmt;
- if (warn_option & CPIO_WARN_INTERDIR)
- fmt = _("Creating intermediate directory `%s'");
- else
- fmt = NULL;
- make_path (dir, -1, -1, fmt);
- }
+ make_path (dir, mode, 0700, -1, -1, (char *) NULL);
free (dir);
}
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
@@ -29,15 +29,14 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include "cpiohdr.h"
-#include "dstring.h"
-#include "extern.h"
/* Ensure that the directory ARGPATH exists. /* Ensure that the directory ARGPATH exists.
Remove any trailing slashes from ARGPATH before calling this function. Remove any trailing slashes from ARGPATH before calling this function.
@ -240,7 +117,7 @@
while (*slash == '/') while (*slash == '/')
slash++; slash++;
while ((slash = strchr (slash, '/'))) while ((slash = strchr (slash, '/')))
@@ -91,9 +112,10 @@ @@ -91,9 +112,10 @@ make_path (char *argpath,
*(slash -1) = '\0'; *(slash -1) = '\0';
} }
#endif #endif
@ -252,7 +129,7 @@
return 1; return 1;
} }
else else
@@ -101,18 +123,24 @@ @@ -101,18 +123,24 @@ make_path (char *argpath,
if (verbose_fmt_string != NULL) if (verbose_fmt_string != NULL)
error (0, 0, verbose_fmt_string, dirpath); error (0, 0, verbose_fmt_string, dirpath);
@ -287,7 +164,7 @@
#ifdef HPUX_CDF #ifdef HPUX_CDF
if (iscdf) if (iscdf)
{ {
@@ -129,6 +157,7 @@ @@ -129,6 +157,7 @@ make_path (char *argpath,
else if (!S_ISDIR (stats.st_mode)) else if (!S_ISDIR (stats.st_mode))
{ {
error (0, 0, _("`%s' exists but is not a directory"), dirpath); error (0, 0, _("`%s' exists but is not a directory"), dirpath);
@ -295,7 +172,7 @@
return 1; return 1;
} }
@@ -143,7 +172,7 @@ @@ -143,7 +172,7 @@ make_path (char *argpath,
/* We're done making leading directories. /* We're done making leading directories.
Make the final component of the path. */ Make the final component of the path. */
@ -304,7 +181,7 @@
{ {
/* In some cases, if the final component in dirpath was `.' then we /* In some cases, if the final component in dirpath was `.' then we
just got an EEXIST error from that last mkdir(). If that's just got an EEXIST error from that last mkdir(). If that's
@@ -153,24 +182,51 @@ @@ -153,24 +182,51 @@ make_path (char *argpath,
(!S_ISDIR (stats.st_mode) ) ) (!S_ISDIR (stats.st_mode) ) )
{ {
error (0, errno, _("cannot make directory `%s'"), dirpath); error (0, errno, _("cannot make directory `%s'"), dirpath);
@ -368,7 +245,7 @@
} }
else else
{ {
@@ -179,10 +235,33 @@ @@ -179,10 +235,33 @@ make_path (char *argpath,
if (!S_ISDIR (stats.st_mode)) if (!S_ISDIR (stats.st_mode))
{ {
error (0, 0, _("`%s' exists but is not a directory"), dirpath); error (0, 0, _("`%s' exists but is not a directory"), dirpath);
@ -402,21 +279,3 @@
+ umask (oldmask); + umask (oldmask);
return retval; return retval;
} }
--- cpio-2.9/src/util.c
+++ cpio-2.9/src/util.c
@@ -618,14 +618,7 @@
error (2, 0, _("virtual memory exhausted"));
if (dir[0] != '.' || dir[1] != '\0')
- {
- const char *fmt;
- if (warn_option & CPIO_WARN_INTERDIR)
- fmt = _("Creating intermediate directory `%s'");
- else
- fmt = NULL;
- make_path (dir, -1, -1, fmt);
- }
+ make_path (dir, mode, 0700, -1, -1, (char *) NULL);
free (dir);
}

View File

@ -103,7 +103,7 @@ Index: src/Makefile.am
=================================================================== ===================================================================
--- src/Makefile.am.orig --- src/Makefile.am.orig
+++ src/Makefile.am +++ src/Makefile.am
@@ -18,7 +18,7 @@ @@ -19,7 +19,7 @@
INCLUDES=-I. -I.. -I$(top_srcdir)/gnu -I$(top_builddir)/gnu -I$(top_srcdir)/lib -I$(top_builddir)/lib INCLUDES=-I. -I.. -I$(top_srcdir)/gnu -I$(top_builddir)/gnu -I$(top_srcdir)/lib -I$(top_builddir)/lib
@ -116,16 +116,16 @@ Index: src/copyin.c
=================================================================== ===================================================================
--- src/copyin.c.orig --- src/copyin.c.orig
+++ src/copyin.c +++ src/copyin.c
@@ -771,7 +771,7 @@ copyin_link(struct cpio_file_stat *file_ @@ -689,7 +689,7 @@ copyin_link(struct cpio_file_stat *file_
static void static void
copyin_file (struct cpio_file_stat* file_hdr, int in_file_des) copyin_file (struct cpio_file_stat *file_hdr, int in_file_des)
{ {
- int existing_dir; - int existing_dir;
+ int existing_dir=0; + int existing_dir=0;
if (!to_stdout_option 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) < 0)
@@ -1360,6 +1360,7 @@ process_copy_in () @@ -1278,6 +1278,7 @@ process_copy_in ()
int in_file_des; /* Input file descriptor. */ int in_file_des; /* Input file descriptor. */
char skip_file; /* Flag for use with patterns. */ char skip_file; /* Flag for use with patterns. */
int i; /* Loop index variable. */ int i; /* Loop index variable. */
@ -133,7 +133,7 @@ Index: src/copyin.c
newdir_umask = umask (0); /* Reset umask to preserve modes of newdir_umask = umask (0); /* Reset umask to preserve modes of
created files */ created files */
@@ -1468,8 +1469,10 @@ process_copy_in () @@ -1386,8 +1387,10 @@ process_copy_in ()
for (i = 0; i < num_patterns for (i = 0; i < num_patterns
&& skip_file == copy_matching_files; i++) && skip_file == copy_matching_files; i++)
{ {
@ -149,7 +149,7 @@ Index: src/mt.c
=================================================================== ===================================================================
--- src/mt.c.orig --- src/mt.c.orig
+++ src/mt.c +++ src/mt.c
@@ -17,6 +17,10 @@ @@ -18,6 +18,10 @@
02110-1301 USA 02110-1301 USA
*/ */
@ -160,7 +160,7 @@ Index: src/mt.c
/* If -f is not given, the environment variable TAPE is used; /* If -f is not given, the environment variable TAPE is used;
if that is not set, a default device defined in sys/mtio.h is used. if that is not set, a default device defined in sys/mtio.h is used.
@@ -51,9 +55,51 @@ @@ -52,9 +56,51 @@
retension Rewind the tape, then wind it to the end of the reel, retension Rewind the tape, then wind it to the end of the reel,
then rewind it again. then rewind it again.
erase Erase the tape. erase Erase the tape.
@ -212,9 +212,9 @@ Index: src/mt.c
#include <system.h> #include <system.h>
#include <stdio.h> #include <stdio.h>
@@ -105,6 +151,85 @@ int atoi (); @@ -90,6 +136,110 @@
void exit (); #define MT_EXIT_INVOP 1
#endif #define MT_EXIT_FAILURE 2
+#if defined(linux) || defined(__linux) +#if defined(linux) || defined(__linux)
+#define MTDATCOMP 1000 /* Random unused number. */ +#define MTDATCOMP 1000 /* Random unused number. */
@ -294,11 +294,36 @@ Index: src/mt.c
+ {-1, NULL}}; + {-1, NULL}};
+#endif +#endif
+ +
+char *cbnames[] =
+{
+#ifdef MT_ST_BOOLEANS
+ "stoptions",
+#endif
+#ifdef MT_ST_WRITE_THRESHOLD
+ "stwrthreshold",
+#endif
+ NULL
+};
+ +
char *opnames[] = +int count_bits[] =
+{
+#ifdef MT_ST_BOOLEANS
+ MT_ST_BOOLEANS,
+#endif
+#ifdef MT_ST_WRITE_THRESHOLD
+ MT_ST_WRITE_THRESHOLD,
+#endif
+ 0
+};
+
+#ifdef MT_TAPE_INFO
+ struct mt_tape_info tapes[] = MT_TAPE_INFO;
+#endif
+
char const * const opnames[] =
{ {
"eof", "weof", "fsf", "bsf", "fsr", "bsr", "eof",
@@ -114,6 +239,8 @@ char *opnames[] = @@ -108,6 +258,8 @@ char const * const opnames[] =
#endif #endif
#ifdef MTEOM #ifdef MTEOM
"eom", "eom",
@ -307,7 +332,7 @@ Index: src/mt.c
#endif #endif
#ifdef MTRETEN #ifdef MTRETEN
"retension", "retension",
@@ -128,6 +255,39 @@ char *opnames[] = @@ -122,6 +274,39 @@ char const * const opnames[] =
#ifdef MTSEEK #ifdef MTSEEK
"seek", "seek",
#endif #endif
@ -347,7 +372,7 @@ Index: src/mt.c
NULL NULL
}; };
@@ -141,6 +301,8 @@ short operations[] = @@ -144,6 +329,8 @@ short operations[] =
#endif #endif
#ifdef MTEOM #ifdef MTEOM
MTEOM, MTEOM,
@ -356,7 +381,7 @@ Index: src/mt.c
#endif #endif
#ifdef MTRETEN #ifdef MTRETEN
MTRETEN, MTRETEN,
@@ -155,9 +317,69 @@ short operations[] = @@ -158,6 +345,39 @@ short operations[] =
#ifdef MTSEEK #ifdef MTSEEK
MTSEEK, MTSEEK,
#endif #endif
@ -393,63 +418,35 @@ Index: src/mt.c
+#ifdef MTDENS +#ifdef MTDENS
+ MTDENS, + MTDENS,
+#endif +#endif
0
}; };
+char *cbnames[] = ARGMATCH_VERIFY (opnames, operations);
+{ @@ -286,10 +506,23 @@ void
+#ifdef MT_ST_BOOLEANS
+ "stoptions",
+#endif
+#ifdef MT_ST_WRITE_THRESHOLD
+ "stwrthreshold",
+#endif
+ NULL
+};
+
+int count_bits[] =
+{
+#ifdef MT_ST_BOOLEANS
+ MT_ST_BOOLEANS,
+#endif
+#ifdef MT_ST_WRITE_THRESHOLD
+ MT_ST_WRITE_THRESHOLD,
+#endif
+ 0
+};
+
+#ifdef MT_TAPE_INFO
+ struct mt_tape_info tapes[] = MT_TAPE_INFO;
+#endif
+
+
struct option longopts[] =
{
{"file", 1, NULL, 'f'},
@@ -200,10 +422,22 @@ void
print_status (char *dev, int desc) print_status (char *dev, int desc)
{ {
struct mtget status; struct mtget status;
+#ifdef MT_TAPE_INFO -
+ struct mt_tape_info *mt; + #ifdef MT_TAPE_INFO
+#endif + struct mt_tape_info *mt;
+ #endif
+
if (rmtioctl (desc, MTIOCGET, (char*)&status) == -1) if (rmtioctl (desc, MTIOCGET, (char*)&status) == -1)
error (2, errno, _("%s: rmtioctl failed"), dev); error (MT_EXIT_FAILURE, errno, _("%s: rmtioctl failed"), dev);
+#ifdef MT_TAPE_INFO + #ifdef MT_TAPE_INFO
+ for (mt = tapes; mt->t_type; mt++) + for (mt = tapes; mt->t_type; mt++)
+ if (mt->t_type == status.mt_type) break; + if (mt->t_type == status.mt_type) break;
+ if (mt->t_type != 0) + if (mt->t_type != 0)
+ { + {
+ printf ("drive type = %s\n", mt->t_name); + printf ("drive type = %s\n", mt->t_name);
+ } + }
+ else + else
+#endif + #endif
+
printf ("drive type = %d\n", (int) status.mt_type); printf ("drive type = %d\n", (int) status.mt_type);
#if defined(hpux) || defined(__hpux) #if defined(hpux) || defined(__hpux)
printf ("drive status (high) = %d\n", (int) status.mt_dsreg1); printf ("drive status (high) = %d\n", (int) status.mt_dsreg1);
@@ -217,7 +451,177 @@ print_status (char *dev, int desc) @@ -303,7 +536,177 @@ print_status (char *dev, int desc)
printf ("file number = %d\n", (int) status.mt_fileno); printf ("file number = %d\n", (int) status.mt_fileno);
printf ("block number = %d\n", (int) status.mt_blkno); printf ("block number = %d\n", (int) status.mt_blkno);
#endif #endif
@ -606,7 +603,7 @@ Index: src/mt.c
+ printf("Compression off.\n"); + printf("Compression off.\n");
+ +
+ return 1; + return 1;
} +}
+#endif +#endif
+ +
+#ifdef MTTELL +#ifdef MTTELL
@ -621,24 +618,24 @@ Index: src/mt.c
+ error (2, errno, "%s", dev); + error (2, errno, "%s", dev);
+ printf("At block %ld.\n", position.mt_blkno); + printf("At block %ld.\n", position.mt_blkno);
+ +
+} }
+#endif +#endif
+ +
void void
usage (FILE *fp,int status) fatal_exit ()
@@ -276,7 +680,7 @@ main (int argc, char **argv) @@ -314,7 +717,7 @@ fatal_exit ()
if (optind == argc) int
usage (stderr, 1); main (int argc, char **argv)
{
- int tapedesc;
+ int tapedesc,i;
- i = argmatch (argv[optind], opnames); setlocale (LC_ALL, "");
+ i = argmatch (argv[optind], opnames,NULL,0); bindtextdomain (PACKAGE, LOCALEDIR);
if (i < 0) @@ -327,13 +730,32 @@ main (int argc, char **argv)
{ if (argp_parse (&argp, argc, argv, ARGP_IN_ORDER, NULL, NULL))
argmatch_invalid ("tape operation", argv[optind], i); exit (MT_EXIT_INVOP);
@@ -308,10 +712,29 @@ main (int argc, char **argv)
#endif
}
+#ifdef MTDENS +#ifdef MTDENS
+ if (operation == MTDENS) + if (operation == MTDENS)
@ -650,24 +647,28 @@ Index: src/mt.c
+ } + }
+#endif +#endif
+ +
if ( (operation == MTWEOF) switch (operation)
{
case MTWEOF:
#ifdef MTERASE #ifdef MTERASE
|| (operation == MTERASE) case MTERASE:
#endif #endif
- tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
+#ifdef MTWSM +#ifdef MTWSM
+ || (operation == MTWSM) + case MTWSM:
+#endif +#endif
+#ifdef MTSETDRVBUFFER +#ifdef MTSETDRVBUFFER
+ || (operation == MTSETDRVBUFFER) + case MTSETDRVBUFFER:
+#endif +#endif
+#ifdef MTDATCOMP +#ifdef MTDATCOMP
+ || (operation == MTDATCOMP) + case MTDATCOMP:
+#endif +#endif
) + tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option); break;
else
@@ -320,6 +743,17 @@ main (int argc, char **argv) default:
error (1, errno, _("%s: rmtopen failed"), tapedev); @@ -344,6 +766,17 @@ main (int argc, char **argv)
error (MT_EXIT_INVOP, errno, _("%s: rmtopen failed"), tapedev);
check_type (tapedev, tapedesc); check_type (tapedev, tapedesc);
+#ifdef MTDATCOMP +#ifdef MTDATCOMP
@ -684,11 +685,11 @@ Index: src/mt.c
if (operation == MTASF) if (operation == MTASF)
{ {
perform_operation (tapedev, tapedesc, MTREW, 1); perform_operation (tapedev, tapedesc, MTREW, 1);
@@ -328,6 +762,7 @@ main (int argc, char **argv) @@ -352,6 +785,7 @@ main (int argc, char **argv)
perform_operation (tapedev, tapedesc, operation, count); perform_operation (tapedev, tapedesc, operation, count);
if (operation == MTNOP) if (operation == MTNOP)
print_status (tapedev, tapedesc); print_status (tapedev, tapedesc);
+ } + }
if (rmtclose (tapedesc) == -1) if (rmtclose (tapedesc) == -1)
error (2, errno, _("%s: rmtclose failed"), tapedev); error (MT_EXIT_FAILURE, errno, _("%s: rmtclose failed"), tapedev);

View File

@ -1,20 +1,26 @@
--- src/mt.c Index: src/mt.c
===================================================================
--- src/mt.c.orig
+++ src/mt.c +++ src/mt.c
@@ -694,9 +694,9 @@ @@ -723,11 +723,11 @@ main (int argc, char **argv)
|| (operation == MTDATCOMP) #ifdef MTDATCOMP
case MTDATCOMP:
#endif #endif
) - tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option);
- tapedesc = rmtopen (tapedev, O_WRONLY, 0, rsh_command_option); + tapedesc = rmtopen (tapedev, O_WRONLY | O_NONBLOCK, 0, rsh_command_option);
+ tapedesc = rmtopen (tapedev, O_WRONLY | O_NONBLOCK, 0, rsh_command_option); break;
else
- tapedesc = rmtopen (tapedev, O_RDONLY, 0, rsh_command_option); default:
+ tapedesc = rmtopen (tapedev, O_RDONLY | O_NONBLOCK, 0, rsh_command_option); - tapedesc = rmtopen (tapedev, O_RDONLY, 0, rsh_command_option);
+ tapedesc = rmtopen (tapedev, O_RDONLY | O_NONBLOCK, 0, rsh_command_option);
}
if (tapedesc == -1) if (tapedesc == -1)
error (1, errno, _("%s: rmtopen failed"), tapedev); Index: src/util.c
check_type (tapedev, tapedesc); ===================================================================
--- src/util.c --- src/util.c.orig
+++ src/util.c +++ src/util.c
@@ -753,14 +753,14 @@ @@ -767,14 +767,14 @@ open_archive (char *file)
copy_in = process_copy_in; copy_in = process_copy_in;
if (copy_function == copy_in) if (copy_function == copy_in)

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Fri Mar 12 16:34:39 UTC 2010 - mseben@novell.com
- updated to 2.11
* Fix mt build.
* In copy-in mode, if directory attributes do not permit writing to it,
setting them is delayed until the end of run. This allows to
correctly extract files in such directories.
* In copy-in mode, permissions of a directory are restored if it
appears in the file list after files in it (e.g. in listings
produced by find . -depth). This fixes debian bug #458079.
* Fix possible memory overflow in the rmt client code (CVE-2010-0624).
- deprecated heap_overflow_in_rtapelib.patch,chmodRaceC.patch and
include_fatal_c.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Mar 3 09:29:23 UTC 2010 - mseben@novell.com Wed Mar 3 09:29:23 UTC 2010 - mseben@novell.com

View File

@ -1,5 +1,5 @@
# #
# spec file for package cpio (Version 2.10) # spec file for package cpio (Version 2.11)
# #
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
@ -23,29 +23,24 @@ Url: http://www.gnu.org/software/cpio/cpio.html
License: GPLv3 License: GPLv3
Group: Productivity/Archiving/Compression Group: Productivity/Archiving/Compression
AutoReqProv: on AutoReqProv: on
Version: 2.10 Version: 2.11
Release: 6 Release: 1
Summary: A Backup and Archiving Utility Summary: A Backup and Archiving Utility
Source: %{name}-%{version}.tar.bz2 Source: %{name}-%{version}.tar.bz2
Patch2: %{name}-%{version}-use_new_ascii_format.patch Patch2: %{name}-use_new_ascii_format.patch
Patch3: %{name}-%{version}-mt.patch #oouch what a ...?! pieces of code grabed from mt_st package to add missing functionality (e.g. density info)
Patch4: %{name}-%{version}-use_sbin_rmt.patch Patch3: %{name}-mt.patch
Patch5: %{name}-%{version}-open_nonblock.patch Patch4: %{name}-use_sbin_rmt.patch
Patch7: %{name}-%{version}-chmodRaceC.patch Patch5: %{name}-open_nonblock.patch
#patch dir_perm reverts some things which were added by patch #7 chmodRaceC #patch dir_perm reverts some things which were added by patch #7 chmodRaceC
Patch14: %{name}-%{version}-dir_perm.patch Patch14: %{name}-dir_perm.patch
Patch15: %{name}-%{version}-eof_tape_handling.patch Patch15: %{name}-eof_tape_handling.patch
# make posibble to have device nodes with major number > 127 # make posibble to have device nodes with major number > 127
# Red Hat Bugzilla #450109 # Red Hat Bugzilla #450109
Patch17: %{name}-%{version}-dev_number.patch Patch17: %{name}-dev_number.patch
Patch18: %{name}-%{version}-default_tape_dev.patch Patch18: %{name}-default_tape_dev.patch
#PATCH-FIX-UPSTREAM include_fatal_c.patch fix undefined ref in mt build
Patch19: %{name}-%{version}-include_fatal_c.patch
#PATCH-FIX-UPSTREAM cpio-2.10-close_files_after_copy.patch #PATCH-FIX-UPSTREAM cpio-2.10-close_files_after_copy.patch
Patch20: %{name}-%{version}-close_files_after_copy.patch Patch20: %{name}-close_files_after_copy.patch
#fix possible heap overflow in rtapelib.c bnc#579475
Patch21: %{name}-%{version}-heap_overflow_in_rtapelib.patch
PreReq: %install_info_prereq
PreReq: %install_info_prereq PreReq: %install_info_prereq
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: %{name}-lang = %{version} Requires: %{name}-lang = %{version}
@ -76,14 +71,11 @@ Authors:
%patch3 %patch3
%patch4 %patch4
%patch5 %patch5
%patch7
%patch14 -p1 %patch14 -p1
%patch15 %patch15
%patch17 %patch17
%patch18 %patch18
%patch19
%patch20 %patch20
%patch21 -p1
#chmod 755 . #chmod 755 .
#chmod u+w * #chmod u+w *
#chmod a+r * #chmod a+r *