This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] gas/as.c: print input and output details when error




On 08/09/2018 04:29 PM, Jan Beulich wrote:
On 09.08.18 at 10:20, <liezhi.yang@windriver.com> wrote:
On 08/09/2018 03:42 PM, Jan Beulich wrote:
On 09.08.18 at 05:49, <liezhi.yang@windriver.com> wrote:
--- a/gas/as.c
+++ b/gas/as.c
@@ -1259,8 +1259,10 @@ main (int argc, char ** argv)
   	      if (sib.st_ino == sob.st_ino && sib.st_ino != 0)
   		{
   		  /* Don't let as_fatal remove the output file!  */
+		  saved_out_file_name = xstrdup (out_file_name);
   		  out_file_name = NULL;
-		  as_fatal (_("The input and output files must be distinct"));
+		  as_fatal (_("The input (%s, ino: %ld) and output (%s, ino: %ld) files must be distinct"),
+			   argv[i], sib.st_ino, saved_out_file_name, sob.st_ino);

The if() condition guarantees both ino-s to be the same - why
print the same number twice? Instead, in your next patch,

Yes, "if condition" guarantees that, but we don't know that unless look into
the source code. However, the error messages seems not clear enough, so how
about change the message to:

as_fatal (_("The input '%s' and output '%s' have the same inode %ld"),
             argv[i],  sib.st_ino, saved_out_file_name))

LGTM

Thanks, I will send a V2.

// Robert


perhaps also print dev?

Did you mean print st_dev? I think that we don't need it any more if we update
the error message like above.

Well, I was just thinking that an inode number without device is
sort of lacking some context.

Jan





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]