- merge toAsciiError.patch with writeOutHeaderBufferOverflow.patch

- merge largeFileGrew.patch with lfs.patch
- fix large file support, cpio is able to store files<8GB in 'old ascii'
    format (-H odc option)
- adjust warnings.patch
This commit is contained in:
Peter Vrabec 2006-03-15 16:23:55 +00:00
parent b797743798
commit 9cadd2b5de
4 changed files with 143 additions and 82 deletions

View File

@ -1,127 +1,163 @@
--- cpio-2.6/src/copyin.c.lfs 2005-07-01 13:48:05.000000000 +0200 --- cpio-2.6/src/copyin.c.lfs 2006-03-15 16:30:48.000000000 -0500
+++ cpio-2.6/src/copyin.c 2005-07-01 13:48:18.000000000 +0200 +++ cpio-2.6/src/copyin.c 2006-03-15 16:35:33.000000000 -0500
@@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
header type. */ header type. */
static void static void
-tape_skip_padding (int in_file_des, int offset) -tape_skip_padding (int in_file_des, int offset)
+tape_skip_padding (int in_file_des, unsigned long offset) +tape_skip_padding (int in_file_des, off_t offset)
{ {
int pad; int pad;
--- cpio-2.6/src/extern.h.lfs 2004-09-08 12:49:57.000000000 +0200 @@ -911,7 +911,7 @@
+++ cpio-2.6/src/extern.h 2005-07-01 13:47:20.000000000 +0200 printf ("%3u, %3u ", file_hdr->c_rdev_maj,
@@ -161,13 +161,13 @@ 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,
--- cpio-2.6/src/extern.h.lfs 2004-09-08 06:49:57.000000000 -0400
+++ cpio-2.6/src/extern.h 2006-03-15 16:28:46.000000000 -0500
@@ -161,14 +161,14 @@
void tape_empty_output_buffer P_((int out_des)); void tape_empty_output_buffer P_((int out_des));
void disk_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 swahw_array P_((char *ptr, int count));
-void tape_buffered_write P_((char *in_buf, int out_des, long num_bytes)); -void tape_buffered_write P_((char *in_buf, int out_des, long num_bytes));
+void tape_buffered_write P_((char *in_buf, int out_des, unsigned long num_bytes)); -void tape_buffered_read P_((char *in_buf, int in_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)); 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 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_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_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 copy_files_disk_to_disk P_((int in_des, int out_des, long num_bytes, char *filename));
+void tape_toss_input P_((int in_des, unsigned long num_bytes)); -void warn_if_file_changed P_((char *file_name, unsigned long old_file_size,
+void copy_files_tape_to_disk P_((int in_des, int out_des, unsigned long num_bytes)); +void tape_toss_input P_((int in_des, off_t num_bytes));
+void copy_files_disk_to_tape P_((int in_des, int out_des, unsigned long num_bytes, char *filename)); +void copy_files_tape_to_disk P_((int in_des, int out_des, off_t num_bytes));
+void copy_files_disk_to_disk P_((int in_des, int out_des, unsigned long num_bytes, char *filename)); +void copy_files_disk_to_tape P_((int in_des, int out_des, off_t num_bytes, char *filename));
void warn_if_file_changed P_((char *file_name, unsigned long old_file_size, +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)); unsigned long old_file_mtime));
void create_all_directories P_((char *name)); void create_all_directories P_((char *name));
--- cpio-2.6/src/util.c.lfs 2004-09-08 12:44:49.000000000 +0200 void prepare_append P_((int out_file_des));
+++ cpio-2.6/src/util.c 2005-07-01 13:56:49.000000000 +0200 --- cpio-2.6/src/util.c.lfs 2004-09-08 06:44:49.000000000 -0400
+++ cpio-2.6/src/util.c 2006-03-15 16:29:20.000000000 -0500
@@ -207,7 +207,7 @@ @@ -207,7 +207,7 @@
Exit with an error if end of file is reached. */ Exit with an error if end of file is reached. */
static int static int
-disk_fill_input_buffer (int in_des, int num_bytes) -disk_fill_input_buffer (int in_des, int num_bytes)
+disk_fill_input_buffer (int in_des, unsigned long num_bytes) +disk_fill_input_buffer (int in_des, off_t num_bytes)
{ {
in_buff = input_buffer; in_buff = input_buffer;
num_bytes = (num_bytes < DISK_IO_BLOCK_SIZE) ? num_bytes : DISK_IO_BLOCK_SIZE; num_bytes = (num_bytes < DISK_IO_BLOCK_SIZE) ? num_bytes : DISK_IO_BLOCK_SIZE;
@@ -227,9 +227,9 @@ @@ -227,10 +227,10 @@
When `out_buff' fills up, flush it to file descriptor OUT_DES. */ When `out_buff' fills up, flush it to file descriptor OUT_DES. */
void void
-tape_buffered_write (char *in_buf, int out_des, long num_bytes) -tape_buffered_write (char *in_buf, int out_des, long num_bytes)
+tape_buffered_write (char *in_buf, int out_des, unsigned 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 bytes_left = num_bytes; /* Bytes needing to be copied. */
+ register unsigned long bytes_left = num_bytes; /* Bytes needing to be copied. */ - register long space_left; /* Room left in output buffer. */
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) while (bytes_left > 0)
@@ -254,9 +254,9 @@ {
@@ -254,10 +254,10 @@
When `out_buff' fills up, flush it to file descriptor OUT_DES. */ When `out_buff' fills up, flush it to file descriptor OUT_DES. */
void void
-disk_buffered_write (char *in_buf, int out_des, long num_bytes) -disk_buffered_write (char *in_buf, int out_des, long num_bytes)
+disk_buffered_write (char *in_buf, int out_des, unsigned 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 bytes_left = num_bytes; /* Bytes needing to be copied. */
+ register unsigned long bytes_left = num_bytes; /* Bytes needing to be copied. */ - register long space_left; /* Room left in output buffer. */
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) while (bytes_left > 0)
@@ -376,9 +376,9 @@ {
@@ -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. */ /* Skip the next NUM_BYTES bytes of file descriptor IN_DES. */
void void
-tape_toss_input (int in_des, long num_bytes) -tape_toss_input (int in_des, long num_bytes)
+tape_toss_input (int in_des, unsigned 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 bytes_left = num_bytes; /* Bytes needing to be copied. */
+ register unsigned long bytes_left = num_bytes; /* Bytes needing to be copied. */ - register long space_left; /* Bytes to copy from input buffer. */
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) while (bytes_left > 0)
{
@@ -404,12 +404,12 @@ @@ -404,12 +404,12 @@
} }
static void static void
-write_nuls_to_file (long num_bytes, int out_des, -write_nuls_to_file (long num_bytes, int out_des,
+write_nuls_to_file (unsigned long num_bytes, int out_des, - void (*writer) (char *in_buf, int out_des, long num_bytes))
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 blocks;
+ unsigned long blocks; - long extra_bytes;
long extra_bytes;
- long i; - long i;
+ unsigned long i; + off_t blocks;
+ off_t extra_bytes;
+ off_t i;
blocks = num_bytes / 512; blocks = num_bytes / 512;
extra_bytes = num_bytes % 512; extra_bytes = num_bytes % 512;
@@ -428,10 +428,10 @@ @@ -428,7 +428,7 @@
NUM_BYTES is the number of bytes to copy. */ NUM_BYTES is the number of bytes to copy. */
void 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, long num_bytes)
+copy_files_tape_to_disk (int in_des, int out_des, unsigned long num_bytes) +copy_files_tape_to_disk (int in_des, int out_des, off_t num_bytes)
{ {
- long size; long size;
- long k; long k;
+ unsigned long size;
+ unsigned long k;
while (num_bytes > 0)
{
@@ -458,13 +458,13 @@ @@ -458,13 +458,13 @@
NUM_BYTES is the number of bytes to copy. */ NUM_BYTES is the number of bytes to copy. */
void 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, long num_bytes,
+copy_files_disk_to_tape (int in_des, int out_des, unsigned long num_bytes, +copy_files_disk_to_tape (int in_des, int out_des, off_t num_bytes,
char *filename) char *filename)
{ {
- long size; long size;
- long k; long k;
+ unsigned long size;
+ unsigned long k;
int rc; int rc;
- long original_num_bytes; - long original_num_bytes;
+ unsigned long original_num_bytes; + off_t original_num_bytes;
original_num_bytes = num_bytes; original_num_bytes = num_bytes;
@ -143,15 +179,13 @@
void 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, long num_bytes,
+copy_files_disk_to_disk (int in_des, int out_des, unsigned long num_bytes, +copy_files_disk_to_disk (int in_des, int out_des, off_t num_bytes,
char *filename) char *filename)
{ {
- long size; long size;
- long k; long k;
- long original_num_bytes; - long original_num_bytes;
+ unsigned long size; + off_t original_num_bytes;
+ unsigned long k;
+ unsigned long original_num_bytes;
int rc; int rc;
original_num_bytes = num_bytes; original_num_bytes = num_bytes;
@ -168,3 +202,45 @@
original_num_bytes - num_bytes, filename); original_num_bytes - num_bytes, filename);
write_nuls_to_file (num_bytes, out_des, disk_buffered_write); write_nuls_to_file (num_bytes, out_des, disk_buffered_write);
break; 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/cpiohdr.h.lfs 2003-11-21 09:48:13.000000000 -0500
+++ cpio-2.6/src/cpiohdr.h 2006-03-15 16:27:30.000000000 -0500
@@ -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;

View File

@ -1,21 +1,3 @@
2005-05-04 Dmitry V. Levin <ldv@altlinux.org>
Deal with compilation warnings generated by gcc compiler.
* src/copyin.c (list_file, copyin_regular_file, long_format,
process_copy_in): Fix format strings.
(create_defered_links_to_skipped): Remove unused variable
`link_res'.
(process_copy_in): Initialize tty_in, tty_out and rename_in.
* src/copyout.c (write_out_header): Initialize dev along with
rdev.
* src/tar.c (is_tar_filename_too_long): Remove unused variable `p';
* src/util.c: Include <safe-read.h> and <full-write.h>
(sparse_write): Add forward declaration. Initialize write_count
and cur_write_start variables.
(copy_files_disk_to_tape, copy_files_disk_to_disk): Add
parentheses around assignment.
diff -uprk.orig cpio-2.6.orig/src/copyin.c cpio-2.6/src/copyin.c 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.orig/src/copyin.c 2004-09-08 11:10:02 +0000
+++ cpio-2.6/src/copyin.c 2005-05-04 12:43:42 +0000 +++ cpio-2.6/src/copyin.c 2005-05-04 12:43:42 +0000
@ -24,7 +6,7 @@ diff -uprk.orig cpio-2.6.orig/src/copyin.c cpio-2.6/src/copyin.c
if (crc != file_hdr->c_chksum) 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%x)"),
+ error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"), + error (0, 0, _("%s: checksum error (0x%x, should be 0x%lx)"),
file_hdr->c_name, crc, file_hdr->c_chksum); file_hdr->c_name, crc, file_hdr->c_chksum);
} }
} }
@ -41,7 +23,7 @@ diff -uprk.orig cpio-2.6.orig/src/copyin.c cpio-2.6/src/copyin.c
{ {
if (crc != file_hdr->c_chksum) 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%x)"),
+ error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"), + error (0, 0, _("%s: checksum error (0x%x, should be 0x%lx)"),
file_hdr->c_name, crc, file_hdr->c_chksum); file_hdr->c_name, crc, file_hdr->c_chksum);
} }
tape_skip_padding (in_file_des, file_hdr->c_filesize); tape_skip_padding (in_file_des, file_hdr->c_filesize);
@ -50,7 +32,7 @@ diff -uprk.orig cpio-2.6.orig/src/copyin.c cpio-2.6/src/copyin.c
{ {
if (crc != file_hdr->c_chksum) 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%x)"),
+ error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"), + error (0, 0, _("%s: checksum error (0x%x, should be 0x%lx)"),
file_hdr->c_name, crc, file_hdr->c_chksum); file_hdr->c_name, crc, file_hdr->c_chksum);
} }
@ -90,7 +72,7 @@ diff -uprk.orig cpio-2.6.orig/src/copyin.c cpio-2.6/src/copyin.c
if (crc != file_hdr.c_chksum) 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%x)"),
+ error (0, 0, _("%s: checksum error (0x%lx, should be 0x%lx)"), + error (0, 0, _("%s: checksum error (0x%x, should be 0x%lx)"),
file_hdr.c_name, crc, file_hdr.c_chksum); file_hdr.c_name, crc, file_hdr.c_chksum);
} }
/* Debian hack: -v and -V now work with --only-verify-crc. /* Debian hack: -v and -V now work with --only-verify-crc.

View File

@ -55,7 +55,7 @@
+static void +static void
+field_width_error (const char *filename, const char *fieldname) +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); + filename, fieldname);
+} +}
+ +

View File

@ -6,7 +6,7 @@
Summary: A GNU archiving program. Summary: A GNU archiving program.
Name: cpio Name: cpio
Version: 2.6 Version: 2.6
Release: 12 Release: 13
License: GPL License: GPL
Group: Applications/Archiving Group: Applications/Archiving
URL: http://www.gnu.org/software/cpio/ URL: http://www.gnu.org/software/cpio/
@ -21,8 +21,6 @@ Patch19: cpio-2.6-dirTraversal.patch
Patch20: cpio-2.6-warnings.patch Patch20: cpio-2.6-warnings.patch
Patch21: cpio-2.6-checksum.patch Patch21: cpio-2.6-checksum.patch
Patch22: cpio-2.6-writeOutHeaderBufferOverflow.patch Patch22: cpio-2.6-writeOutHeaderBufferOverflow.patch
Patch23: cpio-2.6-largeFileGrew.patch
Patch24: cpio-2.6-toAsciiError.patch
%ifnos linux %ifnos linux
Prereq: /sbin/rmt Prereq: /sbin/rmt
%endif %endif
@ -56,8 +54,6 @@ Install cpio if you need a program to manage file archives.
%patch20 -p1 -b .warnings %patch20 -p1 -b .warnings
%patch21 -p1 -b .checksum %patch21 -p1 -b .checksum
%patch22 -p1 -b .bufferOverflow %patch22 -p1 -b .bufferOverflow
%patch23 -p1 -b .largeFileGrew
%patch24 -p1 -b .toAsciiError
autoheader autoheader
%build %build
@ -107,6 +103,13 @@ fi
%{_infodir}/*.info* %{_infodir}/*.info*
%changelog %changelog
* Wed Mar 15 2006 Peter Vrabec <pvrabec@redhat.com> 2.6-13
- merge toAsciiError.patch with writeOutHeaderBufferOverflow.patch
- merge largeFileGrew.patch with lfs.patch
- fix large file support, cpio is able to store files<8GB
in 'old ascii' format (-H odc option)
- adjust warnings.patch
* Tue Mar 14 2006 Peter Vrabec <pvrabec@redhat.com> 2.6-12 * Tue Mar 14 2006 Peter Vrabec <pvrabec@redhat.com> 2.6-12
- fix warn_if_file_changed() and set exit code to #1 when - fix warn_if_file_changed() and set exit code to #1 when
cpio fails to store file > 4GB (#183224) cpio fails to store file > 4GB (#183224)