Subject: Re: bug#53238: [PATCH] gnu: tree: Remove stddata feature.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 13 Jan 2022 17:26:19 -0500

Hi,

Olivier Dion <[email-masked]> writes:

> On Thu, 13 Jan 2022, Tobias Geerinckx-Rice <[email-masked]> wrote:
>> Olivier,
>>
>> Thanks again for tracking down this weird bug!
>>
>> Olivier Dion via Guix-patches via 写道：
>>> This feature breaks some UNIX utilities.  Fix it by disabling 
>>> the feature.
>>
>> Hm…  How long would we have to carry this fork?  My fear is we'd 
>> do so indefinitely.
>
> I've contacted the maintainer asking for removal of the feature in its
> next release.  I'm not sure if this will have some impact.  Feel free to
> do the same at <[email-masked]>, maybe adding more weight
> in the balance would help.
>
>> How about creating a (possibly hidden) tree-without-stddata 
>> package variant, to use as input to packages who currently break 
>> with this feature enabled?  That lets us refcount the need for it.
>
> It's more than just packages, it's also user scripts that can be broken
> and believe me when I say that this is not an easy bug to track down ;-).

I'm on the fence about this, it does indeed seem an undesirable change,
especially since there's a --json option, but I am not the author of the
'tree' software.

Attached is an alternative that adjusts password-store instead of
removing this new tree "feature"...

>From 2a30d95c46ff1eb0bdac9307c5d6bb8e460de02f Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <[email-masked]>
Date: Thu, 13 Jan 2022 15:09:54 -0500
Subject: [PATCH] gnu: password-store: Fix test failure following 'tree'
 update.

Thanks to Olivier Dion <[email-masked]> for diagnosing the source of
the problem!

* gnu/packages/password-utils.scm (password-store): Delete trailing #t.
[phases]{adjust-for-tree-2}: New phase.
---
 gnu/packages/password-utils.scm | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 0ff8608c9c..16d889344b 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -487,6 +487,21 @@ (define-public password-store
     (arguments
      '(#:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'adjust-for-tree-2
+           (lambda _
+             ;; XXX: tree 2.0.1 has this new "stddata pipe" that is
+             ;; automatically used to output in JSON if the file descriptor 3
+             ;; is available.  This conflicts with the test harness use of
+             ;; file descriptor 3, causing one of the tests to fail.
+             ;; Increment the file descriptors used by the harness by one to
+             ;; avoid the conflict.
+             (substitute* "tests/sharness.sh"
+               (("exec 4>&2 3>&1")
+                "exec 5>&2 4>&1")
+               (("exec 4>/dev/null 3>/dev/null")
+                "exec 5>/dev/null 4>/dev/null")
+               (("&4") "&5")
+               (("&3") "&4"))))
          (delete 'configure)
          (delete 'build)
          (add-before 'install 'patch-system-extension-dir
@@ -500,8 +515,7 @@ (define-public password-store
                   (string-append " SYSTEM_EXTENSION_DIR=\""
                                  "${PASSWORD_STORE_SYSTEM_EXTENSION_DIR:-"
                                  extension-dir
-                                 "}\"\n"))))
-             #t))
+                                 "}\"\n"))))))
          (add-before 'install 'patch-passmenu-path
            ;; FIXME Wayland support requires ydotool and dmenu-wl packages
            ;; We are ignoring part of the script that gets executed if
@@ -530,8 +544,7 @@ (define-public password-store
                               '("coreutils" "getopt" "git" "gnupg" "qrencode"
                                 "sed" "tree" "which" "wl-clipboard" "xclip"))))
                (wrap-program (string-append out "/bin/pass")
-                 `("PATH" ":" prefix (,(string-join path ":"))))
-               #t))))
+                 `("PATH" ":" prefix (,(string-join path ":"))))))))
        #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output)
                           "WITH_ALLCOMP=yes"
                           (string-append "BASHCOMPDIR="
-- 
2.34.0

Thanks,

Maxim