version update 2.9
This commit is contained in:
parent
e716c0efad
commit
e98db3713f
@ -1,2 +1,2 @@
|
|||||||
cpio-2.6.tar.gz
|
cpio-2.9.tar.gz
|
||||||
cpio.1
|
cpio.1
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
--- cpio-2.5/configure.nolibnsl 2004-09-08 11:43:38.000000000 +0000
|
|
||||||
+++ cpio-2.5/configure 2004-11-04 12:44:10.093187568 +0000
|
|
||||||
@@ -13564,7 +13564,7 @@
|
|
||||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
|
||||||
else
|
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
|
||||||
-LIBS="-lnsl $LIBS"
|
|
||||||
+LIBS="-lXXXnsl $LIBS"
|
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
|
||||||
/* confdefs.h. */
|
|
||||||
_ACEOF
|
|
@ -1,33 +0,0 @@
|
|||||||
--- cpio-2.6/src/extern.h.checksum 2005-10-26 11:17:11.000000000 +0200
|
|
||||||
+++ cpio-2.6/src/extern.h 2005-10-26 11:15:42.000000000 +0200
|
|
||||||
@@ -66,7 +66,7 @@
|
|
||||||
extern int archive_des;
|
|
||||||
extern char *archive_name;
|
|
||||||
extern char *rsh_command_option;
|
|
||||||
-extern unsigned long crc;
|
|
||||||
+extern unsigned int crc;
|
|
||||||
extern int delayed_seek_count;
|
|
||||||
#ifdef DEBUG_CPIO
|
|
||||||
extern int debug_flag;
|
|
||||||
--- cpio-2.6/src/copyout.c.checksum 2005-10-26 11:17:11.000000000 +0200
|
|
||||||
+++ cpio-2.6/src/copyout.c 2005-10-26 11:20:01.000000000 +0200
|
|
||||||
@@ -311,7 +311,7 @@
|
|
||||||
file_hdr->c_gid, file_hdr->c_nlink, file_hdr->c_mtime,
|
|
||||||
file_hdr->c_filesize, file_hdr->c_dev_maj, file_hdr->c_dev_min,
|
|
||||||
file_hdr->c_rdev_maj, file_hdr->c_rdev_min, file_hdr->c_namesize,
|
|
||||||
- file_hdr->c_chksum);
|
|
||||||
+ file_hdr->c_chksum & 0xffffffff);
|
|
||||||
tape_buffered_write (ascii_header, out_des, 110L);
|
|
||||||
|
|
||||||
/* Write file name to output. */
|
|
||||||
--- cpio-2.6/src/global.c.checksum 2005-10-26 11:17:11.000000000 +0200
|
|
||||||
+++ cpio-2.6/src/global.c 2005-10-26 11:15:29.000000000 +0200
|
|
||||||
@@ -139,7 +139,7 @@
|
|
||||||
char *rsh_command_option = NULL;
|
|
||||||
|
|
||||||
/* CRC checksum. */
|
|
||||||
-unsigned long crc;
|
|
||||||
+unsigned int crc;
|
|
||||||
|
|
||||||
/* Input and output buffers. */
|
|
||||||
char *input_buffer, *output_buffer;
|
|
@ -1,247 +0,0 @@
|
|||||||
--- cpio-2.6/src/copyin.c.chmodRaceC 2005-07-01 14:23:04.000000000 +0200
|
|
||||||
+++ cpio-2.6/src/copyin.c 2005-07-01 14:46:34.000000000 +0200
|
|
||||||
@@ -184,11 +184,12 @@
|
|
||||||
|
|
||||||
static int
|
|
||||||
try_existing_file(struct new_cpio_header* 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)
|
|
||||||
@@ -198,6 +199,7 @@
|
|
||||||
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
|
|
||||||
@@ -389,19 +391,20 @@
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (close (out_file_des) < 0)
|
|
||||||
- error (0, errno, "%s", d->header.c_name);
|
|
||||||
-
|
|
||||||
/* File is now copied; set attributes. */
|
|
||||||
if (!no_chown_flag)
|
|
||||||
- if ((chown (d->header.c_name,
|
|
||||||
+ if ((fchown (out_file_des,
|
|
||||||
set_owner_flag ? set_owner : d->header.c_uid,
|
|
||||||
set_group_flag ? set_group : d->header.c_gid) < 0)
|
|
||||||
&& errno != EPERM)
|
|
||||||
error (0, errno, "%s", d->header.c_name);
|
|
||||||
/* chown may have turned off some permissions we wanted. */
|
|
||||||
- if (chmod (d->header.c_name, (int) d->header.c_mode) < 0)
|
|
||||||
+ if (fchmod (out_file_des, (int) d->header.c_mode) < 0)
|
|
||||||
error (0, errno, "%s", d->header.c_name);
|
|
||||||
+
|
|
||||||
+ if (close (out_file_des) < 0)
|
|
||||||
+ error (0, errno, "%s", d->header.c_name);
|
|
||||||
+
|
|
||||||
if (retain_time_flag)
|
|
||||||
{
|
|
||||||
times.actime = times.modtime = d->header.c_mtime;
|
|
||||||
@@ -557,6 +560,19 @@
|
|
||||||
write (out_file_des, "", 1);
|
|
||||||
delayed_seek_count = 0;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ /* File is now copied; set attributes. */
|
|
||||||
+ if (!no_chown_flag)
|
|
||||||
+ if ((fchown (out_file_des,
|
|
||||||
+ set_owner_flag ? set_owner : file_hdr->c_uid,
|
|
||||||
+ set_group_flag ? set_group : file_hdr->c_gid) < 0)
|
|
||||||
+ && errno != EPERM)
|
|
||||||
+ error (0, errno, "%s", file_hdr->c_name);
|
|
||||||
+
|
|
||||||
+ /* chown may have turned off some permissions we wanted. */
|
|
||||||
+ if (fchmod (out_file_des, (int) file_hdr->c_mode) < 0)
|
|
||||||
+ error (0, errno, "%s", file_hdr->c_name);
|
|
||||||
+
|
|
||||||
if (close (out_file_des) < 0)
|
|
||||||
error (0, errno, "%s", file_hdr->c_name);
|
|
||||||
|
|
||||||
@@ -567,18 +583,6 @@
|
|
||||||
file_hdr->c_name, crc, file_hdr->c_chksum);
|
|
||||||
}
|
|
||||||
|
|
||||||
- /* File is now copied; set attributes. */
|
|
||||||
- if (!no_chown_flag)
|
|
||||||
- if ((chown (file_hdr->c_name,
|
|
||||||
- set_owner_flag ? set_owner : file_hdr->c_uid,
|
|
||||||
- set_group_flag ? set_group : file_hdr->c_gid) < 0)
|
|
||||||
- && errno != EPERM)
|
|
||||||
- error (0, errno, "%s", file_hdr->c_name);
|
|
||||||
-
|
|
||||||
- /* chown may have turned off some permissions we wanted. */
|
|
||||||
- if (chmod (file_hdr->c_name, (int) file_hdr->c_mode) < 0)
|
|
||||||
- error (0, errno, "%s", file_hdr->c_name);
|
|
||||||
-
|
|
||||||
if (retain_time_flag)
|
|
||||||
{
|
|
||||||
struct utimbuf times; /* For setting file times. */
|
|
||||||
@@ -589,7 +593,7 @@
|
|
||||||
if (utime (file_hdr->c_name, ×) < 0)
|
|
||||||
error (0, errno, "%s", file_hdr->c_name);
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+
|
|
||||||
tape_skip_padding (in_file_des, file_hdr->c_filesize);
|
|
||||||
if (file_hdr->c_nlink > 1
|
|
||||||
&& (archive_format == arf_newascii || archive_format == arf_crcascii) )
|
|
||||||
@@ -603,7 +607,7 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
-copyin_directory(struct new_cpio_header* file_hdr, int existing_dir)
|
|
||||||
+copyin_directory(struct new_cpio_header* file_hdr, int existing_dir, mode_t existing_mode)
|
|
||||||
{
|
|
||||||
int res; /* Result of various function calls. */
|
|
||||||
#ifdef HPUX_CDF
|
|
||||||
@@ -646,14 +650,23 @@
|
|
||||||
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;
|
|
||||||
+ 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;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
@@ -742,12 +755,12 @@
|
|
||||||
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)
|
|
||||||
@@ -826,9 +839,10 @@
|
|
||||||
copyin_file (struct new_cpio_header* 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. */
|
|
||||||
@@ -839,7 +853,7 @@
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CP_IFDIR:
|
|
||||||
- copyin_directory(file_hdr, existing_dir);
|
|
||||||
+ copyin_directory(file_hdr, existing_dir, existing_mode);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CP_IFCHR:
|
|
||||||
--- cpio-2.6/src/copypass.c.chmodRaceC 2004-09-06 14:09:04.000000000 +0200
|
|
||||||
+++ cpio-2.6/src/copypass.c 2005-07-01 14:50:46.000000000 +0200
|
|
||||||
@@ -181,19 +181,25 @@
|
|
||||||
}
|
|
||||||
if (close (in_file_des) < 0)
|
|
||||||
error (0, errno, "%s", input_name.ds_string);
|
|
||||||
- if (close (out_file_des) < 0)
|
|
||||||
- error (0, errno, "%s", output_name.ds_string);
|
|
||||||
-
|
|
||||||
+ /*
|
|
||||||
+ * Avoid race condition.
|
|
||||||
+ * Set chown and chmod before closing the file desc.
|
|
||||||
+ * pvrabec@redhat.com
|
|
||||||
+ */
|
|
||||||
/* Set the attributes of the new file. */
|
|
||||||
if (!no_chown_flag)
|
|
||||||
- if ((chown (output_name.ds_string,
|
|
||||||
+ if ((fchown (out_file_des,
|
|
||||||
set_owner_flag ? set_owner : in_file_stat.st_uid,
|
|
||||||
set_group_flag ? set_group : in_file_stat.st_gid) < 0)
|
|
||||||
&& errno != EPERM)
|
|
||||||
error (0, errno, "%s", output_name.ds_string);
|
|
||||||
/* chown may have turned off some permissions we wanted. */
|
|
||||||
- if (chmod (output_name.ds_string, in_file_stat.st_mode) < 0)
|
|
||||||
+ if (fchmod (out_file_des, in_file_stat.st_mode) < 0)
|
|
||||||
error (0, errno, "%s", output_name.ds_string);
|
|
||||||
+
|
|
||||||
+ if (close (out_file_des) < 0)
|
|
||||||
+ error (0, errno, "%s", output_name.ds_string);
|
|
||||||
+
|
|
||||||
if (reset_time_flag)
|
|
||||||
{
|
|
||||||
times.actime = in_file_stat.st_atime;
|
|
||||||
@@ -240,15 +246,24 @@
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
@@ -311,12 +326,12 @@
|
|
||||||
|
|
||||||
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)
|
|
@ -1,193 +0,0 @@
|
|||||||
--- cpio-2.6/doc/cpio.1.dirTraversal 2005-05-17 13:18:23.554759017 +0200
|
|
||||||
+++ cpio-2.6/doc/cpio.1 2005-05-17 13:19:08.178249507 +0200
|
|
||||||
@@ -20,7 +20,7 @@
|
|
||||||
[\-\-unconditional] [\-\-verbose] [\-\-block-size=blocks] [\-\-swap-halfwords]
|
|
||||||
[\-\-io-size=bytes] [\-\-pattern-file=file] [\-\-format=format]
|
|
||||||
[\-\-owner=[user][:.][group]] [\-\-no-preserve-owner] [\-\-message=message]
|
|
||||||
-[\-\-force\-local] [\-\-no\-absolute\-filenames] [\-\-sparse]
|
|
||||||
+[\-\-force\-local] [\-\-absolute\-filenames] [\-\-sparse]
|
|
||||||
[\-\-only\-verify\-crc] [\-\-quiet] [\-\-rsh-command=command] [\-\-help]
|
|
||||||
[\-\-version] [pattern...] [< archive]
|
|
||||||
|
|
||||||
--- cpio-2.6/doc/cpio.info.dirTraversal 2005-05-17 13:20:29.473392159 +0200
|
|
||||||
+++ cpio-2.6/doc/cpio.info 2005-05-17 13:30:53.812050889 +0200
|
|
||||||
@@ -203,7 +203,7 @@
|
|
||||||
[--swap-halfwords] [--io-size=bytes] [--pattern-file=file]
|
|
||||||
[--format=format] [--owner=[user][:.][group]]
|
|
||||||
[--no-preserve-owner] [--message=message] [--help] [--version]
|
|
||||||
- [-no-absolute-filenames] [--sparse] [-only-verify-crc] [-quiet]
|
|
||||||
+ [--absolute-filenames] [--sparse] [-only-verify-crc] [-quiet]
|
|
||||||
[--rsh-command=command] [pattern...] [< archive]
|
|
||||||
|
|
||||||
|
|
||||||
@@ -359,9 +359,9 @@
|
|
||||||
Show numeric UID and GID instead of translating them into names
|
|
||||||
when using the `--verbose option'.
|
|
||||||
|
|
||||||
-`--no-absolute-filenames'
|
|
||||||
- Create all files relative to the current directory in copy-in
|
|
||||||
- mode, even if they have an absolute file name in the archive.
|
|
||||||
+`--absolute-filenames'
|
|
||||||
+ Do not strip leading file name components that contain ".."
|
|
||||||
+ and leading slashes from file names in copy-in mode
|
|
||||||
|
|
||||||
`--no-preserve-owner'
|
|
||||||
Do not change the ownership of the files; leave them owned by the
|
|
||||||
--- cpio-2.6/src/main.c.dirTraversal 2005-05-17 12:10:15.952492515 +0200
|
|
||||||
+++ cpio-2.6/src/main.c 2005-05-17 12:10:15.965490607 +0200
|
|
||||||
@@ -41,6 +41,7 @@
|
|
||||||
|
|
||||||
enum cpio_options {
|
|
||||||
NO_ABSOLUTE_FILENAMES_OPTION=256,
|
|
||||||
+ ABSOLUTE_FILENAMES_OPTION,
|
|
||||||
NO_PRESERVE_OWNER_OPTION,
|
|
||||||
ONLY_VERIFY_CRC_OPTION,
|
|
||||||
RENAME_BATCH_FILE_OPTION,
|
|
||||||
@@ -134,6 +135,8 @@
|
|
||||||
N_("In copy-in mode, read additional patterns specifying filenames to extract or list from FILE"), 210},
|
|
||||||
{"no-absolute-filenames", NO_ABSOLUTE_FILENAMES_OPTION, 0, 0,
|
|
||||||
N_("Create all files relative to the current directory"), 210},
|
|
||||||
+ {"absolute-filenames", ABSOLUTE_FILENAMES_OPTION, 0, 0,
|
|
||||||
+ N_("do not strip leading file name components that contain \"..\" and leading slashes from file names"), 210},
|
|
||||||
{"only-verify-crc", ONLY_VERIFY_CRC_OPTION, 0, 0,
|
|
||||||
N_("When reading a CRC format archive in copy-in mode, only verify the CRC's of each file in the archive, don't actually extract the files"), 210},
|
|
||||||
{"rename", 'r', 0, 0,
|
|
||||||
@@ -393,7 +396,11 @@
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NO_ABSOLUTE_FILENAMES_OPTION: /* --no-absolute-filenames */
|
|
||||||
- no_abs_paths_flag = true;
|
|
||||||
+ abs_paths_flag = false;
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
+ case ABSOLUTE_FILENAMES_OPTION: /* --absolute-filenames */
|
|
||||||
+ abs_paths_flag = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NO_PRESERVE_OWNER_OPTION: /* --no-preserve-owner */
|
|
||||||
@@ -632,7 +639,7 @@
|
|
||||||
_("--append is used but no archive file name is given (use -F or -O options")));
|
|
||||||
|
|
||||||
CHECK_USAGE(rename_batch_file, "--rename-batch-file", "--create");
|
|
||||||
- CHECK_USAGE(no_abs_paths_flag, "--no-absolute-pathnames", "--create");
|
|
||||||
+ CHECK_USAGE(abs_paths_flag, "--absolute-pathnames", "--create");
|
|
||||||
CHECK_USAGE(input_archive_name, "-I", "--create");
|
|
||||||
if (archive_name && output_archive_name)
|
|
||||||
USAGE_ERROR ((0, 0, _("Both -O and -F are used in copy-out mode")));
|
|
||||||
@@ -659,7 +666,7 @@
|
|
||||||
CHECK_USAGE(rename_flag, "--rename", "--pass-through");
|
|
||||||
CHECK_USAGE(append_flag, "--append", "--pass-through");
|
|
||||||
CHECK_USAGE(rename_batch_file, "--rename-batch-file", "--pass-through");
|
|
||||||
- CHECK_USAGE(no_abs_paths_flag, "--no-absolute-pathnames",
|
|
||||||
+ CHECK_USAGE(abs_paths_flag, "--absolute-pathnames",
|
|
||||||
"--pass-through");
|
|
||||||
CHECK_USAGE(to_stdout_option, "--to-stdout", "--pass-through");
|
|
||||||
|
|
||||||
--- cpio-2.6/src/copyin.c.dirTraversal 2005-05-17 12:10:15.957491781 +0200
|
|
||||||
+++ cpio-2.6/src/copyin.c 2005-05-17 12:10:15.962491047 +0200
|
|
||||||
@@ -25,6 +25,7 @@
|
|
||||||
#include "dstring.h"
|
|
||||||
#include "extern.h"
|
|
||||||
#include "defer.h"
|
|
||||||
+#include "dirname.h"
|
|
||||||
#include <rmt.h>
|
|
||||||
#ifndef FNM_PATHNAME
|
|
||||||
#include <fnmatch.h>
|
|
||||||
@@ -1349,6 +1350,53 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* Return a safer suffix of FILE_NAME, or "." if it has no safer
|
|
||||||
+ suffix. Check for fully specified file names and other atrocities. */
|
|
||||||
+
|
|
||||||
+static const char *
|
|
||||||
+safer_name_suffix (char const *file_name)
|
|
||||||
+{
|
|
||||||
+ char const *p;
|
|
||||||
+
|
|
||||||
+ /* Skip file system prefixes, leading file name components that contain
|
|
||||||
+ "..", and leading slashes. */
|
|
||||||
+
|
|
||||||
+ size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (file_name);
|
|
||||||
+
|
|
||||||
+ for (p = file_name + prefix_len; *p;)
|
|
||||||
+ {
|
|
||||||
+ if (p[0] == '.' && p[1] == '.' && (ISSLASH (p[2]) || !p[2]))
|
|
||||||
+ prefix_len = p + 2 - file_name;
|
|
||||||
+
|
|
||||||
+ do
|
|
||||||
+ {
|
|
||||||
+ char c = *p++;
|
|
||||||
+ if (ISSLASH (c))
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ while (*p);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (p = file_name + prefix_len; ISSLASH (*p); p++)
|
|
||||||
+ continue;
|
|
||||||
+ prefix_len = p - file_name;
|
|
||||||
+
|
|
||||||
+ if (prefix_len)
|
|
||||||
+ {
|
|
||||||
+ char *prefix = alloca (prefix_len + 1);
|
|
||||||
+ memcpy (prefix, file_name, prefix_len);
|
|
||||||
+ prefix[prefix_len] = '\0';
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ error (0, 0, _("Removing leading `%s' from member names"), prefix);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!*p)
|
|
||||||
+ p = ".";
|
|
||||||
+
|
|
||||||
+ return p;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* Read the collection from standard input and create files
|
|
||||||
in the file system. */
|
|
||||||
|
|
||||||
@@ -1459,18 +1507,11 @@
|
|
||||||
|
|
||||||
/* Do we have to ignore absolute paths, and if so, does the filename
|
|
||||||
have an absolute path? */
|
|
||||||
- if (no_abs_paths_flag && file_hdr.c_name && file_hdr.c_name [0] == '/')
|
|
||||||
+ if (!abs_paths_flag && file_hdr.c_name && file_hdr.c_name [0])
|
|
||||||
{
|
|
||||||
- char *p;
|
|
||||||
+ const char *p = safer_name_suffix (file_hdr.c_name);
|
|
||||||
|
|
||||||
- p = file_hdr.c_name;
|
|
||||||
- while (*p == '/')
|
|
||||||
- ++p;
|
|
||||||
- if (*p == '\0')
|
|
||||||
- {
|
|
||||||
- strcpy (file_hdr.c_name, ".");
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
+ if (p != file_hdr.c_name)
|
|
||||||
{
|
|
||||||
/* Debian hack: file_hrd.c_name is sometimes set to
|
|
||||||
point to static memory by code in tar.c. This
|
|
||||||
--- cpio-2.6/src/extern.h.dirTraversal 2005-05-17 12:10:15.944493689 +0200
|
|
||||||
+++ cpio-2.6/src/extern.h 2005-05-17 12:10:15.963490900 +0200
|
|
||||||
@@ -46,7 +46,7 @@
|
|
||||||
extern int sparse_flag;
|
|
||||||
extern int quiet_flag;
|
|
||||||
extern int only_verify_crc_flag;
|
|
||||||
-extern int no_abs_paths_flag;
|
|
||||||
+extern int abs_paths_flag;
|
|
||||||
extern unsigned int warn_option;
|
|
||||||
|
|
||||||
/* Values for warn_option */
|
|
||||||
--- cpio-2.6/src/global.c.dirTraversal 2004-09-08 12:23:44.000000000 +0200
|
|
||||||
+++ cpio-2.6/src/global.c 2005-05-17 12:10:15.964490753 +0200
|
|
||||||
@@ -100,7 +100,7 @@
|
|
||||||
int only_verify_crc_flag = false;
|
|
||||||
|
|
||||||
/* If true, don't use any absolute paths, prefix them by `./'. */
|
|
||||||
-int no_abs_paths_flag = false;
|
|
||||||
+int abs_paths_flag = false;
|
|
||||||
|
|
||||||
#ifdef DEBUG_CPIO
|
|
||||||
/* If true, print debugging information. */
|
|
@ -1,11 +0,0 @@
|
|||||||
--- cpio-2.6/src/copyin.c.initHeaderStruct 2006-03-23 10:59:31.000000000 +0100
|
|
||||||
+++ cpio-2.6/src/copyin.c 2006-03-23 10:59:55.000000000 +0100
|
|
||||||
@@ -1407,7 +1407,7 @@
|
|
||||||
FILE *tty_out = NULL; /* Interactive file for rename option. */
|
|
||||||
FILE *rename_in = NULL; /* Batch file for rename option. */
|
|
||||||
struct stat file_stat; /* Output file stat record. */
|
|
||||||
- struct new_cpio_header file_hdr; /* Output header information. */
|
|
||||||
+ struct new_cpio_header file_hdr = {0}; /* Output header information. */
|
|
||||||
int in_file_des; /* Input file descriptor. */
|
|
||||||
char skip_file; /* Flag for use with patterns. */
|
|
||||||
int i; /* Loop index variable. */
|
|
@ -1,255 +0,0 @@
|
|||||||
--- cpio-2.6/src/util.c.lfs 2004-09-08 12:44:49.000000000 +0200
|
|
||||||
+++ cpio-2.6/src/util.c 2006-03-25 13:34:10.000000000 +0100
|
|
||||||
@@ -207,7 +207,7 @@
|
|
||||||
Exit with an error if end of file is reached. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
-disk_fill_input_buffer (int in_des, int num_bytes)
|
|
||||||
+disk_fill_input_buffer (int in_des, off_t num_bytes)
|
|
||||||
{
|
|
||||||
in_buff = input_buffer;
|
|
||||||
num_bytes = (num_bytes < DISK_IO_BLOCK_SIZE) ? num_bytes : DISK_IO_BLOCK_SIZE;
|
|
||||||
@@ -227,10 +227,10 @@
|
|
||||||
When `out_buff' fills up, flush it to file descriptor OUT_DES. */
|
|
||||||
|
|
||||||
void
|
|
||||||
-tape_buffered_write (char *in_buf, int out_des, long num_bytes)
|
|
||||||
+tape_buffered_write (char *in_buf, int out_des, off_t num_bytes)
|
|
||||||
{
|
|
||||||
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
|
|
||||||
- register long space_left; /* Room left in output buffer. */
|
|
||||||
+ off_t bytes_left = num_bytes; /* Bytes needing to be copied. */
|
|
||||||
+ off_t space_left; /* Room left in output buffer. */
|
|
||||||
|
|
||||||
while (bytes_left > 0)
|
|
||||||
{
|
|
||||||
@@ -254,10 +254,10 @@
|
|
||||||
When `out_buff' fills up, flush it to file descriptor OUT_DES. */
|
|
||||||
|
|
||||||
void
|
|
||||||
-disk_buffered_write (char *in_buf, int out_des, long num_bytes)
|
|
||||||
+disk_buffered_write (char *in_buf, int out_des, off_t num_bytes)
|
|
||||||
{
|
|
||||||
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
|
|
||||||
- register long space_left; /* Room left in output buffer. */
|
|
||||||
+ off_t bytes_left = num_bytes; /* Bytes needing to be copied. */
|
|
||||||
+ off_t space_left; /* Room left in output buffer. */
|
|
||||||
|
|
||||||
while (bytes_left > 0)
|
|
||||||
{
|
|
||||||
@@ -282,10 +282,10 @@
|
|
||||||
When `in_buff' is exhausted, refill it from file descriptor IN_DES. */
|
|
||||||
|
|
||||||
void
|
|
||||||
-tape_buffered_read (char *in_buf, int in_des, long num_bytes)
|
|
||||||
+tape_buffered_read (char *in_buf, int in_des, off_t num_bytes)
|
|
||||||
{
|
|
||||||
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
|
|
||||||
- register long space_left; /* Bytes to copy from input buffer. */
|
|
||||||
+ off_t bytes_left = num_bytes; /* Bytes needing to be copied. */
|
|
||||||
+ off_t space_left; /* Bytes to copy from input buffer. */
|
|
||||||
|
|
||||||
while (bytes_left > 0)
|
|
||||||
{
|
|
||||||
@@ -376,10 +376,10 @@
|
|
||||||
/* Skip the next NUM_BYTES bytes of file descriptor IN_DES. */
|
|
||||||
|
|
||||||
void
|
|
||||||
-tape_toss_input (int in_des, long num_bytes)
|
|
||||||
+tape_toss_input (int in_des, off_t num_bytes)
|
|
||||||
{
|
|
||||||
- register long bytes_left = num_bytes; /* Bytes needing to be copied. */
|
|
||||||
- register long space_left; /* Bytes to copy from input buffer. */
|
|
||||||
+ off_t bytes_left = num_bytes; /* Bytes needing to be copied. */
|
|
||||||
+ off_t space_left; /* Bytes to copy from input buffer. */
|
|
||||||
|
|
||||||
while (bytes_left > 0)
|
|
||||||
{
|
|
||||||
@@ -404,12 +404,12 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
-write_nuls_to_file (long num_bytes, int out_des,
|
|
||||||
- void (*writer) (char *in_buf, int out_des, long num_bytes))
|
|
||||||
+write_nuls_to_file (off_t num_bytes, int out_des,
|
|
||||||
+ void (*writer) (char *in_buf, int out_des, off_t num_bytes))
|
|
||||||
{
|
|
||||||
- long blocks;
|
|
||||||
- long extra_bytes;
|
|
||||||
- long i;
|
|
||||||
+ off_t blocks;
|
|
||||||
+ off_t extra_bytes;
|
|
||||||
+ off_t i;
|
|
||||||
|
|
||||||
blocks = num_bytes / 512;
|
|
||||||
extra_bytes = num_bytes % 512;
|
|
||||||
@@ -428,7 +428,7 @@
|
|
||||||
NUM_BYTES is the number of bytes to copy. */
|
|
||||||
|
|
||||||
void
|
|
||||||
-copy_files_tape_to_disk (int in_des, int out_des, long num_bytes)
|
|
||||||
+copy_files_tape_to_disk (int in_des, int out_des, off_t num_bytes)
|
|
||||||
{
|
|
||||||
long size;
|
|
||||||
long k;
|
|
||||||
@@ -458,13 +458,13 @@
|
|
||||||
NUM_BYTES is the number of bytes to copy. */
|
|
||||||
|
|
||||||
void
|
|
||||||
-copy_files_disk_to_tape (int in_des, int out_des, long num_bytes,
|
|
||||||
+copy_files_disk_to_tape (int in_des, int out_des, off_t num_bytes,
|
|
||||||
char *filename)
|
|
||||||
{
|
|
||||||
long size;
|
|
||||||
long k;
|
|
||||||
int rc;
|
|
||||||
- long original_num_bytes;
|
|
||||||
+ off_t original_num_bytes;
|
|
||||||
|
|
||||||
original_num_bytes = num_bytes;
|
|
||||||
|
|
||||||
@@ -476,10 +476,10 @@
|
|
||||||
num_bytes : DISK_IO_BLOCK_SIZE))
|
|
||||||
{
|
|
||||||
if (rc > 0)
|
|
||||||
- error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"),
|
|
||||||
+ error (0, 0, _("File %s shrunk by %lld bytes, padding with zeros"),
|
|
||||||
filename, num_bytes);
|
|
||||||
else
|
|
||||||
- error (0, 0, _("Read error at byte %ld in file %s, padding with zeros"),
|
|
||||||
+ error (0, 0, _("Read error at byte %lld in file %s, padding with zeros"),
|
|
||||||
original_num_bytes - num_bytes, filename);
|
|
||||||
write_nuls_to_file (num_bytes, out_des, tape_buffered_write);
|
|
||||||
break;
|
|
||||||
@@ -505,12 +505,12 @@
|
|
||||||
NUM_BYTES is the number of bytes to copy. */
|
|
||||||
|
|
||||||
void
|
|
||||||
-copy_files_disk_to_disk (int in_des, int out_des, long num_bytes,
|
|
||||||
+copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes,
|
|
||||||
char *filename)
|
|
||||||
{
|
|
||||||
long size;
|
|
||||||
long k;
|
|
||||||
- long original_num_bytes;
|
|
||||||
+ off_t original_num_bytes;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
original_num_bytes = num_bytes;
|
|
||||||
@@ -520,10 +520,10 @@
|
|
||||||
if (rc = disk_fill_input_buffer (in_des, num_bytes))
|
|
||||||
{
|
|
||||||
if (rc > 0)
|
|
||||||
- error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"),
|
|
||||||
+ error (0, 0, _("File %s shrunk by %lld bytes, padding with zeros"),
|
|
||||||
filename, num_bytes);
|
|
||||||
else
|
|
||||||
- error (0, 0, _("Read error at byte %ld in file %s, padding with zeros"),
|
|
||||||
+ error (0, 0, _("Read error at byte %lld in file %s, padding with zeros"),
|
|
||||||
original_num_bytes - num_bytes, filename);
|
|
||||||
write_nuls_to_file (num_bytes, out_des, disk_buffered_write);
|
|
||||||
break;
|
|
||||||
@@ -544,7 +544,7 @@
|
|
||||||
/* Warn if file changed while it was being copied. */
|
|
||||||
|
|
||||||
void
|
|
||||||
-warn_if_file_changed (char *file_name, unsigned long old_file_size,
|
|
||||||
+warn_if_file_changed (char *file_name, off_t old_file_size,
|
|
||||||
unsigned long old_file_mtime)
|
|
||||||
{
|
|
||||||
struct stat new_file_stat;
|
|
||||||
@@ -696,8 +696,8 @@
|
|
||||||
temp = (temp + 1) % hash_size)
|
|
||||||
{
|
|
||||||
if (hash_table[temp]->inode == node_num
|
|
||||||
- && hash_table[start]->major_num == major_num
|
|
||||||
- && hash_table[start]->minor_num == minor_num)
|
|
||||||
+ && hash_table[temp]->major_num == major_num
|
|
||||||
+ && hash_table[temp]->minor_num == minor_num)
|
|
||||||
return hash_table[temp]->file_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--- cpio-2.6/src/copyin.c.lfs 2004-09-08 13:10:02.000000000 +0200
|
|
||||||
+++ cpio-2.6/src/copyin.c 2006-03-25 13:35:43.000000000 +0100
|
|
||||||
@@ -106,7 +106,7 @@
|
|
||||||
header type. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
-tape_skip_padding (int in_file_des, int offset)
|
|
||||||
+tape_skip_padding (int in_file_des, off_t offset)
|
|
||||||
{
|
|
||||||
int pad;
|
|
||||||
|
|
||||||
@@ -911,7 +911,7 @@
|
|
||||||
printf ("%3u, %3u ", file_hdr->c_rdev_maj,
|
|
||||||
file_hdr->c_rdev_min);
|
|
||||||
else
|
|
||||||
- printf ("%8lu ", file_hdr->c_filesize);
|
|
||||||
+ printf ("%8llu ", file_hdr->c_filesize);
|
|
||||||
|
|
||||||
printf ("%s ", tbuf + 4);
|
|
||||||
|
|
||||||
@@ -1153,7 +1153,7 @@
|
|
||||||
tape_buffered_read (ascii_header, in_des, 70L);
|
|
||||||
ascii_header[70] = '\0';
|
|
||||||
sscanf (ascii_header,
|
|
||||||
- "%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11lo",
|
|
||||||
+ "%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11llo",
|
|
||||||
&dev, &file_hdr->c_ino,
|
|
||||||
&file_hdr->c_mode, &file_hdr->c_uid, &file_hdr->c_gid,
|
|
||||||
&file_hdr->c_nlink, &rdev, &file_hdr->c_mtime,
|
|
||||||
@@ -1211,7 +1211,7 @@
|
|
||||||
tape_buffered_read (ascii_header, in_des, 104L);
|
|
||||||
ascii_header[104] = '\0';
|
|
||||||
sscanf (ascii_header,
|
|
||||||
- "%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx",
|
|
||||||
+ "%8lx%8lx%8lx%8lx%8lx%8lx%8llx%8lx%8lx%8lx%8lx%8lx%8lx",
|
|
||||||
&file_hdr->c_ino, &file_hdr->c_mode, &file_hdr->c_uid,
|
|
||||||
&file_hdr->c_gid, &file_hdr->c_nlink, &file_hdr->c_mtime,
|
|
||||||
&file_hdr->c_filesize, &file_hdr->c_dev_maj, &file_hdr->c_dev_min,
|
|
||||||
--- cpio-2.6/src/extern.h.lfs 2004-09-08 12:49:57.000000000 +0200
|
|
||||||
+++ cpio-2.6/src/extern.h 2006-03-25 13:34:10.000000000 +0100
|
|
||||||
@@ -161,14 +161,14 @@
|
|
||||||
void tape_empty_output_buffer P_((int out_des));
|
|
||||||
void disk_empty_output_buffer P_((int out_des));
|
|
||||||
void swahw_array P_((char *ptr, int count));
|
|
||||||
-void tape_buffered_write P_((char *in_buf, int out_des, long num_bytes));
|
|
||||||
-void tape_buffered_read P_((char *in_buf, int in_des, long num_bytes));
|
|
||||||
+void tape_buffered_write P_((char *in_buf, int out_des, off_t num_bytes));
|
|
||||||
+void tape_buffered_read P_((char *in_buf, int in_des, off_t num_bytes));
|
|
||||||
int tape_buffered_peek P_((char *peek_buf, int in_des, int num_bytes));
|
|
||||||
-void tape_toss_input P_((int in_des, long num_bytes));
|
|
||||||
-void copy_files_tape_to_disk P_((int in_des, int out_des, long num_bytes));
|
|
||||||
-void copy_files_disk_to_tape P_((int in_des, int out_des, long num_bytes, char *filename));
|
|
||||||
-void copy_files_disk_to_disk P_((int in_des, int out_des, long num_bytes, char *filename));
|
|
||||||
-void warn_if_file_changed P_((char *file_name, unsigned long old_file_size,
|
|
||||||
+void tape_toss_input P_((int in_des, off_t num_bytes));
|
|
||||||
+void copy_files_tape_to_disk P_((int in_des, int out_des, off_t num_bytes));
|
|
||||||
+void copy_files_disk_to_tape P_((int in_des, int out_des, off_t num_bytes, char *filename));
|
|
||||||
+void copy_files_disk_to_disk P_((int in_des, int out_des, off_t num_bytes, char *filename));
|
|
||||||
+void warn_if_file_changed P_((char *file_name, off_t old_file_size,
|
|
||||||
unsigned long old_file_mtime));
|
|
||||||
void create_all_directories P_((char *name));
|
|
||||||
void prepare_append P_((int out_file_des));
|
|
||||||
--- cpio-2.6/src/cpiohdr.h.lfs 2003-11-21 15:48:13.000000000 +0100
|
|
||||||
+++ cpio-2.6/src/cpiohdr.h 2006-03-25 13:34:10.000000000 +0100
|
|
||||||
@@ -34,8 +34,8 @@
|
|
||||||
unsigned short c_mtimes[2];
|
|
||||||
unsigned short c_namesize;
|
|
||||||
unsigned short c_filesizes[2];
|
|
||||||
- unsigned long c_mtime; /* Long-aligned copy of `c_mtimes'. */
|
|
||||||
- unsigned long c_filesize; /* Long-aligned copy of `c_filesizes'. */
|
|
||||||
+ unsigned int c_mtime; /* aligned copy of `c_mtimes'. */
|
|
||||||
+ unsigned int c_filesize; /* aligned copy of `c_filesizes'. */
|
|
||||||
char *c_name;
|
|
||||||
};
|
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@
|
|
||||||
unsigned long c_gid;
|
|
||||||
unsigned long c_nlink;
|
|
||||||
unsigned long c_mtime;
|
|
||||||
- unsigned long c_filesize;
|
|
||||||
+ off_t c_filesize;
|
|
||||||
long c_dev_maj;
|
|
||||||
long c_dev_min;
|
|
||||||
long c_rdev_maj;
|
|
@ -1,11 +0,0 @@
|
|||||||
--- cpio-2.6/configure.ac.lstat 2004-12-20 10:46:30.000000000 +0000
|
|
||||||
+++ cpio-2.6/configure.ac 2005-01-17 11:47:22.000000000 +0000
|
|
||||||
@@ -92,7 +92,7 @@
|
|
||||||
AC_CONFIG_LINKS(src/fnmatch.h:headers/fnmatch.h)
|
|
||||||
fi
|
|
||||||
|
|
||||||
-AC_CHECK_FUNCS(lchown endpwent endgrent)
|
|
||||||
+AC_CHECK_FUNCS(lchown endpwent endgrent lstat)
|
|
||||||
AC_FUNC_VPRINTF
|
|
||||||
AC_FUNC_ALLOCA
|
|
||||||
AC_CHECK_LIB(nsl, gethostname, [LIBS="$LIBS -lnsl"])
|
|
@ -1,31 +0,0 @@
|
|||||||
--- cpio-2.6/doc/cpio.info.rh 2004-02-27 13:42:01.000000000 +0100
|
|
||||||
+++ cpio-2.6/doc/cpio.info 2006-07-18 17:10:52.000000000 +0200
|
|
||||||
@@ -261,7 +261,8 @@
|
|
||||||
Set the I/O block size to BLOCK-SIZE * 512 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 IO-SIZE, --io-size=IO-SIZE'
|
|
||||||
Set the I/O block size to IO-SIZE bytes.
|
|
||||||
--- cpio-2.6/src/main.c.rh 2004-11-23 01:42:18.000000000 +0100
|
|
||||||
+++ cpio-2.6/src/main.c 2006-07-18 17:18:10.000000000 +0200
|
|
||||||
@@ -101,7 +101,7 @@
|
|
||||||
{"block-size", BLOCK_SIZE_OPTION, N_("BLOCK-SIZE"), 0,
|
|
||||||
N_("Set the I/O block size to BLOCK-SIZE * 512 bytes"), 110},
|
|
||||||
{NULL, 'c', NULL, 0,
|
|
||||||
- N_("Use the old portable (ASCII) archive format"), 0},
|
|
||||||
+ N_("Identical to \"-H newc\", use the new (SVR4) portable format.If you wish the old portable (ASCII) archive format, use \"-H odc\" instead."), 0},
|
|
||||||
{"dot", 'V', NULL, 0,
|
|
||||||
N_("Print a \".\" for each file processed"), 110},
|
|
||||||
{"io-size", 'C', N_("NUMBER"), 0,
|
|
||||||
@@ -302,6 +302,7 @@
|
|
||||||
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
|
|
@ -1,20 +0,0 @@
|
|||||||
--- cpio-2.6/src/main.c.umask 2005-01-24 14:24:41.281975935 +0000
|
|
||||||
+++ cpio-2.6/src/main.c 2005-01-24 14:38:59.127437814 +0000
|
|
||||||
@@ -741,8 +741,7 @@
|
|
||||||
textdomain (PACKAGE);
|
|
||||||
|
|
||||||
program_name = argv[0];
|
|
||||||
- umask (0);
|
|
||||||
-
|
|
||||||
+
|
|
||||||
#ifdef __TURBOC__
|
|
||||||
_fmode = O_BINARY; /* Put stdin and stdout in binary mode. */
|
|
||||||
#endif
|
|
||||||
@@ -752,6 +751,7 @@
|
|
||||||
#endif
|
|
||||||
|
|
||||||
process_args (argc, argv);
|
|
||||||
+ umask (0);
|
|
||||||
|
|
||||||
initialize_buffers ();
|
|
||||||
|
|
@ -1,154 +0,0 @@
|
|||||||
diff -uprk.orig cpio-2.6.orig/src/copyin.c cpio-2.6/src/copyin.c
|
|
||||||
--- cpio-2.6.orig/src/copyin.c 2004-09-08 11:10:02 +0000
|
|
||||||
+++ cpio-2.6/src/copyin.c 2005-05-04 12:43:42 +0000
|
|
||||||
@@ -176,7 +176,7 @@ list_file(struct new_cpio_header* file_h
|
|
||||||
#endif
|
|
||||||
if (crc != file_hdr->c_chksum)
|
|
||||||
{
|
|
||||||
- error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
|
|
||||||
+ error (0, 0, _("%s: checksum error (0x%x, should be 0x%lx)"),
|
|
||||||
file_hdr->c_name, crc, file_hdr->c_chksum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -307,7 +307,6 @@ create_defered_links_to_skipped (struct
|
|
||||||
int ino;
|
|
||||||
int maj;
|
|
||||||
int min;
|
|
||||||
- int link_res;
|
|
||||||
if (file_hdr->c_filesize == 0)
|
|
||||||
{
|
|
||||||
/* The file doesn't have any data attached to it so we don't have
|
|
||||||
@@ -541,7 +540,7 @@ copyin_regular_file (struct new_cpio_hea
|
|
||||||
if (archive_format == arf_crcascii)
|
|
||||||
{
|
|
||||||
if (crc != file_hdr->c_chksum)
|
|
||||||
- error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
|
|
||||||
+ error (0, 0, _("%s: checksum error (0x%x, should be 0x%lx)"),
|
|
||||||
file_hdr->c_name, crc, file_hdr->c_chksum);
|
|
||||||
}
|
|
||||||
tape_skip_padding (in_file_des, file_hdr->c_filesize);
|
|
||||||
@@ -563,7 +562,7 @@ copyin_regular_file (struct new_cpio_hea
|
|
||||||
if (archive_format == arf_crcascii)
|
|
||||||
{
|
|
||||||
if (crc != file_hdr->c_chksum)
|
|
||||||
- error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
|
|
||||||
+ error (0, 0, _("%s: checksum error (0x%x, should be 0x%lx)"),
|
|
||||||
file_hdr->c_name, crc, file_hdr->c_chksum);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -897,7 +896,7 @@ long_format (struct new_cpio_header *fil
|
|
||||||
}
|
|
||||||
tbuf[16] = '\0';
|
|
||||||
|
|
||||||
- printf ("%s %3u ", mbuf, file_hdr->c_nlink);
|
|
||||||
+ printf ("%s %3lu ", mbuf, file_hdr->c_nlink);
|
|
||||||
|
|
||||||
if (numeric_uid)
|
|
||||||
printf ("%-8u %-8u ", (unsigned int) file_hdr->c_uid,
|
|
||||||
@@ -908,7 +907,7 @@ long_format (struct new_cpio_header *fil
|
|
||||||
|
|
||||||
if ((file_hdr->c_mode & CP_IFMT) == CP_IFCHR
|
|
||||||
|| (file_hdr->c_mode & CP_IFMT) == CP_IFBLK)
|
|
||||||
- printf ("%3u, %3u ", file_hdr->c_rdev_maj,
|
|
||||||
+ printf ("%3lu, %3lu ", file_hdr->c_rdev_maj,
|
|
||||||
file_hdr->c_rdev_min);
|
|
||||||
else
|
|
||||||
printf ("%8lu ", file_hdr->c_filesize);
|
|
||||||
@@ -1342,9 +1341,9 @@ void
|
|
||||||
process_copy_in ()
|
|
||||||
{
|
|
||||||
char done = false; /* True if trailer reached. */
|
|
||||||
- FILE *tty_in; /* Interactive file for rename option. */
|
|
||||||
- FILE *tty_out; /* Interactive file for rename option. */
|
|
||||||
- FILE *rename_in; /* Batch file for rename option. */
|
|
||||||
+ FILE *tty_in = NULL; /* Interactive file for rename option. */
|
|
||||||
+ FILE *tty_out = NULL; /* Interactive file for rename option. */
|
|
||||||
+ FILE *rename_in = NULL; /* Batch file for rename option. */
|
|
||||||
struct stat file_stat; /* Output file stat record. */
|
|
||||||
struct new_cpio_header file_hdr; /* Output header information. */
|
|
||||||
int in_file_des; /* Input file descriptor. */
|
|
||||||
@@ -1530,7 +1529,7 @@ process_copy_in ()
|
|
||||||
tape_skip_padding (in_file_des, file_hdr.c_filesize);
|
|
||||||
if (crc != file_hdr.c_chksum)
|
|
||||||
{
|
|
||||||
- error (0, 0, _("%s: checksum error (0x%x, should be 0x%x)"),
|
|
||||||
+ error (0, 0, _("%s: checksum error (0x%x, should be 0x%lx)"),
|
|
||||||
file_hdr.c_name, crc, file_hdr.c_chksum);
|
|
||||||
}
|
|
||||||
/* Debian hack: -v and -V now work with --only-verify-crc.
|
|
||||||
diff -uprk.orig cpio-2.6.orig/src/copyout.c cpio-2.6/src/copyout.c
|
|
||||||
--- cpio-2.6.orig/src/copyout.c 2004-10-14 09:14:03 +0000
|
|
||||||
+++ cpio-2.6/src/copyout.c 2005-05-04 12:41:08 +0000
|
|
||||||
@@ -346,7 +346,7 @@ write_out_header (struct new_cpio_header
|
|
||||||
#endif
|
|
||||||
file_hdr->c_filesize = makedev (file_hdr->c_rdev_maj,
|
|
||||||
file_hdr->c_rdev_min);
|
|
||||||
- rdev = 1;
|
|
||||||
+ dev = rdev = 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min);
|
|
||||||
diff -uprk.orig cpio-2.6.orig/src/tar.c cpio-2.6/src/tar.c
|
|
||||||
--- cpio-2.6.orig/src/tar.c 2004-10-14 09:33:41 +0000
|
|
||||||
+++ cpio-2.6/src/tar.c 2005-05-04 12:41:47 +0000
|
|
||||||
@@ -473,7 +473,6 @@ is_tar_filename_too_long (char *name)
|
|
||||||
{
|
|
||||||
int whole_name_len;
|
|
||||||
int prefix_name_len;
|
|
||||||
- char *p;
|
|
||||||
|
|
||||||
whole_name_len = strlen (name);
|
|
||||||
if (whole_name_len <= TARNAMESIZE)
|
|
||||||
diff -uprk.orig cpio-2.6.orig/src/util.c cpio-2.6/src/util.c
|
|
||||||
--- cpio-2.6.orig/src/util.c 2004-09-08 10:44:49 +0000
|
|
||||||
+++ cpio-2.6/src/util.c 2005-05-04 13:13:24 +0000
|
|
||||||
@@ -24,6 +24,8 @@
|
|
||||||
#include "dstring.h"
|
|
||||||
#include "extern.h"
|
|
||||||
#include <rmt.h>
|
|
||||||
+#include <safe-read.h>
|
|
||||||
+#include <full-write.h>
|
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
|
|
||||||
@@ -38,6 +40,8 @@
|
|
||||||
extern int errno;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+int sparse_write (int fildes, char *buf, unsigned int nbyte);
|
|
||||||
+
|
|
||||||
/* Write `output_size' bytes of `output_buffer' to file
|
|
||||||
descriptor OUT_DES and reset `output_size' and `out_buff'. */
|
|
||||||
|
|
||||||
@@ -471,9 +475,9 @@ copy_files_disk_to_tape (int in_des, int
|
|
||||||
while (num_bytes > 0)
|
|
||||||
{
|
|
||||||
if (input_size == 0)
|
|
||||||
- if (rc = disk_fill_input_buffer (in_des,
|
|
||||||
+ if ((rc = disk_fill_input_buffer (in_des,
|
|
||||||
num_bytes < DISK_IO_BLOCK_SIZE ?
|
|
||||||
- num_bytes : DISK_IO_BLOCK_SIZE))
|
|
||||||
+ num_bytes : DISK_IO_BLOCK_SIZE)))
|
|
||||||
{
|
|
||||||
if (rc > 0)
|
|
||||||
error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"),
|
|
||||||
@@ -517,7 +521,7 @@ copy_files_disk_to_disk (int in_des, int
|
|
||||||
while (num_bytes > 0)
|
|
||||||
{
|
|
||||||
if (input_size == 0)
|
|
||||||
- if (rc = disk_fill_input_buffer (in_des, num_bytes))
|
|
||||||
+ if ((rc = disk_fill_input_buffer (in_des, num_bytes)))
|
|
||||||
{
|
|
||||||
if (rc > 0)
|
|
||||||
error (0, 0, _("File %s shrunk by %ld bytes, padding with zeros"),
|
|
||||||
@@ -1157,8 +1161,8 @@ sparse_write (int fildes, char *buf, uns
|
|
||||||
int complete_block_count;
|
|
||||||
int leftover_bytes_count;
|
|
||||||
int seek_count;
|
|
||||||
- int write_count;
|
|
||||||
- char *cur_write_start;
|
|
||||||
+ int write_count = 0;
|
|
||||||
+ char *cur_write_start = buf;
|
|
||||||
int lseek_rc;
|
|
||||||
int write_rc;
|
|
||||||
int i;
|
|
@ -1,555 +0,0 @@
|
|||||||
--- cpio-2.6/src/copyout.c.bufferOverflow 2005-11-23 16:51:56.000000000 -0500
|
|
||||||
+++ cpio-2.6/src/copyout.c 2005-11-23 17:00:38.000000000 -0500
|
|
||||||
@@ -159,7 +159,7 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We are about to put a file into a newc or crc archive that is
|
|
||||||
- multiply linked. We have already seen and defered all of the
|
|
||||||
+ multiply linked. We have already seen and deferred all of the
|
|
||||||
other links to the file but haven't written them into the archive.
|
|
||||||
Write the other links into the archive, and remove them from the
|
|
||||||
deferouts list. */
|
|
||||||
@@ -231,8 +231,10 @@
|
|
||||||
file_hdr.c_filesize,
|
|
||||||
header->c_name);
|
|
||||||
|
|
||||||
- write_out_header (&file_hdr, out_file_des);
|
|
||||||
- copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize, header->c_name);
|
|
||||||
+ if (write_out_header (&file_hdr, out_file_des))
|
|
||||||
+ return;
|
|
||||||
+ copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize,
|
|
||||||
+ header->c_name);
|
|
||||||
warn_if_file_changed(header->c_name, file_hdr.c_filesize, file_hdr.c_mtime);
|
|
||||||
|
|
||||||
if (archive_format == arf_tar || archive_format == arf_ustar)
|
|
||||||
@@ -288,153 +290,311 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-
|
|
||||||
-/* Write out header FILE_HDR, including the file name, to file
|
|
||||||
- descriptor OUT_DES. */
|
|
||||||
+/* FIXME: These two defines should be defined in paxutils */
|
|
||||||
+#define LG_8 3
|
|
||||||
+#define LG_16 4
|
|
||||||
+
|
|
||||||
+/* FIXME: to_ascii could be used instead of to_oct() and to_octal() from tar,
|
|
||||||
+ so it should be moved to paxutils too.
|
|
||||||
+ Allowed values for logbase are: 1 (binary), 2, 3 (octal), 4 (hex) */
|
|
||||||
+int
|
|
||||||
+to_ascii (char *where, uintmax_t v, size_t digits, unsigned logbase)
|
|
||||||
+{
|
|
||||||
+ static char codetab[] = "0123456789ABCDEF";
|
|
||||||
+ int i = digits;
|
|
||||||
+
|
|
||||||
+ do
|
|
||||||
+ {
|
|
||||||
+ where[--i] = codetab[(v & ((1 << logbase) - 1))];
|
|
||||||
+ v >>= logbase;
|
|
||||||
+ }
|
|
||||||
+ while (i);
|
|
||||||
+
|
|
||||||
+ return v != 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+field_width_error (const char *filename, const char *fieldname)
|
|
||||||
+{
|
|
||||||
+ error (1, 0, _("%s: field width not sufficient for storing %s"),
|
|
||||||
+ filename, fieldname);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+field_width_warning (const char *filename, const char *fieldname)
|
|
||||||
+{
|
|
||||||
+ if (warn_option & CPIO_WARN_TRUNCATE)
|
|
||||||
+ error (0, 0, _("%s: truncating %s"), filename, fieldname);
|
|
||||||
+}
|
|
||||||
|
|
||||||
void
|
|
||||||
-write_out_header (struct new_cpio_header *file_hdr, int out_des)
|
|
||||||
+to_ascii_or_warn (char *where, uintmax_t n, size_t digits,
|
|
||||||
+ unsigned logbase,
|
|
||||||
+ const char *filename, const char *fieldname)
|
|
||||||
+{
|
|
||||||
+ if (to_ascii (where, n, digits, logbase))
|
|
||||||
+ field_width_warning (filename, fieldname);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+to_ascii_or_error (char *where, uintmax_t n, size_t digits,
|
|
||||||
+ unsigned logbase,
|
|
||||||
+ const char *filename, const char *fieldname)
|
|
||||||
{
|
|
||||||
- if (archive_format == arf_newascii || archive_format == arf_crcascii)
|
|
||||||
+ if (to_ascii (where, n, digits, logbase))
|
|
||||||
{
|
|
||||||
- char ascii_header[112];
|
|
||||||
- char *magic_string;
|
|
||||||
+ field_width_error (filename, fieldname);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
|
|
||||||
- if (archive_format == arf_crcascii)
|
|
||||||
- magic_string = "070702";
|
|
||||||
- else
|
|
||||||
- magic_string = "070701";
|
|
||||||
- sprintf (ascii_header,
|
|
||||||
- "%6s%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx",
|
|
||||||
- magic_string,
|
|
||||||
- file_hdr->c_ino, file_hdr->c_mode, file_hdr->c_uid,
|
|
||||||
- file_hdr->c_gid, file_hdr->c_nlink, file_hdr->c_mtime,
|
|
||||||
- file_hdr->c_filesize, file_hdr->c_dev_maj, file_hdr->c_dev_min,
|
|
||||||
- file_hdr->c_rdev_maj, file_hdr->c_rdev_min, file_hdr->c_namesize,
|
|
||||||
- file_hdr->c_chksum & 0xffffffff);
|
|
||||||
- tape_buffered_write (ascii_header, out_des, 110L);
|
|
||||||
-
|
|
||||||
- /* Write file name to output. */
|
|
||||||
- tape_buffered_write (file_hdr->c_name, out_des, (long) file_hdr->c_namesize);
|
|
||||||
- tape_pad_output (out_des, file_hdr->c_namesize + 110);
|
|
||||||
- }
|
|
||||||
- else if (archive_format == arf_oldascii || archive_format == arf_hpoldascii)
|
|
||||||
- {
|
|
||||||
- char ascii_header[78];
|
|
||||||
- dev_t dev;
|
|
||||||
- dev_t rdev;
|
|
||||||
+int
|
|
||||||
+write_out_new_ascii_header (const char *magic_string,
|
|
||||||
+ struct new_cpio_header *file_hdr, int out_des)
|
|
||||||
+{
|
|
||||||
+ char ascii_header[110];
|
|
||||||
+ char *p;
|
|
||||||
|
|
||||||
- if (archive_format == arf_oldascii)
|
|
||||||
- {
|
|
||||||
- dev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min);
|
|
||||||
- rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- /* HP/UX cpio creates archives that look just like ordinary archives,
|
|
||||||
- but for devices it sets major = 0, minor = 1, and puts the
|
|
||||||
- actual major/minor number in the filesize field. */
|
|
||||||
- switch (file_hdr->c_mode & CP_IFMT)
|
|
||||||
- {
|
|
||||||
- case CP_IFCHR:
|
|
||||||
- case CP_IFBLK:
|
|
||||||
+ p = stpcpy (ascii_header, magic_string);
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_ino, 8, LG_16,
|
|
||||||
+ file_hdr->c_name, _("inode number"));
|
|
||||||
+ p += 8;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_mode, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("file mode"));
|
|
||||||
+ p += 8;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_uid, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("uid"));
|
|
||||||
+ p += 8;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_gid, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("gid"));
|
|
||||||
+ p += 8;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_nlink, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("number of links"));
|
|
||||||
+ p += 8;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_mtime, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("modification time"));
|
|
||||||
+ p += 8;
|
|
||||||
+ if (to_ascii_or_error (p, file_hdr->c_filesize, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("file size")))
|
|
||||||
+ return 1;
|
|
||||||
+ p += 8;
|
|
||||||
+ if (to_ascii_or_error (p, file_hdr->c_dev_maj, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("device major number")))
|
|
||||||
+ return 1;
|
|
||||||
+ p += 8;
|
|
||||||
+ if (to_ascii_or_error (p, file_hdr->c_dev_min, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("device minor number")))
|
|
||||||
+ return 1;
|
|
||||||
+ p += 8;
|
|
||||||
+ if (to_ascii_or_error (p, file_hdr->c_rdev_maj, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("rdev major")))
|
|
||||||
+ return 1;
|
|
||||||
+ p += 8;
|
|
||||||
+ if (to_ascii_or_error (p, file_hdr->c_rdev_min, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("rdev minor")))
|
|
||||||
+ return 1;
|
|
||||||
+ p += 8;
|
|
||||||
+ if (to_ascii_or_error (p, file_hdr->c_namesize, 8, LG_16, file_hdr->c_name,
|
|
||||||
+ _("name size")))
|
|
||||||
+ return 1;
|
|
||||||
+ p += 8;
|
|
||||||
+ to_ascii (p, file_hdr->c_chksum & 0xffffffff, 8, LG_16);
|
|
||||||
+
|
|
||||||
+ tape_buffered_write (ascii_header, out_des, sizeof ascii_header);
|
|
||||||
+
|
|
||||||
+ /* Write file name to output. */
|
|
||||||
+ tape_buffered_write (file_hdr->c_name, out_des, (long) file_hdr->c_namesize);
|
|
||||||
+ tape_pad_output (out_des, file_hdr->c_namesize + sizeof ascii_header);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+write_out_old_ascii_header (dev_t dev, dev_t rdev,
|
|
||||||
+ struct new_cpio_header *file_hdr, int out_des)
|
|
||||||
+{
|
|
||||||
+ char ascii_header[76];
|
|
||||||
+ char *p = ascii_header;
|
|
||||||
+
|
|
||||||
+ to_ascii (p, file_hdr->c_magic, 6, LG_8);
|
|
||||||
+ p += 6;
|
|
||||||
+ to_ascii_or_warn (p, dev, 6, LG_8, file_hdr->c_name, _("device number"));
|
|
||||||
+ p += 6;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_ino, 6, LG_8, file_hdr->c_name,
|
|
||||||
+ _("inode number"));
|
|
||||||
+ p += 6;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_mode, 6, LG_8, file_hdr->c_name,
|
|
||||||
+ _("file mode"));
|
|
||||||
+ p += 6;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_uid, 6, LG_8, file_hdr->c_name, _("uid"));
|
|
||||||
+ p += 6;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_gid, 6, LG_8, file_hdr->c_name, _("gid"));
|
|
||||||
+ p += 6;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_nlink, 6, LG_8, file_hdr->c_name,
|
|
||||||
+ _("number of links"));
|
|
||||||
+ p += 6;
|
|
||||||
+ to_ascii_or_warn (p, rdev, 6, LG_8, file_hdr->c_name, _("rdev"));
|
|
||||||
+ p += 6;
|
|
||||||
+ to_ascii_or_warn (p, file_hdr->c_mtime, 11, LG_8, file_hdr->c_name,
|
|
||||||
+ _("modification time"));
|
|
||||||
+ p += 11;
|
|
||||||
+ if (to_ascii_or_error (p, file_hdr->c_namesize, 6, LG_8, file_hdr->c_name,
|
|
||||||
+ _("name size")))
|
|
||||||
+ return 1;
|
|
||||||
+ p += 6;
|
|
||||||
+ if (to_ascii_or_error (p, file_hdr->c_filesize, 11, LG_8, file_hdr->c_name,
|
|
||||||
+ _("file size")))
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ tape_buffered_write (ascii_header, out_des, sizeof ascii_header);
|
|
||||||
+
|
|
||||||
+ /* Write file name to output. */
|
|
||||||
+ tape_buffered_write (file_hdr->c_name, out_des, file_hdr->c_namesize);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+hp_compute_dev (struct new_cpio_header *file_hdr, dev_t *pdev, dev_t *prdev)
|
|
||||||
+{
|
|
||||||
+ /* HP/UX cpio creates archives that look just like ordinary archives,
|
|
||||||
+ but for devices it sets major = 0, minor = 1, and puts the
|
|
||||||
+ actual major/minor number in the filesize field. */
|
|
||||||
+ switch (file_hdr->c_mode & CP_IFMT)
|
|
||||||
+ {
|
|
||||||
+ case CP_IFCHR:
|
|
||||||
+ case CP_IFBLK:
|
|
||||||
#ifdef CP_IFSOCK
|
|
||||||
- case CP_IFSOCK:
|
|
||||||
+ case CP_IFSOCK:
|
|
||||||
#endif
|
|
||||||
#ifdef CP_IFIFO
|
|
||||||
- case CP_IFIFO:
|
|
||||||
+ case CP_IFIFO:
|
|
||||||
#endif
|
|
||||||
- file_hdr->c_filesize = makedev (file_hdr->c_rdev_maj,
|
|
||||||
- file_hdr->c_rdev_min);
|
|
||||||
- dev = rdev = 1;
|
|
||||||
- break;
|
|
||||||
- default:
|
|
||||||
- dev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min);
|
|
||||||
- rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ file_hdr->c_filesize = makedev (file_hdr->c_rdev_maj,
|
|
||||||
+ file_hdr->c_rdev_min);
|
|
||||||
+ *pdev = *prdev = makedev (0, 1);
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
+ default:
|
|
||||||
+ *pdev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min);
|
|
||||||
+ *prdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
|
|
||||||
- if ((warn_option & CPIO_WARN_TRUNCATE) && (file_hdr->c_ino >> 16) != 0)
|
|
||||||
- error (0, 0, _("%s: truncating inode number"), file_hdr->c_name);
|
|
||||||
+int
|
|
||||||
+write_out_binary_header (dev_t rdev,
|
|
||||||
+ struct new_cpio_header *file_hdr, int out_des)
|
|
||||||
+{
|
|
||||||
+ struct old_cpio_header short_hdr;
|
|
||||||
|
|
||||||
- /* Debian hack: The type of dev_t has changed in glibc. Fixed output
|
|
||||||
- to ensure that a long int is passed to sprintf. This has been
|
|
||||||
- reported to "bug-gnu-utils@prep.ai.mit.edu". (1998/5/26) -BEM */
|
|
||||||
- sprintf (ascii_header,
|
|
||||||
- "%06ho%06lo%06lo%06lo%06lo%06lo%06lo%06lo%011lo%06lo%011lo",
|
|
||||||
- file_hdr->c_magic & 0xFFFF, (long) dev & 0xFFFF,
|
|
||||||
- file_hdr->c_ino & 0xFFFF, file_hdr->c_mode & 0xFFFF,
|
|
||||||
- file_hdr->c_uid & 0xFFFF, file_hdr->c_gid & 0xFFFF,
|
|
||||||
- file_hdr->c_nlink & 0xFFFF, (long) rdev & 0xFFFF,
|
|
||||||
- file_hdr->c_mtime, file_hdr->c_namesize & 0xFFFF,
|
|
||||||
- file_hdr->c_filesize);
|
|
||||||
- tape_buffered_write (ascii_header, out_des, 76L);
|
|
||||||
+ short_hdr.c_magic = 070707;
|
|
||||||
+ short_hdr.c_dev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min);
|
|
||||||
|
|
||||||
- /* Write file name to output. */
|
|
||||||
- tape_buffered_write (file_hdr->c_name, out_des, (long) file_hdr->c_namesize);
|
|
||||||
- }
|
|
||||||
- else if (archive_format == arf_tar || archive_format == arf_ustar)
|
|
||||||
- {
|
|
||||||
- write_out_tar_header (file_hdr, out_des);
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- struct old_cpio_header short_hdr;
|
|
||||||
+ if ((warn_option & CPIO_WARN_TRUNCATE) && (file_hdr->c_ino >> 16) != 0)
|
|
||||||
+ error (0, 0, _("%s: truncating inode number"), file_hdr->c_name);
|
|
||||||
|
|
||||||
- short_hdr.c_magic = 070707;
|
|
||||||
- short_hdr.c_dev = makedev (file_hdr->c_dev_maj, file_hdr->c_dev_min);
|
|
||||||
+ short_hdr.c_ino = file_hdr->c_ino & 0xFFFF;
|
|
||||||
+ if (short_hdr.c_ino != file_hdr->c_ino)
|
|
||||||
+ field_width_warning (file_hdr->c_name, _("inode number"));
|
|
||||||
+
|
|
||||||
+ short_hdr.c_mode = file_hdr->c_mode & 0xFFFF;
|
|
||||||
+ if (short_hdr.c_mode != file_hdr->c_mode)
|
|
||||||
+ field_width_warning (file_hdr->c_name, _("file mode"));
|
|
||||||
+
|
|
||||||
+ short_hdr.c_uid = file_hdr->c_uid & 0xFFFF;
|
|
||||||
+ if (short_hdr.c_uid != file_hdr->c_uid)
|
|
||||||
+ field_width_warning (file_hdr->c_name, _("uid"));
|
|
||||||
+
|
|
||||||
+ short_hdr.c_gid = file_hdr->c_gid & 0xFFFF;
|
|
||||||
+ if (short_hdr.c_gid != file_hdr->c_gid)
|
|
||||||
+ field_width_warning (file_hdr->c_name, _("gid"));
|
|
||||||
+
|
|
||||||
+ short_hdr.c_nlink = file_hdr->c_nlink & 0xFFFF;
|
|
||||||
+ if (short_hdr.c_nlink != file_hdr->c_nlink)
|
|
||||||
+ field_width_warning (file_hdr->c_name, _("number of links"));
|
|
||||||
+
|
|
||||||
+ short_hdr.c_rdev = rdev;
|
|
||||||
+ short_hdr.c_mtimes[0] = file_hdr->c_mtime >> 16;
|
|
||||||
+ short_hdr.c_mtimes[1] = file_hdr->c_mtime & 0xFFFF;
|
|
||||||
+
|
|
||||||
+ short_hdr.c_namesize = file_hdr->c_namesize & 0xFFFF;
|
|
||||||
+ if (short_hdr.c_namesize != file_hdr->c_namesize)
|
|
||||||
+ {
|
|
||||||
+ field_width_error (file_hdr->c_name, _("name size"));
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ short_hdr.c_filesize = file_hdr->c_filesize;
|
|
||||||
+ if (short_hdr.c_filesize != file_hdr->c_filesize)
|
|
||||||
+ {
|
|
||||||
+ field_width_error (file_hdr->c_name, _("file size"));
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ short_hdr.c_filesizes[0] = file_hdr->c_filesize >> 16;
|
|
||||||
+ short_hdr.c_filesizes[1] = file_hdr->c_filesize & 0xFFFF;
|
|
||||||
|
|
||||||
- if ((warn_option & CPIO_WARN_TRUNCATE) && (file_hdr->c_ino >> 16) != 0)
|
|
||||||
- error (0, 0, _("%s: truncating inode number"), file_hdr->c_name);
|
|
||||||
+ /* Output the file header. */
|
|
||||||
+ tape_buffered_write ((char *) &short_hdr, out_des, 26);
|
|
||||||
|
|
||||||
- short_hdr.c_ino = file_hdr->c_ino & 0xFFFF;
|
|
||||||
- short_hdr.c_mode = file_hdr->c_mode & 0xFFFF;
|
|
||||||
- short_hdr.c_uid = file_hdr->c_uid & 0xFFFF;
|
|
||||||
- short_hdr.c_gid = file_hdr->c_gid & 0xFFFF;
|
|
||||||
- short_hdr.c_nlink = file_hdr->c_nlink & 0xFFFF;
|
|
||||||
- if (archive_format != arf_hpbinary)
|
|
||||||
- short_hdr.c_rdev = makedev (file_hdr->c_rdev_maj, file_hdr->c_rdev_min);
|
|
||||||
- else
|
|
||||||
- {
|
|
||||||
- switch (file_hdr->c_mode & CP_IFMT)
|
|
||||||
- {
|
|
||||||
- /* HP/UX cpio creates archives that look just like ordinary
|
|
||||||
- archives, but for devices it sets major = 0, minor = 1, and
|
|
||||||
- puts the actual major/minor number in the filesize field. */
|
|
||||||
- case CP_IFCHR:
|
|
||||||
- case CP_IFBLK:
|
|
||||||
-#ifdef CP_IFSOCK
|
|
||||||
- case CP_IFSOCK:
|
|
||||||
-#endif
|
|
||||||
-#ifdef CP_IFIFO
|
|
||||||
- case CP_IFIFO:
|
|
||||||
-#endif
|
|
||||||
- file_hdr->c_filesize = makedev (file_hdr->c_rdev_maj,
|
|
||||||
- file_hdr->c_rdev_min);
|
|
||||||
- short_hdr.c_rdev = makedev (0, 1);
|
|
||||||
- break;
|
|
||||||
- default:
|
|
||||||
- short_hdr.c_rdev = makedev (file_hdr->c_rdev_maj,
|
|
||||||
- file_hdr->c_rdev_min);
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- short_hdr.c_mtimes[0] = file_hdr->c_mtime >> 16;
|
|
||||||
- short_hdr.c_mtimes[1] = file_hdr->c_mtime & 0xFFFF;
|
|
||||||
+ /* Write file name to output. */
|
|
||||||
+ tape_buffered_write (file_hdr->c_name, out_des, file_hdr->c_namesize);
|
|
||||||
|
|
||||||
- short_hdr.c_namesize = file_hdr->c_namesize & 0xFFFF;
|
|
||||||
+ tape_pad_output (out_des, file_hdr->c_namesize + 26);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
|
|
||||||
- short_hdr.c_filesizes[0] = file_hdr->c_filesize >> 16;
|
|
||||||
- short_hdr.c_filesizes[1] = file_hdr->c_filesize & 0xFFFF;
|
|
||||||
+
|
|
||||||
+/* Write out header FILE_HDR, including the file name, to file
|
|
||||||
+ descriptor OUT_DES. */
|
|
||||||
|
|
||||||
- /* Output the file header. */
|
|
||||||
- tape_buffered_write ((char *) &short_hdr, out_des, 26L);
|
|
||||||
+int
|
|
||||||
+write_out_header (struct new_cpio_header *file_hdr, int out_des)
|
|
||||||
+{
|
|
||||||
+ dev_t dev;
|
|
||||||
+ dev_t rdev;
|
|
||||||
+
|
|
||||||
+ switch (archive_format)
|
|
||||||
+ {
|
|
||||||
+ case arf_newascii:
|
|
||||||
+ return write_out_new_ascii_header ("070701", file_hdr, out_des);
|
|
||||||
+
|
|
||||||
+ case arf_crcascii:
|
|
||||||
+ return write_out_new_ascii_header ("070702", file_hdr, out_des);
|
|
||||||
+
|
|
||||||
+ case arf_oldascii:
|
|
||||||
+ return write_out_old_ascii_header (makedev (file_hdr->c_dev_maj,
|
|
||||||
+ file_hdr->c_dev_min),
|
|
||||||
+ makedev (file_hdr->c_rdev_maj,
|
|
||||||
+ file_hdr->c_rdev_min),
|
|
||||||
+ file_hdr, out_des);
|
|
||||||
+
|
|
||||||
+ case arf_hpoldascii:
|
|
||||||
+ hp_compute_dev (file_hdr, &dev, &rdev);
|
|
||||||
+ return write_out_old_ascii_header (dev, rdev, file_hdr, out_des);
|
|
||||||
+
|
|
||||||
+ case arf_tar:
|
|
||||||
+ case arf_ustar:
|
|
||||||
+ if (is_tar_filename_too_long (file_hdr->c_name))
|
|
||||||
+ {
|
|
||||||
+ error (0, 0, _("%s: file name too long"), file_hdr->c_name);
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+ write_out_tar_header (file_hdr, out_des); /* FIXME: No error checking */
|
|
||||||
+ return 0;
|
|
||||||
|
|
||||||
- /* Write file name to output. */
|
|
||||||
- tape_buffered_write (file_hdr->c_name, out_des, (long) file_hdr->c_namesize);
|
|
||||||
+ case arf_binary:
|
|
||||||
+ return write_out_binary_header (makedev (file_hdr->c_rdev_maj,
|
|
||||||
+ file_hdr->c_rdev_min),
|
|
||||||
+ file_hdr, out_des);
|
|
||||||
+
|
|
||||||
+ case arf_hpbinary:
|
|
||||||
+ hp_compute_dev (file_hdr, &dev, &rdev);
|
|
||||||
+ /* FIXME: dev ignored. Should it be? */
|
|
||||||
+ return write_out_binary_header (rdev, file_hdr, out_des);
|
|
||||||
|
|
||||||
- tape_pad_output (out_des, file_hdr->c_namesize + 26);
|
|
||||||
+ default:
|
|
||||||
+ abort ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -593,14 +753,7 @@
|
|
||||||
file_hdr.c_namesize = strlen (p) + 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
- if ((archive_format == arf_tar || archive_format == arf_ustar)
|
|
||||||
- && is_tar_filename_too_long (file_hdr.c_name))
|
|
||||||
- {
|
|
||||||
- error (0, 0, _("%s: file name too long"),
|
|
||||||
- file_hdr.c_name);
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
+
|
|
||||||
/* Copy the named file to the output. */
|
|
||||||
switch (file_hdr.c_mode & CP_IFMT)
|
|
||||||
{
|
|
||||||
@@ -613,7 +766,8 @@
|
|
||||||
file_hdr.c_dev_min)))
|
|
||||||
{
|
|
||||||
file_hdr.c_tar_linkname = otherfile;
|
|
||||||
- write_out_header (&file_hdr, out_file_des);
|
|
||||||
+ if (write_out_header (&file_hdr, out_file_des))
|
|
||||||
+ continue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -643,7 +797,8 @@
|
|
||||||
file_hdr.c_filesize,
|
|
||||||
input_name.ds_string);
|
|
||||||
|
|
||||||
- write_out_header (&file_hdr, out_file_des);
|
|
||||||
+ if (write_out_header (&file_hdr, out_file_des))
|
|
||||||
+ continue;
|
|
||||||
copy_files_disk_to_tape (in_file_des, out_file_des, file_hdr.c_filesize, input_name.ds_string);
|
|
||||||
warn_if_file_changed(input_name.ds_string, file_hdr.c_filesize,
|
|
||||||
file_hdr.c_mtime);
|
|
||||||
@@ -673,7 +828,8 @@
|
|
||||||
|
|
||||||
case CP_IFDIR:
|
|
||||||
file_hdr.c_filesize = 0;
|
|
||||||
- write_out_header (&file_hdr, out_file_des);
|
|
||||||
+ if (write_out_header (&file_hdr, out_file_des))
|
|
||||||
+ continue;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CP_IFCHR:
|
|
||||||
@@ -702,14 +858,16 @@
|
|
||||||
file_hdr.c_mode = (file_stat.st_mode & 07777);
|
|
||||||
file_hdr.c_mode |= CP_IFREG;
|
|
||||||
file_hdr.c_tar_linkname = otherfile;
|
|
||||||
- write_out_header (&file_hdr, out_file_des);
|
|
||||||
+ if (write_out_header (&file_hdr, out_file_des))
|
|
||||||
+ continue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
add_inode (file_hdr.c_ino, file_hdr.c_name,
|
|
||||||
file_hdr.c_dev_maj, file_hdr.c_dev_min);
|
|
||||||
}
|
|
||||||
file_hdr.c_filesize = 0;
|
|
||||||
- write_out_header (&file_hdr, out_file_des);
|
|
||||||
+ if (write_out_header (&file_hdr, out_file_des))
|
|
||||||
+ continue;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef CP_IFLNK
|
|
||||||
@@ -738,12 +896,14 @@
|
|
||||||
{
|
|
||||||
link_name[link_size] = '\0';
|
|
||||||
file_hdr.c_tar_linkname = link_name;
|
|
||||||
- write_out_header (&file_hdr, out_file_des);
|
|
||||||
+ if (write_out_header (&file_hdr, out_file_des))
|
|
||||||
+ continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
- write_out_header (&file_hdr, out_file_des);
|
|
||||||
+ if (write_out_header (&file_hdr, out_file_des))
|
|
||||||
+ continue;
|
|
||||||
tape_buffered_write (link_name, out_file_des, link_size);
|
|
||||||
tape_pad_output (out_file_des, link_size);
|
|
||||||
}
|
|
||||||
--- cpio-2.6/src/extern.h.bufferOverflow 2005-11-23 16:51:56.000000000 -0500
|
|
||||||
+++ cpio-2.6/src/extern.h 2005-11-23 16:51:56.000000000 -0500
|
|
||||||
@@ -112,7 +112,7 @@
|
|
||||||
void print_name_with_quoting P_((char *p));
|
|
||||||
|
|
||||||
/* copyout.c */
|
|
||||||
-void write_out_header P_((struct new_cpio_header *file_hdr, int out_des));
|
|
||||||
+int write_out_header P_((struct new_cpio_header *file_hdr, int out_des));
|
|
||||||
void process_copy_out P_((void));
|
|
||||||
|
|
||||||
/* copypass.c */
|
|
139
cpio-2.9-chmodRaceC.patch
Normal file
139
cpio-2.9-chmodRaceC.patch
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
--- 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:
|
11
cpio-2.9-exitCode.patch
Normal file
11
cpio-2.9-exitCode.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- cpio-2.9/src/copyout.c.exitCode 2007-06-28 10:54:43.000000000 +0200
|
||||||
|
+++ cpio-2.9/src/copyout.c 2007-07-16 16:23:05.000000000 +0200
|
||||||
|
@@ -297,7 +297,7 @@ to_ascii (char *where, uintmax_t v, size
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
11
cpio-2.9-lstat.patch
Normal file
11
cpio-2.9-lstat.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- cpio-2.9/configure.ac.lstat 2007-07-16 15:19:52.000000000 +0200
|
||||||
|
+++ cpio-2.9/configure.ac 2007-07-16 15:19:37.000000000 +0200
|
||||||
|
@@ -45,7 +45,7 @@ AC_CHECK_TYPE(gid_t, int)
|
||||||
|
AC_HEADER_STDC
|
||||||
|
AC_HEADER_DIRENT
|
||||||
|
|
||||||
|
-AC_CHECK_FUNCS([fchmod fchown])
|
||||||
|
+AC_CHECK_FUNCS([fchmod fchown lstat])
|
||||||
|
|
||||||
|
# gnulib modules
|
||||||
|
gl_INIT
|
31
cpio-2.9-rh.patch
Normal file
31
cpio-2.9-rh.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
--- cpio-2.9/doc/cpio.info.rh 2007-06-28 15:25:08.000000000 +0200
|
||||||
|
+++ cpio-2.9/doc/cpio.info 2007-07-16 15:10:20.000000000 +0200
|
||||||
|
@@ -266,7 +266,8 @@ File: cpio.info, Node: Options, Prev:
|
||||||
|
Set the I/O block size to BLOCK-SIZE * 512 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 IO-SIZE'
|
||||||
|
`--io-size=IO-SIZE'
|
||||||
|
--- cpio-2.9/src/main.c.rh 2007-06-28 12:46:41.000000000 +0200
|
||||||
|
+++ cpio-2.9/src/main.c 2007-07-16 15:09:10.000000000 +0200
|
||||||
|
@@ -111,7 +111,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,
|
||||||
|
@@ -338,6 +338,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"));
|
||||||
|
+#define SVR4_COMPAT
|
||||||
|
#ifdef SVR4_COMPAT
|
||||||
|
archive_format = arf_newascii; /* -H newc. */
|
||||||
|
#else
|
47
cpio.spec
47
cpio.spec
@ -2,25 +2,17 @@
|
|||||||
|
|
||||||
Summary: A GNU archiving program
|
Summary: A GNU archiving program
|
||||||
Name: cpio
|
Name: cpio
|
||||||
Version: 2.6
|
Version: 2.9
|
||||||
Release: 27%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: Applications/Archiving
|
Group: Applications/Archiving
|
||||||
URL: http://www.gnu.org/software/cpio/
|
URL: http://www.gnu.org/software/cpio/
|
||||||
Source: ftp://ftp.gnu.org/gnu/cpio/cpio-%{version}.tar.gz
|
Source: ftp://ftp.gnu.org/gnu/cpio/cpio-%{version}.tar.gz
|
||||||
Source1:cpio.1
|
Source1: cpio.1
|
||||||
Patch0: cpio-2.6-rh.patch
|
Patch1: cpio-2.6-setLocale.patch
|
||||||
Patch1: cpio-2.5-nolibnsl.patch
|
Patch2: cpio-2.9-rh.patch
|
||||||
Patch2: cpio-2.6-lfs.patch
|
Patch3: cpio-2.9-chmodRaceC.patch
|
||||||
Patch3: cpio-2.6-lstat.patch
|
Patch4: cpio-2.9-exitCode.patch
|
||||||
Patch4: cpio-2.6-umask.patch
|
|
||||||
Patch5: cpio-2.6-chmodRaceC.patch
|
|
||||||
Patch6: cpio-2.6-dirTraversal.patch
|
|
||||||
Patch7: cpio-2.6-warnings.patch
|
|
||||||
Patch8: cpio-2.6-checksum.patch
|
|
||||||
Patch9: cpio-2.6-writeOutHeaderBufferOverflow.patch
|
|
||||||
Patch10:cpio-2.6-initHeaderStruct.patch
|
|
||||||
Patch11:cpio-2.6-setLocale.patch
|
|
||||||
Requires(post): /sbin/install-info
|
Requires(post): /sbin/install-info
|
||||||
Requires(preun): /sbin/install-info
|
Requires(preun): /sbin/install-info
|
||||||
BuildRequires: texinfo, autoconf, gettext
|
BuildRequires: texinfo, autoconf, gettext
|
||||||
@ -42,18 +34,10 @@ Install cpio if you need a program to manage file archives.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1 -b .rh
|
%patch1 -p1 -b .setLocale
|
||||||
%patch1 -p1 -b .nolibnsl
|
%patch2 -p1 -b .rh
|
||||||
%patch2 -p1 -b .lfs
|
%patch3 -p1 -b .chmodRaceC
|
||||||
%patch3 -p1 -b .lstat
|
%patch4 -p1 -b .exitCode
|
||||||
%patch4 -p1 -b .umask
|
|
||||||
%patch5 -p1 -b .chmodRaceC
|
|
||||||
%patch6 -p1 -b .dirTraversal
|
|
||||||
%patch7 -p1 -b .warnings
|
|
||||||
%patch8 -p1 -b .checksum
|
|
||||||
%patch9 -p1 -b .bufferOverflow
|
|
||||||
%patch10 -p1 -b .initHeaderStruct
|
|
||||||
%patch11 -p1 -b .setLocale.patch
|
|
||||||
|
|
||||||
autoheader
|
autoheader
|
||||||
|
|
||||||
@ -68,9 +52,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||||||
make DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" install
|
make DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" install
|
||||||
|
|
||||||
|
|
||||||
rm $RPM_BUILD_ROOT/%{_mandir}/man1/mt.1*
|
rm $RPM_BUILD_ROOT%{_libexecdir}/rmt
|
||||||
rm $RPM_BUILD_ROOT/%{_infodir}/dir
|
rm $RPM_BUILD_ROOT%{_mandir}/man1/*.1*
|
||||||
rm $RPM_BUILD_ROOT/%{_libexecdir}/rmt
|
install -c -p -m 0644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_mandir}/man1
|
||||||
|
|
||||||
%find_lang %{name}
|
%find_lang %{name}
|
||||||
|
|
||||||
@ -93,6 +77,9 @@ fi
|
|||||||
%{_infodir}/*.info*
|
%{_infodir}/*.info*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jul 19 2007 Radek Brich <rbrich@redhat.com> 2.9-1
|
||||||
|
- update to 2.9, GPLv3
|
||||||
|
|
||||||
* Tue Feb 20 2007 Peter Vrabec <pvrabec@redhat.com> 2.6-27
|
* Tue Feb 20 2007 Peter Vrabec <pvrabec@redhat.com> 2.6-27
|
||||||
- fix typo in changelog
|
- fix typo in changelog
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user