[PATCH v3] gdb: Improve debuginfod progress updates

Aaron Merey amerey@redhat.com
Wed Feb 16 02:09:40 GMT 2022


Hi Patrick,

Thanks for taking another look.

On Sun, Feb 13, 2022 at 7:56 PM Patrick Monnerat <patrick@monnerat.net> wrote:
> > +      /* Transfer size is known.  */
> > +      double percent = (double)cur / (double)total;
> The variable name is confusing as it is <= 1.0.

update_progress_percent uses the name "howmuch" for this.  It would be
better if "howmuch" was used here too.

> > +
> > +      if (percent >= 0.0 && percent <= 1.0)
> I don't think this test is needed: cur and total are obtained
> (indirectly) from curl and IMHO you can trust it.

I've experienced at least one case where percent was > 1.0.  I haven't
been able to reproduce it because it seemed to coincide with a network
hiccup.  If percent isn't between 0 and 1 then we default to the spinner
to avoid printing a message with a nonsensical completion percentage.

> > +     progress_update object.  */
> > +  void update_progress_bar (double howmuch)
>
> This is never called! why do you provide both PERCENT and (unused) BAR?
> This is a bit confusing.

The progress update message originally included the bar but I now want to
only print messages that fit entirely on one line.  This makes it possible
to rewrite an entire message with transfer size information once it becomes
available.  Because the progress bar was already implemented I figured I'd
leave it in case it ends up serving a purpose in the future.

Aaron



More information about the Gdb-patches mailing list