From mboxrd@z Thu Jan 1 00:00:00 1970 From: iyzsong@member.fsf.org (=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?=) Subject: bug#28756: Substitute download progress bar doesn't reach 100% Date: Mon, 16 Oct 2017 21:06:00 +0800 Message-ID: <87d15nmedj.fsf@member.fsf.org> References: <20171009035203.GA8019@jasmine.lan> <87efqcahur.fsf@gnu.org> <87infkv3ai.fsf@member.fsf.org> <87y3od93dg.fsf@member.fsf.org> <87lgkcuryg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e456n-0001EF-DS for bug-guix@gnu.org; Mon, 16 Oct 2017 09:07:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e456k-00058L-7G for bug-guix@gnu.org; Mon, 16 Oct 2017 09:07:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:33939) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e456k-000588-3K for bug-guix@gnu.org; Mon, 16 Oct 2017 09:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e456j-0004pL-Lx for bug-guix@gnu.org; Mon, 16 Oct 2017 09:07:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: 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") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 28756@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Hello, > > iyzsong@member.fsf.org (=E5=AE=8B=E6=96=87=E6=AD=A6) skribis: > >> iyzsong@member.fsf.org (=E5=AE=8B=E6=96=87=E6=AD=A6) writes: >> >>> ludo@gnu.org (Ludovic Court=C3=A8s) writes: >>> >>>> Hello, >>>> >>>> Leo Famulari 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/drm4pj1k5mkb57= 84i0rkqb0bg2z8lmyw-libabw-0.1.1... >>>>> libabw-0.1.1 346KiB >>>> >>>> Indeed, I=E2=80=99ve noticed too, and I think it relates to the new pr= ogress >>>> reporters. =E5=AE=8B=E6=96=87=E6=AD=A6, do you experience this as wel= l? 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: =3D?UTF-8?q?=3DE5=3DAE=3D8B=3DE6=3D96=3D87=3DE6=3DAD=3DA6?=3D >> Date: Sat, 14 Oct 2017 22:45:55 +0800 >> Subject: [PATCH] guix: substitute: Report the last process in the child >> process. >> >> Fixes . >> >> * guix/utils.scm (filtered-port): Close the 'input' port in the child pr= ocess. >> * guix/scripts/substitute.scm (progress-substitution): Close the 'progre= ss' >> port before 'restore-file'. > > [...] > >> + ;; A child process of 'decompressed-port' will read from this 'pr= ocess' > ^^^^^^^= ^^^^^^ > =E2=80=A6 will read from PROGRESS > >> + ;; port and thus report the actual progress to the console. As t= he >> + ;; 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=E2=80=99t =E2=80=98filtered-port=E2=80=99 always close INPUT in t= he 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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-guix-substitute-Report-the-last-progress-in-the-chil.patch >From 6a3fa69f96fc2e3e074a9275066640ddfee57fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Sat, 14 Oct 2017 22:45:55 +0800 Subject: [PATCH] guix: substitute: Report the last progress in the child process. Fixes . * 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))))) ;;; 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 --=-=-= Content-Type: text/plain Thanks for the help and review! --=-=-=--