GNU bug report logs - #53548
[PATCH] Harden beautify-description

Previous Next

Package: guix-patches;

Reported by: Alice BRENON <alice.brenon <at> ens-lyon.fr>

Date: Wed, 26 Jan 2022 09:42:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Alice BRENON <alice.brenon <at> ens-lyon.fr>
Cc: 53548 <at> debbugs.gnu.org, Xinglu Chen <public <at> yoctocell.xyz>, Julien Lepiller <julien <at> lepiller.eu>
Subject: [bug#53548] [PATCH] Harden beautify-description
Date: Tue, 01 Feb 2022 00:09:40 +0100
Hi Alice,

Alice BRENON <alice.brenon <at> ens-lyon.fr> skribis:

> Missing metadata in packages used to break their imports, at least for
> opam packages, until this was fixed by Julien in
> 24aa7b3c21309b63cc6e8e18d6417d2cddccf6c6. When Xinglu improved the
> output of descriptions in 155fc235b5e1b41b4665c782365dd2bf11beae9c, it
> made the imports break again in the case when the `description` field
> is missing and Julien's fix applies, returning #f in `metadata-ref`
> instead of crashing. Trouble is: beautify-description expects its
> description argument to be a string and will crash if this assumption
> isn't met (when calling the `string-prefix?` predicate).

Thanks for explaining!  Some comments:

> From 22f0523ef3599b45af9448bd4f31f7b8f8ce6af2 Mon Sep 17 00:00:00 2001
> From: Alice BRENON <alice.brenon <at> ens-lyon.fr>
> Date: Wed, 26 Jan 2022 09:27:12 +0100
> Subject: [PATCH] guix: import: Harden beautify-description.
>
> * guix/import/utils.scm (beautify-description): Handle non-string
> arguments.
> * guix/import/opam.scm: [use-modules] Make imports explicit for module
> (guix import utils).

[...]

>    #:use-module ((guix utils) #:select (cache-directory
>                                         version>?
>                                         call-with-temporary-output-file))
> -  #:use-module (guix import utils)
> +  #:use-module ((guix import utils) #:select (beautify-description
> +                                              guix-hash-url
> +                                              recursive-import
> +                                              spdx-string->license
> +                                              url-fetch))

It can’t hurt.

> +                  ((not (string? description))
> +                   (let ((home-url "https://guix.gnu.org/")
> +                         (doc-path "fr/manual/devel/en/html_node/")
> +                         (page
> +                           "Synopses-and-Descriptions.html#Synopses-and-Descriptions"))
> +                     (string-append
> +                       "Please fill in the description of your package before "
> +                       "submitting ! See "
> +                       home-url doc-path page)))

I’d avoid the URL and maybe make the string translatable, like so:

  (G_ "This package lacks a description …
Run \"info '(guix) Synopses and Descriptions'\" for more information.")

… where ‘G_’ comes from (guix i18n).

WDYT?

This looks like a welcome improvement to me.

Thanks!

Ludo’.




This bug report was last modified 3 years and 102 days ago.

Previous Next


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