public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Readelf: --wide as default if output is redirected
@ 2020-09-16 16:06 Katharina Bogad
  2020-09-16 18:01 ` H.J. Lu
  2020-09-17  9:55 ` Nick Clifton
  0 siblings, 2 replies; 7+ messages in thread
From: Katharina Bogad @ 2020-09-16 16:06 UTC (permalink / raw)
  To: binutils

Hi list,

as I spent the last hour or so trying to figure out why some function names 
in the output of readelf -r cannot be found and then realizing that readelf has 
silently truncated them, I was wondering if it was possible to make --wide the
default if the output is redirected (as I was reading it in a pager anyways).

Now, as this is a pure quality of life improvement, I wanted to speak to someone
before submitting a patch. I know that changing any API, especially in a tool
as widely used like binutils is a huge deal, but I want to discuss this anyways.

Best,
Katharina

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Readelf: --wide as default if output is redirected
  2020-09-16 16:06 Readelf: --wide as default if output is redirected Katharina Bogad
@ 2020-09-16 18:01 ` H.J. Lu
  2020-09-17  9:55 ` Nick Clifton
  1 sibling, 0 replies; 7+ messages in thread
From: H.J. Lu @ 2020-09-16 18:01 UTC (permalink / raw)
  To: Katharina Bogad; +Cc: binutils

On Wed, Sep 16, 2020 at 9:06 AM Katharina Bogad via Binutils
<binutils@sourceware.org> wrote:
>
> Hi list,
>
> as I spent the last hour or so trying to figure out why some function names
> in the output of readelf -r cannot be found and then realizing that readelf has
> silently truncated them, I was wondering if it was possible to make --wide the
> default if the output is redirected (as I was reading it in a pager anyways).
>
> Now, as this is a pure quality of life improvement, I wanted to speak to someone
> before submitting a patch. I know that changing any API, especially in a tool
> as widely used like binutils is a huge deal, but I want to discuss this anyways.
>

FWIW, I always pass --wide to readelf.

-- 
H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Readelf: --wide as default if output is redirected
  2020-09-16 16:06 Readelf: --wide as default if output is redirected Katharina Bogad
  2020-09-16 18:01 ` H.J. Lu
@ 2020-09-17  9:55 ` Nick Clifton
  2020-09-17 10:36   ` Katharina Bogad
  1 sibling, 1 reply; 7+ messages in thread
From: Nick Clifton @ 2020-09-17  9:55 UTC (permalink / raw)
  To: Katharina Bogad, binutils

Hi Katharina,

> as I spent the last hour or so trying to figure out why some function names 
> in the output of readelf -r cannot be found and then realizing that readelf has 
> silently truncated them,

Which version of readelf ?  

I added a new feature to the 2.35 release so that by default readelf will 
suffix truncated symbol names with "[...]", thus letting the reader know
that the name has been abbreviated.


> I was wondering if it was possible to make --wide the
> default if the output is redirected (as I was reading it in a pager anyways).
> 
> Now, as this is a pure quality of life improvement, I wanted to speak to someone
> before submitting a patch. I know that changing any API, especially in a tool
> as widely used like binutils is a huge deal, but I want to discuss this anyways.

Yeah, I think that changing the default behaviour like this would be a bad
idea.  But of course you can always create a wrapper script that adds the --wide
option (and maybe invokes the pager at the same time).

Cheers
  Nick



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Readelf: --wide as default if output is redirected
  2020-09-17  9:55 ` Nick Clifton
@ 2020-09-17 10:36   ` Katharina Bogad
  2020-09-17 15:37     ` Nick Clifton
  2020-09-17 15:59     ` Fangrui Song
  0 siblings, 2 replies; 7+ messages in thread
From: Katharina Bogad @ 2020-09-17 10:36 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Hi Nick, 

> Which version of readelf ?  

2.31 and 2.24. I am kind of stuck with the latter one because it belongs to
an embedded systems development SDK I have no control over.

> I added a new feature to the 2.35 release so that by default readelf will 
> suffix truncated symbol names with "[...]", thus letting the reader know
> that the name has been abbreviated.

Yeah, that at least makes it obvious. Thank you!

> Yeah, I think that changing the default behaviour like this would be a bad
> idea.  But of course you can always create a wrapper script that adds the --wide
> option (and maybe invokes the pager at the same time).

Well, my argument would be that redirection is good for basically three
things:
  - archival
  - automated processing
  - reading in a pager

Truncating the output IMO does not add value in any of these cases; with
the obvious exception being pagers that can’t be configured to not wrap lines.
In fact, I’d make the argument that it is counter-productive for archival and
automated processing (you’d have to pass --wide anyways to get accurate
results, and it was definitely a gotcha for me, making the behaviour non-
obvious). Maybe I am missing something, but I can’t think of a use-case 
where truncating would add value besides viewing in a width-restricted 
terminal.

But really, I’m fine either way. Future me will thank you for the dots once I 
forget that --wide is a thing and binutils >=2.35 has hit my toolchains.

Best,
Katharina

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Readelf: --wide as default if output is redirected
  2020-09-17 10:36   ` Katharina Bogad
@ 2020-09-17 15:37     ` Nick Clifton
  2020-09-17 15:59     ` Fangrui Song
  1 sibling, 0 replies; 7+ messages in thread
From: Nick Clifton @ 2020-09-17 15:37 UTC (permalink / raw)
  To: Katharina Bogad; +Cc: binutils

Hi Katharina,

> But really, I’m fine either way. Future me will thank you for the dots once I 
> forget that --wide is a thing and binutils >=2.35 has hit my toolchains.

Plus if you really want you can give 2.35 readelf the --silent-truncation command
line option and restore the horrible old behaviour!  Yay!

Cheers
  Nick



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Readelf: --wide as default if output is redirected
  2020-09-17 10:36   ` Katharina Bogad
  2020-09-17 15:37     ` Nick Clifton
@ 2020-09-17 15:59     ` Fangrui Song
  2020-09-18 13:57       ` Mark Wielaard
  1 sibling, 1 reply; 7+ messages in thread
From: Fangrui Song @ 2020-09-17 15:59 UTC (permalink / raw)
  To: Katharina Bogad; +Cc: Nick Clifton, binutils

On Thu, Sep 17, 2020 at 3:36 AM Katharina Bogad via Binutils
<binutils@sourceware.org> wrote:
>
> Hi Nick,
>
> > Which version of readelf ?
>
> 2.31 and 2.24. I am kind of stuck with the latter one because it belongs to
> an embedded systems development SDK I have no control over.
>
> > I added a new feature to the 2.35 release so that by default readelf will
> > suffix truncated symbol names with "[...]", thus letting the reader know
> > that the name has been abbreviated.
>
> Yeah, that at least makes it obvious. Thank you!
>
> > Yeah, I think that changing the default behaviour like this would be a bad
> > idea.  But of course you can always create a wrapper script that adds the --wide
> > option (and maybe invokes the pager at the same time).
>
> Well, my argument would be that redirection is good for basically three
> things:
>   - archival
>   - automated processing
>   - reading in a pager
>
> Truncating the output IMO does not add value in any of these cases; with
> the obvious exception being pagers that can’t be configured to not wrap lines.
> In fact, I’d make the argument that it is counter-productive for archival and
> automated processing (you’d have to pass --wide anyways to get accurate
> results, and it was definitely a gotcha for me, making the behaviour non-
> obvious). Maybe I am missing something, but I can’t think of a use-case
> where truncating would add value besides viewing in a width-restricted
> terminal.
>
> But really, I’m fine either way. Future me will thank you for the dots once I
> forget that --wide is a thing and binutils >=2.35 has hit my toolchains.
>
> Best,
> Katharina

Yeah, I created an alias 're' for 'readelf -W'. Sometimes I need to
provide a command for others and omitting -W has always caused me
trouble.

To provide a data point, llvm-readelf supports only the wide format
and ignores --wide. It turns out that most projects don't need a
change.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Readelf: --wide as default if output is redirected
  2020-09-17 15:59     ` Fangrui Song
@ 2020-09-18 13:57       ` Mark Wielaard
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Wielaard @ 2020-09-18 13:57 UTC (permalink / raw)
  To: Fangrui Song, Katharina Bogad; +Cc: binutils

Hi,

On Thu, 2020-09-17 at 08:59 -0700, Fangrui Song wrote:
> Yeah, I created an alias 're' for 'readelf -W'. Sometimes I need to
> provide a command for others and omitting -W has always caused me
> trouble.
> 
> To provide a data point, llvm-readelf supports only the wide format
> and ignores --wide. It turns out that most projects don't need a
> change.

Same for eu-readelf:

  -W, --wide        Ignored for compatibility (lines always wide)

Cheers,

Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-18 13:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 16:06 Readelf: --wide as default if output is redirected Katharina Bogad
2020-09-16 18:01 ` H.J. Lu
2020-09-17  9:55 ` Nick Clifton
2020-09-17 10:36   ` Katharina Bogad
2020-09-17 15:37     ` Nick Clifton
2020-09-17 15:59     ` Fangrui Song
2020-09-18 13:57       ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).