unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Zhu Zihao <all_but_last@163.com>
Cc: Oleg Pykhalov <go.wigust@gmail.com>, 51747@debbugs.gnu.org
Subject: [bug#51747] [PATCH]: gnu: nix: Update to 2.4.
Date: Sat, 15 Jan 2022 11:52:19 +0100	[thread overview]
Message-ID: <0cb528695857acda121e58dee76b1095634ea7bb.camel@telenet.be> (raw)
In-Reply-To: <86bl0da6rn.fsf@163.com>

[-- Attachment #1: Type: text/plain, Size: 3036 bytes --]

Hi,

I looked a bit in the source code, and it seems to be missing
some error checking.  E.g., in libcpuid/cpuid_main.c:,
it is not verified that 'malloc' succeeded.

        list->names = (char**) malloc(sizeof(char*) * n);
        [...]
        list->names[n] = (char*) malloc (i - last)
        [....]
        list->names[n][i - last - 1 = '\0']

It doesn't seem exploitable here, but I would recommend something
like 'xmalloc' instead to avoid (anti-)learning by bad examples.

Also, in the package definition, you are using cmake-build-system.
This works, but the README doesn't mention CMake anywhere and instead
mentions the autotools (autoconf etc.) and has configure.ac, so I would
use gnu-build-system instead.

Zhu Zihao schreef op za 15-01-2022 om 13:47 [+0800]:
> +      (arguments
> +       (list
> +        #:configure-flags #~(list "-DLIBCPUID_TESTS=ON")
> +        #:phases
> +        #~(modify-phases %standard-phases
> +            (add-after 'unpack 'absolutize
> +              (lambda* (#:key inputs #:allow-other-keys)
> +                ;; Linux specific
> +                (when #$(target-linux?)
> +                  (substitute* "libcpuid/rdmsr.c"
> +                    (("modprobe") (which "modprobe")))))))))

This use of 'which' doesn't work when cross-compiling because it looks
in $PATH (which contains (possibly implicit) native-inputs) and not
'inputs' -- 'inputs' and 'native-inputs' are merged together when
compiling natively so this doesn't cause errors when compiling natively
but it doesn't work when cross-compiling -- try
"./pre-inst-env guix build libcpuid --target=aarch64-linux-gnu".

I would use 'search-input-file' instead:

        ;; using (when #$(target-linux? ...) ...) instead
        ;; of 'guard' would also work
        #~(modify-phases %standard-phases
            (add-after 'unpack 'absolutize
              (lambda* (#:key inputs #:allow-other-keys)
                ;; modprobe doesn't exist on the Hurd 
                (guard (c ((search-error? c) (values)))
                  (substitute* "libcpuid/rdmsr.c"
                    (("modprobe")
                     (search-input-file inputs "bin/modprobe")))))))))


> + confused with the @code{cpuid} command line utility from package
> + @code{cpuid}.")

A definite article is missing before 'package'.

> +      (native-inputs (list python-3))   ;required by tests

I would keep the original comment

      ;; a python from the 3. series is required by tests

here, because it is important that it comes from the 3. series
-- the shebang uses "/usr/bin/env python3", not "python3".  This
comment would be helpful when updating python to the 4. series
(these versions don't exist yet but presumably they eventually will),
as it would make it clear that we cannot simply replace 'python-3' with
'python-4'.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2022-01-15 10:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10 12:35 [bug#51747] [PATCH]: gnu: nix: Update to 2.4 Zhu Zihao
     [not found] ` <handler.51747.B.16365478179399.ack@debbugs.gnu.org>
2021-11-10 13:53   ` [bug#51747] Acknowledgement ([PATCH]: gnu: nix: Update to 2.4. ) Zhu Zihao
2021-11-10 15:47     ` Zhu Zihao
2021-11-17 11:21       ` Zhu Zihao
2021-12-04 15:28         ` Zhu Zihao
2022-01-11  8:23           ` [bug#51747] [PATCH]: gnu: nix: Update to 2.4 Oleg Pykhalov
2022-01-11  9:46             ` Zhu Zihao
2022-01-11 17:19             ` Zhu Zihao
2022-01-11 19:04               ` Maxime Devos
2022-01-12  4:21                 ` Zhu Zihao
2022-01-12  5:19                   ` Oleg Pykhalov
2022-01-12  7:08                     ` Zhu Zihao
2022-01-12  8:26                   ` Maxime Devos
2022-01-13  4:54                 ` Zhu Zihao
2022-01-13  7:54                   ` Zhu Zihao
2022-01-14 13:06                   ` Maxime Devos
2022-01-14 16:51                     ` Zhu Zihao
2022-01-14 18:39                       ` Maxime Devos
2022-01-15  1:58                         ` Zhu Zihao
2022-01-15  5:47                         ` Zhu Zihao
2022-01-15 10:52                           ` Maxime Devos [this message]
2022-01-15 16:06                             ` Zhu Zihao
2022-01-21 14:29                               ` bug#51747: " Oleg Pykhalov
2022-01-23 11:02                             ` [bug#51747] " Maxime Devos
2022-01-11 19:05               ` Maxime Devos
2022-01-14  9:31             ` Zhu Zihao
2022-01-14 12:56               ` Maxime Devos

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=0cb528695857acda121e58dee76b1095634ea7bb.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=51747@debbugs.gnu.org \
    --cc=all_but_last@163.com \
    --cc=go.wigust@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).