unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 40525@debbugs.gnu.org
Subject: bug#40525: inferior process on core-updates crashes: mmap(PROT_NONE) failed
Date: Fri, 10 Apr 2020 12:55:11 +0100	[thread overview]
Message-ID: <87y2r37dy8.fsf@cbaines.net> (raw)
In-Reply-To: <87a73jy8y9.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 686 bytes --]


Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Christopher Baines <mail@cbaines.net> skribis:
>
>> At some point, usually when extracting the information about lint
>> warnings, package derivations or system tests, the inferior guix repl
>> crashes.
>
> Could you come up with a simpler reproducer?  What do we need to send to
> the inferior to reach that crash?

I've attached a script that when run should reproduce the issue. I
extracted the code relating to lint warnings from the Guix Data
Service. The script attached runs this code twice against the inferior,
once will often be enough to cause it to crash, but twice should
reproduce it more reliably.


[-- Attachment #1.2: inferior-script --]
[-- Type: text/plain, Size: 5025 bytes --]

(use-modules (ice-9 match)
             (guix inferior)
             (guix channels)
             (guix store))

(define (all-inferior-lint-warnings inf store)
  (define locales
    '("cs_CZ.utf8"
      "da_DK.utf8"
      "de_DE.utf8"
      "eo_EO.utf8"
      "es_ES.utf8"
      "fr_FR.utf8"
      "hu_HU.utf8"
      "pl_PL.utf8"
      "pt_BR.utf8"
      ;;"sr_SR.utf8"
      "sv_SE.utf8"
      "vi_VN.utf8"
      "zh_CN.utf8"))

  (define (lint-warnings-for-checker checker-name)
    `(lambda (store)
       (let* ((checker (find (lambda (checker)
                               (eq? (lint-checker-name checker)
                                    ',checker-name))
                             %local-checkers))
              (check (lint-checker-check checker)))

         (define lint-checker-requires-store?-defined?
           (defined? 'lint-checker-requires-store?
             (resolve-module '(guix lint))))

         (define (process-lint-warning lint-warning)
           (list
            (match (lint-warning-location lint-warning)
              (($ <location> file line column)
               (list (if (string-prefix? "/gnu/store/" file)
                         ;; Convert a string like
                         ;; /gnu/store/53xh0mpigin2rffg31s52x5dc08y0qmr-guix-module-union/share/guile/site/2.2/gnu/packages/xdisorg.scm
                         ;;
                         ;; This happens when the checker uses
                         ;; package-field-location.
                         (string-join (drop (string-split file #\/) 8) "/")
                         file)
                     line
                     column)))
            (let* ((source-locale "en_US.utf8")
                   (source-message
                    (begin
                      (setlocale LC_MESSAGES source-locale)
                      (lint-warning-message lint-warning)))
                   (messages-by-locale
                    (filter-map
                     (lambda (locale)
                       (catch 'system-error
                         (lambda ()
                           (setlocale LC_MESSAGES locale))
                         (lambda (key . args)
                           (error
                            (simple-format
                             #f
                             "error changing locale to ~A: ~A ~A"
                             locale key args))))
                       (let ((message
                              (lint-warning-message lint-warning)))
                         (setlocale LC_MESSAGES source-locale)
                         (if (string=? message source-message)
                             #f
                             (cons locale message))))
                     (list ,@locales))))
              (cons (cons source-locale source-message)
                    messages-by-locale))))

         (filter
          (match-lambda
            ((package-id . warnings)
             (not (null? warnings)))
            (a
             (error (simple-format #f "NO MATCH FOR ~A\n" a))))
          (hash-map->list
           (lambda (package-id package)
             (cons
              package-id
              (catch
                #t
                (lambda ()
                  (map process-lint-warning
                       (if (and lint-checker-requires-store?-defined?
                                (lint-checker-requires-store? checker))

                           (check package #:store store)
                           (check package))))
                (lambda (key . args)
                  '()))))
           %package-table)))))

  (inferior-eval '(use-modules (srfi srfi-1)
                               (guix lint)) inf)
  (inferior-packages inf)
  (let ((checkers
         (inferior-eval
          '(begin
             (map (lambda (checker)
                    (list (lint-checker-name checker)
                          (lint-checker-description checker)
                          (if (memq checker %network-dependent-checkers)
                              #t
                              #f)))
                  %all-checkers))
          inf)))
    (map
     (match-lambda
       ((name description network-dependent?)
        (cons
         (list name description network-dependent?)
         (if network-dependent?
             '()
             (inferior-eval-with-store inf store (lint-warnings-for-checker
                                                  name))))))
     checkers)))

(let* ((channel
        (channel
         (name 'guix)
         (commit "d523eb5c9c2659cbbaf4eeef3691234ae527ee6a")
         (url "https://git.savannah.gnu.org/git/guix.git")))
       (inferior
        (inferior-for-channels (list channel)))
       (result
        (with-store store
          (all-inferior-lint-warnings inferior store)
          ;; Running all-inferior-lint-warnings once doesn't seem to always
          ;; produce the crash, so just run it again
          (all-inferior-lint-warnings inferior store))))
  (peek "RESULT" result))

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

  reply	other threads:[~2020-04-10 11:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 19:45 bug#40525: inferior process on core-updates crashes: mmap(PROT_NONE) failed Christopher Baines
2020-04-10  9:41 ` Ludovic Courtès
2020-04-10 11:55   ` Christopher Baines [this message]
2020-04-11 14:03     ` Ludovic Courtès
2020-04-16 17:29       ` Christopher Baines
2020-04-16 19:24         ` Christopher Baines
2020-04-17  9:02           ` Ludovic Courtès
2020-04-17 17:34             ` Christopher Baines
2020-04-18 16:53               ` Christopher Baines
2021-05-08  9:56             ` Ludovic Courtès
2021-05-08 19:58               ` Christopher Baines

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=87y2r37dy8.fsf@cbaines.net \
    --to=mail@cbaines.net \
    --cc=40525@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 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).