From: iyzsong@member.fsf.org (宋文武)
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 28756@debbugs.gnu.org
Subject: bug#28756: Substitute download progress bar doesn't reach 100%
Date: Mon, 16 Oct 2017 21:06:00 +0800 [thread overview]
Message-ID: <87d15nmedj.fsf@member.fsf.org> (raw)
In-Reply-To: <87lgkcuryg.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 15 Oct 2017 21:33:11 +0200")
[-- Attachment #1: Type: text/plain, Size: 2457 bytes --]
ludo@gnu.org (Ludovic Courtès) writes:
> Hello,
>
> iyzsong@member.fsf.org (宋文武) skribis:
>
>> iyzsong@member.fsf.org (宋文武) writes:
>>
>>> ludo@gnu.org (Ludovic Courtès) writes:
>>>
>>>> Hello,
>>>>
>>>> Leo Famulari <leo@famulari.name> skribis:
>>>>
>>>>> I just upgraded to the latest Guix and, while downloading substitutes, I
>>>>> noticed the progress bar seems to never reach 100%, as shown below. I'm
>>>>> not sure if this started recently or not.
>>>>>
>>>>> Downloading https://mirror.hydra.gnu.org/guix/nar/gzip/drm4pj1k5mkb5784i0rkqb0bg2z8lmyw-libabw-0.1.1...
>>>>> libabw-0.1.1 346KiB
>>>>
>>>> Indeed, I’ve noticed too, and I think it relates to the new progress
>>>> reporters. 宋文武, do you experience this as well? Thoughts?
>>>>
>>>
>>> Yes, thanks for the report, commit abaee53c8 should fix it.
>>>
>>
>> Well, it didn't... I have to learn it's a child process will read and
>> report the process:
>>
>> From 93b42f62ece1ad5181ed1119fc750bcbb74c5d3c Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@member.fsf.org>
>> Date: Sat, 14 Oct 2017 22:45:55 +0800
>> Subject: [PATCH] guix: substitute: Report the last process in the child
>> process.
>>
>> Fixes <https://bugs.gnu.org/28756>.
>>
>> * guix/utils.scm (filtered-port): Close the 'input' port in the child process.
>> * guix/scripts/substitute.scm (progress-substitution): Close the 'progress'
>> port before 'restore-file'.
>
> [...]
>
>> + ;; A child process of 'decompressed-port' will read from this 'process'
> ^^^^^^^^^^^^^
> … will read from PROGRESS
>
>> + ;; port and thus report the actual progress to the console. As the
>> + ;; parent process, we should close it at the start.
>> + (close-port progress)
>> ;; Unpack the Nar at INPUT into DESTINATION.
>> (restore-file input destination)
>> (close-port input)
>> - (close-port progress)
>> + (every (compose zero? cdr waitpid) pids)
>
> Since INPUT is a wrapper around PROGRESS, it seems weird to close
> PROGRESS beforehand.
>
> Shouldn’t ‘filtered-port’ always close INPUT in the parent process (the
> second part of the patch you sent closes it in the child process before
> quitting, but we should additionally close it in the parent):
>
Yes, it makes sense:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-guix-substitute-Report-the-last-progress-in-the-chil.patch --]
[-- Type: text/x-patch, Size: 2573 bytes --]
From 6a3fa69f96fc2e3e074a9275066640ddfee57fd2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@member.fsf.org>
Date: Sat, 14 Oct 2017 22:45:55 +0800
Subject: [PATCH] guix: substitute: Report the last progress in the child
process.
Fixes <https://bugs.gnu.org/28756>.
* guix/utils.scm (filtered-port): Close the 'input' port for the current
process, and close it upon exit in the child process.
* guix/scripts/substitute.scm (progress-substitution): Display "\n\n" after
the reporter has finished.
---
guix/scripts/substitute.scm | 11 +++++++----
guix/utils.scm | 2 ++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 921a7c679..60dbdb176 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -956,19 +956,22 @@ DESTINATION as a nar file. Verify the substitute against ACL."
#:abbreviation nar-uri-abbreviation)))
(progress-report-port reporter raw)))
((input pids)
+ ;; NOTE: This 'progress' port of current process will be
+ ;; closed here, while the child process doing the
+ ;; reporting will close it upon exit.
(decompressed-port (and=> (narinfo-compression narinfo)
string->symbol)
progress)))
;; Unpack the Nar at INPUT into DESTINATION.
(restore-file input destination)
(close-port input)
- (close-port progress)
+
+ ;; Wait for the reporter to finish.
+ (every (compose zero? cdr waitpid) pids)
;; Skip a line after what 'progress-reporter/file' printed, and another
;; one to visually separate substitutions.
- (display "\n\n" (current-error-port))
-
- (every (compose zero? cdr waitpid) pids))))
+ (display "\n\n" (current-error-port)))))
\f
;;;
diff --git a/guix/utils.scm b/guix/utils.scm
index de4aa6531..2cf9be36d 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -153,9 +153,11 @@ buffered data is lost."
(close-port in)
(dump-port input out))
(lambda ()
+ (close-port input)
(false-if-exception (close out))
(primitive-_exit 0))))
(child
+ (close-port input)
(close-port out)
(loop in (cons child pids)))))))))
--
2.13.3
[-- Attachment #3: Type: text/plain, Size: 34 bytes --]
Thanks for the help and review!
next prev parent reply other threads:[~2017-10-16 13:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 3:52 bug#28756: Substitute download progress bar doesn't reach 100% Leo Famulari
2017-10-09 7:41 ` Ludovic Courtès
2017-10-12 14:39 ` 宋文武
2017-10-14 15:05 ` 宋文武
2017-10-15 19:33 ` Ludovic Courtès
2017-10-16 13:06 ` 宋文武 [this message]
2017-10-17 7:16 ` Ludovic Courtès
2017-10-17 11:10 ` 宋文武
2017-10-17 12:03 ` Ludovic Courtès
[not found] ` <handler.28756.D28756.150823866318807.notifdone@debbugs.gnu.org>
2017-10-30 14:30 ` bug#28756: closed (Re: bug#28756: Substitute download progress bar doesn't reach 100%) Leo Famulari
2017-10-30 16:37 ` 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=87d15nmedj.fsf@member.fsf.org \
--to=iyzsong@member.fsf.org \
--cc=28756@debbugs.gnu.org \
--cc=ludo@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.