Include the filename concerned in readelf error messages.
Relates: #1412348
This commit is contained in:
parent
b877ba7c27
commit
4ae66ca2b6
84
binutils-2.27-filename-in-error-messages.patch
Normal file
84
binutils-2.27-filename-in-error-messages.patch
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
--- binutils-2.27.orig/binutils/readelf.c 2017-01-16 11:51:05.043922264 +0000
|
||||||
|
+++ binutils-2.27/binutils/readelf.c 2017-01-16 12:01:34.389053872 +0000
|
||||||
|
@@ -16733,39 +16733,49 @@ process_archive (char * file_name, FILE
|
||||||
|
static int
|
||||||
|
process_file (char * file_name)
|
||||||
|
{
|
||||||
|
+ char * name;
|
||||||
|
+ char * saved_program_name;
|
||||||
|
FILE * file;
|
||||||
|
struct stat statbuf;
|
||||||
|
char armag[SARMAG];
|
||||||
|
- int ret;
|
||||||
|
+ int ret = 1;
|
||||||
|
+
|
||||||
|
+ /* Overload program_name to include file_name. Doing this means
|
||||||
|
+ that warning/error messages will positively identify the file
|
||||||
|
+ concerned even when multiple instances of readelf are running. */
|
||||||
|
+ name = xmalloc (strlen (program_name) + strlen (file_name) + 3);
|
||||||
|
+ sprintf (name, "%s: %s", program_name, file_name);
|
||||||
|
+ saved_program_name = program_name;
|
||||||
|
+ program_name = name;
|
||||||
|
|
||||||
|
if (stat (file_name, &statbuf) < 0)
|
||||||
|
{
|
||||||
|
if (errno == ENOENT)
|
||||||
|
- error (_("'%s': No such file\n"), file_name);
|
||||||
|
+ error (_("No such file\n"));
|
||||||
|
else
|
||||||
|
- error (_("Could not locate '%s'. System error message: %s\n"),
|
||||||
|
- file_name, strerror (errno));
|
||||||
|
- return 1;
|
||||||
|
+ error (_("Could not locate file. System error message: %s\n"),
|
||||||
|
+ strerror (errno));
|
||||||
|
+ goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! S_ISREG (statbuf.st_mode))
|
||||||
|
{
|
||||||
|
- error (_("'%s' is not an ordinary file\n"), file_name);
|
||||||
|
- return 1;
|
||||||
|
+ error (_("Not an ordinary file\n"));
|
||||||
|
+ goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
file = fopen (file_name, "rb");
|
||||||
|
if (file == NULL)
|
||||||
|
{
|
||||||
|
- error (_("Input file '%s' is not readable.\n"), file_name);
|
||||||
|
- return 1;
|
||||||
|
+ error (_("Not readable\n"));
|
||||||
|
+ goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fread (armag, SARMAG, 1, file) != 1)
|
||||||
|
{
|
||||||
|
- error (_("%s: Failed to read file's magic number\n"), file_name);
|
||||||
|
+ error (_("Failed to read file's magic number\n"));
|
||||||
|
fclose (file);
|
||||||
|
- return 1;
|
||||||
|
+ goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
current_file_size = (bfd_size_type) statbuf.st_size;
|
||||||
|
@@ -16777,8 +16787,7 @@ process_file (char * file_name)
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (do_archive_index)
|
||||||
|
- error (_("File %s is not an archive so its index cannot be displayed.\n"),
|
||||||
|
- file_name);
|
||||||
|
+ error (_("Not an archive so its index cannot be displayed\n"));
|
||||||
|
|
||||||
|
rewind (file);
|
||||||
|
archive_file_size = archive_file_offset = 0;
|
||||||
|
@@ -16787,7 +16796,10 @@ process_file (char * file_name)
|
||||||
|
|
||||||
|
fclose (file);
|
||||||
|
|
||||||
|
+ done:
|
||||||
|
current_file_size = 0;
|
||||||
|
+ free (program_name);
|
||||||
|
+ program_name = saved_program_name;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
@ -43,7 +43,7 @@
|
|||||||
Summary: A GNU collection of binary utilities
|
Summary: A GNU collection of binary utilities
|
||||||
Name: %{?cross}binutils%{?_with_debug:-debug}
|
Name: %{?cross}binutils%{?_with_debug:-debug}
|
||||||
Version: 2.27
|
Version: 2.27
|
||||||
Release: 13%{?dist}
|
Release: 14%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
URL: http://sources.redhat.com/binutils
|
URL: http://sources.redhat.com/binutils
|
||||||
@ -92,6 +92,8 @@ Patch20: binutils-2.27-objdump-improvements.patch
|
|||||||
Patch21: binutils-2.27-dwarf-parse-speedup.patch
|
Patch21: binutils-2.27-dwarf-parse-speedup.patch
|
||||||
# More objdump speed improvements
|
# More objdump speed improvements
|
||||||
Patch22: binutils-2.27-objdump-improvements.2.patch
|
Patch22: binutils-2.27-objdump-improvements.2.patch
|
||||||
|
# Include the filename concerned in readelf error messages.
|
||||||
|
Patch23: binutils-2.27-filename-in-error-messages.patch
|
||||||
|
|
||||||
Provides: bundled(libiberty)
|
Provides: bundled(libiberty)
|
||||||
|
|
||||||
@ -239,6 +241,7 @@ using libelf instead of BFD.
|
|||||||
%patch20 -p1
|
%patch20 -p1
|
||||||
%patch21 -p1
|
%patch21 -p1
|
||||||
%patch22 -p1
|
%patch22 -p1
|
||||||
|
%patch23 -p1
|
||||||
|
|
||||||
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
|
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
|
||||||
|
|
||||||
@ -604,6 +607,10 @@ exit 0
|
|||||||
%endif # %{isnative}
|
%endif # %{isnative}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jan 16 2017 Nick Clifton <nickc@redhat.com> 2.27-14
|
||||||
|
- Include the filename concerned in readelf error messages.
|
||||||
|
(#1412348)
|
||||||
|
|
||||||
* Mon Jan 09 2017 Nick Clifton <nickc@redhat.com> 2.27-13
|
* Mon Jan 09 2017 Nick Clifton <nickc@redhat.com> 2.27-13
|
||||||
- Another speed up for objdump when displaying source code alognside disassembly.
|
- Another speed up for objdump when displaying source code alognside disassembly.
|
||||||
(#1397113)
|
(#1397113)
|
||||||
|
Loading…
Reference in New Issue
Block a user