Fix handling of archives > 4Gb in size by importing patch for PR binutils/14302. (#835957)

This commit is contained in:
Nick Clifton 2012-06-29 11:45:20 +01:00
parent 59f002d13a
commit de3f00e4ec
3 changed files with 144 additions and 1 deletions

1
.gitignore vendored
View File

@ -23,3 +23,4 @@ binutils-2.20.51.0.10.tar.bz2
HOWTO
build-sources
/binutils-2.22.52.0.4.tar.bz2
binutils-2.22.52.0.4/

View File

@ -0,0 +1,136 @@
diff -cp ../binutils-2.22.52.0.4.orig/binutils/ar.c binutils/ar.c
*** ../binutils-2.22.52.0.4.orig/binutils/ar.c 2012-06-29 11:29:55.846149902 +0100
--- binutils/ar.c 2012-06-29 11:31:22.249147172 +0100
*************** open_inarch (const char *archive_filenam
*** 937,946 ****
static void
print_contents (bfd *abfd)
{
! size_t ncopied = 0;
char *cbuf = (char *) xmalloc (BUFSIZE);
struct stat buf;
! size_t size;
if (bfd_stat_arch_elt (abfd, &buf) != 0)
/* xgettext:c-format */
fatal (_("internal stat error on %s"), bfd_get_filename (abfd));
--- 937,946 ----
static void
print_contents (bfd *abfd)
{
! bfd_size_type ncopied = 0;
char *cbuf = (char *) xmalloc (BUFSIZE);
struct stat buf;
! bfd_size_type size;
if (bfd_stat_arch_elt (abfd, &buf) != 0)
/* xgettext:c-format */
fatal (_("internal stat error on %s"), bfd_get_filename (abfd));
*************** print_contents (bfd *abfd)
*** 954,965 ****
while (ncopied < size)
{
! size_t nread;
! size_t tocopy = size - ncopied;
if (tocopy > BUFSIZE)
tocopy = BUFSIZE;
! nread = bfd_bread (cbuf, (bfd_size_type) tocopy, abfd);
if (nread != tocopy)
/* xgettext:c-format */
fatal (_("%s is not a valid archive"),
--- 954,965 ----
while (ncopied < size)
{
! bfd_size_type nread;
! bfd_size_type tocopy = size - ncopied;
if (tocopy > BUFSIZE)
tocopy = BUFSIZE;
! nread = bfd_bread (cbuf, tocopy, abfd);
if (nread != tocopy)
/* xgettext:c-format */
fatal (_("%s is not a valid archive"),
*************** extract_file (bfd *abfd)
*** 990,998 ****
{
FILE *ostream;
char *cbuf = (char *) xmalloc (BUFSIZE);
! size_t nread, tocopy;
! size_t ncopied = 0;
! size_t size;
struct stat buf;
if (bfd_stat_arch_elt (abfd, &buf) != 0)
--- 990,998 ----
{
FILE *ostream;
char *cbuf = (char *) xmalloc (BUFSIZE);
! bfd_size_type nread, tocopy;
! bfd_size_type ncopied = 0;
! bfd_size_type size;
struct stat buf;
if (bfd_stat_arch_elt (abfd, &buf) != 0)
*************** extract_file (bfd *abfd)
*** 1027,1033 ****
if (tocopy > BUFSIZE)
tocopy = BUFSIZE;
! nread = bfd_bread (cbuf, (bfd_size_type) tocopy, abfd);
if (nread != tocopy)
/* xgettext:c-format */
fatal (_("%s is not a valid archive"),
--- 1027,1033 ----
if (tocopy > BUFSIZE)
tocopy = BUFSIZE;
! nread = bfd_bread (cbuf, tocopy, abfd);
if (nread != tocopy)
/* xgettext:c-format */
fatal (_("%s is not a valid archive"),
diff -cp ../binutils-2.22.52.0.4.orig/binutils/bucomm.c binutils/bucomm.c
*** ../binutils-2.22.52.0.4.orig/binutils/bucomm.c 2012-06-29 11:29:56.852149873 +0100
--- binutils/bucomm.c 2012-06-29 11:31:22.250147172 +0100
*************** print_arelt_descr (FILE *file, bfd *abfd
*** 427,442 ****
char timebuf[40];
time_t when = buf.st_mtime;
const char *ctime_result = (const char *) ctime (&when);
/* POSIX format: skip weekday and seconds from ctime output. */
sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
mode_string (buf.st_mode, modebuf);
modebuf[10] = '\0';
/* POSIX 1003.2/D11 says to skip first character (entry type). */
! fprintf (file, "%s %ld/%ld %6ld %s ", modebuf + 1,
(long) buf.st_uid, (long) buf.st_gid,
! (long) buf.st_size, timebuf);
}
}
--- 427,444 ----
char timebuf[40];
time_t when = buf.st_mtime;
const char *ctime_result = (const char *) ctime (&when);
+ bfd_size_type size;
/* POSIX format: skip weekday and seconds from ctime output. */
sprintf (timebuf, "%.12s %.4s", ctime_result + 4, ctime_result + 20);
mode_string (buf.st_mode, modebuf);
modebuf[10] = '\0';
+ size = buf.st_size;
/* POSIX 1003.2/D11 says to skip first character (entry type). */
! fprintf (file, "%s %ld/%ld %6" BFD_VMA_FMT "u %s ", modebuf + 1,
(long) buf.st_uid, (long) buf.st_gid,
! size, timebuf);
}
}
Common subdirectories: ../binutils-2.22.52.0.4.orig/binutils/doc and binutils/doc
Common subdirectories: ../binutils-2.22.52.0.4.orig/binutils/.libs and binutils/.libs
Common subdirectories: ../binutils-2.22.52.0.4.orig/binutils/po and binutils/po
Common subdirectories: ../binutils-2.22.52.0.4.orig/binutils/testsuite and binutils/testsuite
Common subdirectories: ../binutils-2.22.52.0.4.orig/binutils/tmpdir and binutils/tmpdir

View File

@ -17,7 +17,7 @@
Summary: A GNU collection of binary utilities
Name: %{?cross}binutils%{?_with_debug:-debug}
Version: 2.22.52.0.4
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv3+
Group: Development/Tools
URL: http://sources.redhat.com/binutils
@ -40,6 +40,8 @@ Patch08: binutils-2.22.52.0.1-relro-on-by-default.patch
Patch09: binutils-2.22.52.0.1-export-demangle.h.patch
# Backport for https://fedoraproject.org/wiki/Features/DwarfCompressor
Patch10: binutils-2.22.52.0.4-dwz.patch
# Import of FSF PR #14302
Patch11: binutils-2.22.52.0.4-ar-4Gb.patch
%define gold_arches %ix86 x86_64
@ -142,6 +144,7 @@ using libelf instead of BFD.
%endif
%patch09 -p0 -b .export-demangle-h~
%patch10 -p0 -b .dwz~
%patch11 -p0 -b .ar4Gb~
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
@ -436,6 +439,9 @@ exit 0
%endif # %{isnative}
%changelog
* Fri Jun 30 2012 Nick Clifton <nickc@redhat.com> - 2.22.52.0.4-3
- Fix handling of archives > 4Gb in size by importing patch for PR binutils/14302. (#835957)
* Tue Jun 19 2012 Jakub Jelinek <jakub@redhat.com> - 2.22.52.0.4-2
- Add minimal dwz -m support.