This is the mail archive of the 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: The "-W|--wide" option?

Hi Carlos,

we noticed that some of the
do_wide checks were not quite accurate.

I am not really that surprised. We have never been very strict about enforcing the 80 character width limit.

However, without a clear statement about *what* to do with
long lines, the correct fix is unclear.

Hmm, OK, then how about this:

  When do_wide is *not* enabled and an output line would pass
  the 80th column then it must either be wrapped, truncated
  or abbreviated.

  For preference the output should be abbreviated.  Failing
  that truncation should be used.  If however the output is
  part of a new feature and truncation would likely hinder
  its comprehension then wrapping should be employed.  The
  intention here is that without --wide specified the output
  should be short and concise, not long and wordy.

  If the output is wrapped, then some clear indication
  should be given that wrapping has occurred.  If the output
  is abbreviated then a description of the abbreviation(s)
  used should be included, either in the output or the
  documentation or both.  If the output is truncated then it
  should be possible for a user, under reasonable
  circumstances, to tell that truncation has occurred.

This is off the top of my head, so if you have any suggestions for improvement or comments, please feel free to say so.

To give a concrete example:

               if (do_wide || strlen ((char *) directory_table[0])<  76)
                 printf (_("CU: %s/%s:\n"), directory_table[0],

Say directory_table[0] is 75, the printf is at least 81,
that's assuming the second %s is null, and it's not likely
to be null because it's the file name. Therefore this is
a non-wide printout exceeding 80 columns.

However, in hindsight it would appear that the choice itself
is part of the output "ABI" and consumers which previously
expected a full filename output would then only get the
short version.

The manual page isn't strictly clear about the default
behaviour when -W is not in effect.

How strict are we going to be? Must this code remain as-is?

No. In my opinion this is a bug, and the output should be truncated to 80 characters. Consumers that rely upon finding the full filename should be invoking readelf with the --wide option enabled. Failure to do this means that they should expect to see truncated filenames.

Essentially the purpose of -W is to prevent truncation, usually of filenames or function names. Tools that use the output from readelf must decide if they want full or truncated names and invoke the tool appropriately.


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