Subject: [bug#53279] [PATCH] gnu: Add emacs-dtache

From: Nicolas Goaziou <[email-masked]>
Date: Sun, 16 Jan 2022 23:56:14 +0100

Hello,

Niklas Eklund <[email-masked]> writes:

> Ah good to know, I have updated that part now.

Thanks for the update. I merged the consecutive phases with
emacs-substitute-variables for clarity, and enabled tests with "#:tests?
#true". I'm sending the package definition in its current state:

--8<---------------cut here---------------start------------->8---
(define-public emacs-dtache
  (package
    (name "emacs-dtache")
    (version "0.3")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://gitlab.com/niklaseklund/dtache")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0f2yxrqfkslif2y88x9vlpshadifppxw6yl1rrf1qzfjy6cv144n"))))
    (arguments
     (list
      #:tests? #true
      #:test-command #~(list "ert-runner")
      #:phases
      #~(modify-phases %standard-phases
          (add-before 'install 'install-dtache-env
            (lambda _
              (install-file "dtache-env" (string-append #$output "/bin"))))
          (add-after 'unpack 'locate-dtach
            (lambda* (#:key inputs #:allow-other-keys)
              (make-file-writable "dtache.el")
              (emacs-substitute-variables "dtache.el"
                ("dtache-env"
                 (string-append #$output "/bin/dtache-env"))
                ("dtache-dtach-program"
                 (search-input-file inputs "/bin/dtach"))
                ("dtache-shell-program"
                 (search-input-file inputs "/bin/bash"))))))))
    (build-system emacs-build-system)
    (native-inputs (list emacs-ert-runner))
    (inputs (list dtach))
    (home-page "https://gitlab.com/niklaseklund/dtache")
    (synopsis "Run and interact with detached shell commands")
    (description
     "The dtache package allows users to run shell commands
detached from Emacs.  These commands are launched in sessions, using the
program dtach.")
(license license:gpl3+)))
--8<---------------cut here---------------end--------------->8---

Unfortunately, one test is failing with the following output:

--8<---------------cut here---------------start------------->8---
.......Test dtache-test-dtach-command backtrace:

Test dtache-test-dtach-command condition:

    (ert-test-failed
     ((should
       (equal expected-concat
	      (dtache-dtach-command session t)))
      :form
      (equal "dtach -c /tmp/guix-build-emacs-dtache-0.3.drv-0/dtache7Dw27E/sessions/7695240f5262181009a25db676161039.socket -z bash -c \\{\\ dtache-env\\ ls\\\\\\ -la\\;\\ \\}\\ 2\\>\\&1\\ \\|\\ tee\\ /tmp/guix-build-emacs-dtache-0.3.drv-0/dtache7Dw27E/sessions/7695240f5262181009a25db676161039.log" "/gnu/store/prhk20g1yp8qbn4rj5h25cdpimxynq3d-dtach-0.9/bin/dtach -c /tmp/guix-build-emacs-dtache-0.3.drv-0/dtache7Dw27E/sessions/7695240f5262181009a25db676161039.socket -z bash -c \\{\\ dtache-env\\ ls\\\\\\ -la\\;\\ \\}\\ 2\\>\\&1\\ \\|\\ tee\\ /tmp/guix-build-emacs-dtache-0.3.drv-0/dtache7Dw27E/sessions/7695240f5262181009a25db676161039.log")
      :value nil :explanation
      (arrays-of-different-length 268 326 "dtach -c /tmp/guix-build-emacs-dtache-0.3.drv-0/dtache7Dw27E/sessions/7695240f5262181009a25db676161039.socket -z bash -c \\{\\ dtache-env\\ ls\\\\\\ -la\\;\\ \\}\\ 2\\>\\&1\\ \\|\\ tee\\ /tmp/guix-build-emacs-dtache-0.3.drv-0/dtache7Dw27E/sessions/7695240f5262181009a25db676161039.log" "/gnu/store/prhk20g1yp8qbn4rj5h25cdpimxynq3d-dtach-0.9/bin/dtach -c /tmp/guix-build-emacs-dtache-0.3.drv-0/dtache7Dw27E/sessions/7695240f5262181009a25db676161039.socket -z bash -c \\{\\ dtache-env\\ ls\\\\\\ -la\\;\\ \\}\\ 2\\>\\&1\\ \\|\\ tee\\ /tmp/guix-build-emacs-dtache-0.3.drv-0/dtache7Dw27E/sessions/7695240f5262181009a25db676161039.log" first-mismatch-at 0)))

F................
--8<---------------cut here---------------end--------------->8---

Do you think this can be fixed? Or shall we skip that test?

Regards,
-- 
Nicolas Goaziou