all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: Guix-devel <guix-devel@gnu.org>, 22536@debbugs.gnu.org
Subject: Re: bug#22536: guix lint
Date: Fri, 15 Apr 2016 00:38:15 +0200	[thread overview]
Message-ID: <87shynhl48.fsf@gnu.org> (raw)
In-Reply-To: <20160408200745.49b3a761@scratchpost.org> (Danny Milosavljevic's message of "Fri, 8 Apr 2016 20:07:45 +0200")

Danny Milosavljevic <dannym@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’.

  parent reply	other threads:[~2016-04-14 22:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 12:37 guix lint Danny Milosavljevic
2016-04-07 15:09 ` Leo Famulari
2016-04-07 17:20   ` Efraim Flashner
2016-04-07 21:48   ` Ludovic Courtès
2016-04-08 18:07     ` Danny Milosavljevic
2016-04-08 18:45       ` bug#22536: Progress on the guix download progress display Danny Milosavljevic
2016-04-14 22:38       ` bug#22536: guix lint Ludovic Courtès
2016-04-14 22:38       ` Ludovic Courtès [this message]
2016-04-08 18:07     ` Danny Milosavljevic
2016-04-08 15:59 ` [PATCH] guix lint: at the "checking" line, make sure to delete the old line's text before overwriting it (with a possibly shorter text) Danny Milosavljevic
2016-04-13 21:20   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shynhl48.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=22536@debbugs.gnu.org \
    --cc=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.