GNU bug report logs - #22536
"transferredd" typo in GNU Guix

Previous Next

Package: guix;

Reported by: <nicolasmaia <at> tutanota.com>

Date: Tue, 2 Feb 2016 20:12:01 UTC

Severity: normal

Merged with 22713

Done: Andreas Enge <andreas <at> enge.fr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22536 in the body.
You can then email your comments to 22536 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#22536; Package guix. (Tue, 02 Feb 2016 20:12:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to <nicolasmaia <at> tutanota.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 02 Feb 2016 20:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: <nicolasmaia <at> tutanota.com>
To: <bug-guix <at> gnu.org>
Subject: "transferredd" typo in GNU Guix
Date: Tue, 2 Feb 2016 19:56:02 +0000 (UTC)
[Message part 1 (text/plain, inline)]
Upon doing "guix system init /mnt/etc/config.scm /mnt" during an install, I 
see multiple packages that are downloaded and it then says "XMiB 
transferredd".

This typo should be fixed.

Nicolas Maia
--
Enviado seguramente pelo Tutanota. Torne sua caixa de correio criptografada 
hoje mesmo!https://tutanota.com
[Message part 2 (text/html, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#22536; Package guix. (Tue, 02 Feb 2016 21:20:02 GMT) Full text and rfc822 format available.

Message #8 received at 22536 <at> debbugs.gnu.org (full text, mbox):

From: Jookia <166291 <at> gmail.com>
To: nicolasmaia <at> tutanota.com
Cc: 22536 <at> debbugs.gnu.org
Subject: Re: bug#22536: "transferredd" typo in GNU Guix
Date: Wed, 3 Feb 2016 08:15:26 +1100
On Tue, Feb 02, 2016 at 07:56:02PM +0000, nicolasmaia <at> tutanota.com wrote:
> Upon doing "guix system init /mnt/etc/config.scm /mnt" during an install, I 
> see multiple packages that are downloaded and it then says "XMiB 
> transferredd".
> 
> This typo should be fixed.

To add on this, it's a bit more complicated than that: It's due to the progress
bar changing to a smaller size and not clearing the line completely.




Merged 22536 22713. Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Tue, 23 Feb 2016 13:29:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#22536; Package guix. (Fri, 08 Apr 2016 18:08:02 GMT) Full text and rfc822 format available.

Message #13 received at 22536 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: Guix-devel <guix-devel <at> gnu.org>, 22536 <at> debbugs.gnu.org,
 Leo Famulari <leo <at> famulari.name>
Subject: Re: guix lint
Date: Fri, 8 Apr 2016 20:07:45 +0200
> There may other places to fix, see <http://bugs.gnu.org/22536>.

Yeah, there's one at guix/build/download.scm in function "progress-proc". 

I checked what "string-pad-middle" - which is used by the function "progress-proc" - does and I... object to it in priciple. 

What it does is add padding (in the middle) in order to make a string at least a certain length (sometimes more!).

So we have:

>>> (string-pad-middle "http://foo" "bar 34 B/s" 80)
"http://foo                                                        bar 34 B/s"

Arguments against it are (o: questionable mitigation, leaning heavily against; *: against it with OK mitigation; X: definitely against it):
o The terminal width is not passed to it correctly (can be fixed, although I have to read up on what the currently recommeded way is. tcgetattr ?).
o The terminal width can change while the script is running (can this be fixed? It would need a SIGWINCH handler and some kind of notification to scripts/download so it reprints the progress text). Now you can have a race between (1) and (2), fun.
* The terminal width can be changed after the script is done and has printed its thing (nobody can fix the output up anymore). In our present case, the text is supposedly ephemeral, so it shouldn't be there anymore, so it's fine.
o Since it uses string-length it doesn't actually count how many glyphs would be printed on the terminal, while it should do so (this can be fixed - but at large complexity increase and as long as the terminal doesn't use variable-width fonts; arguably if it's documented to be only used for ASCII strings it's simple. We should probably do the latter - and never translate it into another human language).
o The resulting string can be longer than what it was told to (can be fixed - although what should it cut off first then? The first or the second string? the first string is the (abbreviate file) and the second string contains transferred amount, speed etc).
* Overengineering helps no one. If the terminal is not wide enough, let the user resize it or the terminal handler virtual-word-wrap it or whatever instead of this abbreviation business. Anything but every program guessing how wide the tty is at some random point in time. Many GNU tools do the latter and I wish they would stop it and just print the entire thing. Because the progress is ephemeral (it's replaced by a new paragraph every time), this argument is not so strong here.
o Having this maximal padding in-between means that if we misjudge the glyph width, it will certainly mess up the display. While if we didn't have this padding, the error would often not manifest as failure (if there's enough free space left anyway). Why do it?

Any more arguments for or against it?

I can also fix up string-pad-middle while maintaining its way, but just for the record, this is a bad way of doing it.

If we are concerned about all emphemeral "transferred" lines lining up, just print the speed first (with fixed width, if possible) and the URL afterwards, with one space in-between.

We could abbreviate it if we have to - but should the download fail, the error message then has to contain the unabbreviated URL for usability (note: it does). At that point, why have the URL in the download progress at all? Total percentage done (over all the downloads) would be a lot more useful.

If we do print a table, I would suggest setting a tab stop (using ESC H or similar) and using the tab character to print tables - that's what they are for. Note: there's a standalone "column -t" tool which also does the right thing, apparently.

Also, is there a control character which returns to the beginning of the paragraph? Double-clicking on a paragraph in gnome-terminal selects the entire paragraph - so it does know what extent the paragraph has. However, printing CR returns me to the beginning of the row, not the beginning of the paragraph.

The terminal could be such a nice universal text interface - if programs don't have to know presentation details like how wide the terminal is currently. Why should a program have to care? *shakes head*




Information forwarded to bug-guix <at> gnu.org:
bug#22536; Package guix. (Fri, 08 Apr 2016 18:46:02 GMT) Full text and rfc822 format available.

Message #16 received at 22536 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 22536 <at> debbugs.gnu.org
Subject: Progress on the guix download progress display
Date: Fri, 8 Apr 2016 20:45:30 +0200
A quick try to get a prefer-the-tail string concatenator to work - still has some limitations:

(define (abbreviate text len)
  (string-take text (min len (string-length text))))
(define (abbreviate-texts-prefer-to-take-tail texts len)
  "Given a list of strings TEXTS, returns a string, containing at most LEN codepoints.
   If possible, prefers to still keep the last text. If this text is too long, takes as many heading codepoints as possible of it.
   If there's still space, also keeps the second-to-last text. If this text is too long, takes as many heading codepoints as possible of it.
   ...
   If there's still space, also keeps the first text. If this text is too long, takes as many heading codepoints as possible of it.
   We have no idea how wide it will actually be when displayed, so:
   - make sure to only use it with ASCII text, or
   - at least only use it with half-width characters."
  (if (null? texts)
      ""
      (let* ((remainder (abbreviate-texts-prefer-to-take-tail (cdr texts) len))
             (len (- len (string-length remainder)))
             (text (abbreviate (car texts) len)))
             (string-append text remainder))))
(display (abbreviate-texts-prefer-to-take-tail '("hello world" " " "this i") 10))
(newline)




Information forwarded to bug-guix <at> gnu.org:
bug#22536; Package guix. (Thu, 14 Apr 2016 22:39:01 GMT) Full text and rfc822 format available.

Message #19 received at 22536 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: Guix-devel <guix-devel <at> gnu.org>, 22536 <at> debbugs.gnu.org,
 Leo Famulari <leo <at> famulari.name>
Subject: Re: bug#22536: guix lint
Date: Fri, 15 Apr 2016 00:38:15 +0200
Danny Milosavljevic <dannym <at> scratchpost.org> skribis:

>>>> (string-pad-middle "http://foo" "bar 34 B/s" 80)
> "http://foo                                                        bar 34 B/s"
>
> Arguments against it are (o: questionable mitigation, leaning heavily against; *: against it with OK mitigation; X: definitely against it):
> o The terminal width is not passed to it correctly (can be fixed, although I have to read up on what the currently recommeded way is. tcgetattr ?).
> o The terminal width can change while the script is running (can this be fixed? It would need a SIGWINCH handler and some kind of notification to scripts/download so it reprints the progress text). Now you can have a race between (1) and (2), fun.
> * The terminal width can be changed after the script is done and has printed its thing (nobody can fix the output up anymore). In our present case, the text is supposedly ephemeral, so it shouldn't be there anymore, so it's fine.

Unfortunately, except when using ‘guix download’, this code’s stdout is
always captured by the daemon, which in turn passes it to the client
(the ‘guix’ command), and the client’s terminal width can hardly be
known to the download code.

However, commit b0a6a9713076347c14ee2dd0ea494ab086df2a82 improves the
situation in some cases.

> o Since it uses string-length it doesn't actually count how many glyphs would be printed on the terminal, while it should do so (this can be fixed - but at large complexity increase and as long as the terminal doesn't use variable-width fonts; arguably if it's documented to be only used for ASCII strings it's simple. We should probably do the latter - and never translate it into another human language).

‘string-length’ returns the number of Unicode codepoints, which is the
number of glyphs in this case.

> I can also fix up string-pad-middle while maintaining its way, but just for the record, this is a bad way of doing it.
>
> If we are concerned about all emphemeral "transferred" lines lining up, just print the speed first (with fixed width, if possible) and the URL afterwards, with one space in-between.

I believe this one is fixed by 8a2154fefaafe631905c12891c9c2587dadbc863.

> We could abbreviate it if we have to - but should the download fail, the error message then has to contain the unabbreviated URL for usability (note: it does). At that point, why have the URL in the download progress at all? Total percentage done (over all the downloads) would be a lot more useful.

This was initially discussed at
<https://lists.gnu.org/archive/html/guix-devel/2015-09/msg00390.html>.
It seems we’ve diverged from what was proposed there, though.

Thoughts?

> If we do print a table, I would suggest setting a tab stop (using ESC H or similar) and using the tab character to print tables - that's what they are for. Note: there's a standalone "column -t" tool which also does the right thing, apparently.

So, what would be your preference?  :-)

> Also, is there a control character which returns to the beginning of the paragraph? Double-clicking on a paragraph in gnome-terminal selects the entire paragraph - so it does know what extent the paragraph has. However, printing CR returns me to the beginning of the row, not the beginning of the paragraph.

No idea.

Thanks for your feedback!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#22536; Package guix. (Mon, 09 May 2016 22:05:02 GMT) Full text and rfc822 format available.

Message #22 received at 22536 <at> debbugs.gnu.org (full text, mbox):

From: Leo Famulari <leo <at> famulari.name>
To: 22536 <at> debbugs.gnu.org
Subject: Download progress display
Date: Mon, 9 May 2016 18:03:55 -0400
As reported on #guix by user ilit, when the terminal is very narrow, the
download progress line is constantly reprinted, as in this excerpt:

$ guix build -S libreoffice
substitute: warning: failed to install locale: Invalid argument
The following file will be downloaded:
   /gnu/store/yv821gn5z48g19mzjcvb4dfcxljjsg8q-libreoffice-5.0.5.2.tar.xz
@ substituter-started /gnu/store/yv821gn5z48g19mzjcvb4dfcxljjsg8q-libreoffice-5.0.5.2.tar.xz /gnu/store/9p7mf2a21c6a5k06jgbb9yg9abx7ilh9-guix-0.10.0-0.8062/libexec/guix/substitute
warning: failed to install locale: Invalid argument

Found valid signature for /gnu/store/yv821gn5z48g19mzjcvb4dfcxljjsg8q-libreoffice-5.0.5.2.tar.xz
From https://4606.nsupdate.info/nar/yv821gn5z48g19mzjcvb4dfcxljjsg8q-libreoffice-5.0.5.2.tar.xz
Downloading yv821g...-libreoffice-5.0.5.2.tar.xz (159.4MiB installed)...
 libreoffice-5.0.5.2.tar.xz 2.7MiB/s 00:00 | 104KiB transferre libreoffice-5.0.5.2.tar.xz 2.7MiB/s 00:00 | 112KiB transferre libreoffice-5.0.5.2.tar.xz 2.9MiB/s 00:00 | 120KiB transferre libreoffice-5.0.5.2.tar.xz 2.7MiB/s 00:00 | 128KiB transferre libreoffice-5.0.5.2.tar.xz 2.8MiB/s 00:00 | 136KiB transferre libreoffice-5.0.5.2.tar.xz 2.8MiB/s 00:00 | 144KiB transferre libreoffice-5.0.5.2.tar.xz 2.9MiB/s 00:00 | 152KiB transferre libreoffice-5.0.5.2.tar.xz 3.0MiB/s 00:00 | 160KiB transferre lib




Information forwarded to bug-guix <at> gnu.org:
bug#22536; Package guix. (Mon, 05 Feb 2018 22:05:02 GMT) Full text and rfc822 format available.

Message #25 received at 22536 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Enge <andreas <at> enge.fr>
To: 22536 <at> debbugs.gnu.org
Subject: Re: Download progress display
Date: Mon, 5 Feb 2018 23:04:52 +0100
The progress bar has been revamped since this bug was submitted, and the
original problem is solved.

On a very narrow terminal, lines may still be printed repeatedly, but anyway
there is a problem then to display all information legibly.

I think that this bug report can safely be closed, but wait for another
opinion before doing so.

Andreas





Reply sent to Andreas Enge <andreas <at> enge.fr>:
You have taken responsibility. (Wed, 14 Feb 2018 21:35:01 GMT) Full text and rfc822 format available.

Notification sent to <nicolasmaia <at> tutanota.com>:
bug acknowledged by developer. (Wed, 14 Feb 2018 21:35:02 GMT) Full text and rfc822 format available.

Message #30 received at 22536-done <at> debbugs.gnu.org (full text, mbox):

From: Andreas Enge <andreas <at> enge.fr>
To: 22536-done <at> debbugs.gnu.org
Subject: Re: bug#22536: Download progress display
Date: Wed, 14 Feb 2018 22:34:27 +0100
Closing this bug since I did not receive an adverse opinion in a week.

Andreas





Reply sent to Andreas Enge <andreas <at> enge.fr>:
You have taken responsibility. (Wed, 14 Feb 2018 21:35:02 GMT) Full text and rfc822 format available.

Notification sent to Danny Milosavljevic <dannym <at> scratchpost.org>:
bug acknowledged by developer. (Wed, 14 Feb 2018 21:35:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 15 Mar 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.