From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:53636) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5SiV-0002iA-1b for guix-patches@gnu.org; Sat, 22 Feb 2020 06:13:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5SiU-000171-2z for guix-patches@gnu.org; Sat, 22 Feb 2020 06:13:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42631) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j5SiT-00016i-W8 for guix-patches@gnu.org; Sat, 22 Feb 2020 06:13:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j5SiT-000405-Qr for guix-patches@gnu.org; Sat, 22 Feb 2020 06:13:01 -0500 Subject: [bug#39734] [PATCH] scripts: Emit GC hint if free space is lower than absolute and relative threshold. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20200222104653.1324-1-mail@ambrevar.xyz> Date: Sat, 22 Feb 2020 12:12:33 +0100 In-Reply-To: <20200222104653.1324-1-mail@ambrevar.xyz> (Pierre Neidhardt's message of "Sat, 22 Feb 2020 11:46:53 +0100") Message-ID: <874kvizxi6.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Pierre Neidhardt Cc: 39734@debbugs.gnu.org Hi! Pierre Neidhardt skribis: > * guix/scripts.scm (%disk-space-warning-absolute): New variable. > (warn-about-disk-space): Test against %disk-space-warning-absolute. > Fix error in display-hint due to extraneous 'profile' argument. [...] > +(define %disk-space-warning-absolute > + ;; The decimal number of GiB of free disk space below which a warning = is > + ;; emitted. > + (make-parameter (match (and=3D> (getenv "GUIX_DISK_SPACE_WARNING_ABSOL= UTE") > + string->number) > + (#f 17.0) > + (threshold threshold)))) Perhaps we should arrange for =E2=80=98GUIX_DISK_SPACE_WARNING=E2=80=99 to = handle both cases? That is, we=E2=80=99d first try to convert it with =E2=80=98size->number=E2= =80=99; if that works, it=E2=80=99s an absolute measure, and if it returns #f, then pass the string to =E2=80=98string->number=E2=80=99 and assume it=E2=80=99s a fracti= on. Does that make sense? > + (absolute-threshold-in-bytes (* 1024 1024 1024 absolute-thresho= ld))) Always use bytes internally; that is, convert to bytes at the UI border. Thanks, Ludo=E2=80=99.