From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 28 15:30:27 2022 Received: (at 53257) by debbugs.gnu.org; 28 Feb 2022 20:30:27 +0000 Received: from localhost ([127.0.0.1]:34856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOmf4-0004go-QX for submit@debbugs.gnu.org; Mon, 28 Feb 2022 15:30:27 -0500 Received: from mail-lf1-f43.google.com ([209.85.167.43]:43872) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOmf3-0004gW-5m for 53257@debbugs.gnu.org; Mon, 28 Feb 2022 15:30:26 -0500 Received: by mail-lf1-f43.google.com with SMTP id g39so23329245lfv.10 for <53257@debbugs.gnu.org>; Mon, 28 Feb 2022 12:30:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9+swH/ksGPLBgZx6eTa1sbvER3eHKRINCxUzkxyrbWI=; b=V7uQA07qQ47cwuIGsu4BFyEpy8Cc5IzUEeogntcprWjlfzXo+mIk2cuA479v21q9R6 xm+lOhva3MUdc3Ocv8B/gxX5Uuz/skvYfMYaklJ5JV5P4knwtK8DwcWt/zKb7UhduOxT RxR3uaRhwh0clQ0HAIG+Y/bCa49Fpkiu1U3M+/ZHlvUEoGidIlMRuJ+lUuew4wn9zVyn E31AXtD8DKfWe1GvBVn8gXz+uS3k6g4O3/4ykvYmJv+0NiFEFIagOdZn5b23p3fvYmsA yuSOv1F+zyVareohHJQ+w3sTnKlAtVyHe8rpBOlNL4+JhHpaBmSfKA6rqSC88yIlogBx XzJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9+swH/ksGPLBgZx6eTa1sbvER3eHKRINCxUzkxyrbWI=; b=g535Q6rl3VaSc4hA/1jjoUSs8Tz96VorW8L/NjSiJF1jOohgAQkX2Z02vYmQJVd4Y4 qopIfoKzT6Zhzq+W3VP/agvqF38PGnw7O/xRCV+DsA7pdSGQwaMTSn0T7bI64HUXthw+ 89IN240hBu6UttZowDmSo5E1Ila6dWzfjEy49hVb4rzyCyvCGO1kjBIMjo8noqgleD1m JyBMoCfB5yguowvQdFtiO4bmXAEDBzreAYFg6axtZgMPa/oSVyUziRcIhJz3D9/WZQUZ Wd5C32PiDrseyz+DPO9PZ1prxrMUVBVGBlrpH66ctTAVCuQ0OemyJJzb5xvNmQf4aAhN CfZw== X-Gm-Message-State: AOAM531pO23JTuFJQYXIYZWoK9ynKfZdTn4IdiRPDkN5biWvCs1UTA+/ 87So9EwYGTwCDWnL7TEzOxOD6WSopPZPOMWRrno= X-Google-Smtp-Source: ABdhPJzktc+Rw9zb6OZY4rYMHdj6QNyiHByFjkM//P6MyIzIpQTIFzL1JKel3jEMTzhGrxN+Y0tcPaIr282S7oMWoi8= X-Received: by 2002:ac2:4895:0:b0:443:ddce:e795 with SMTP id x21-20020ac24895000000b00443ddcee795mr13338412lfc.572.1646080218952; Mon, 28 Feb 2022 12:30:18 -0800 (PST) MIME-Version: 1.0 References: <811cc55626870dbf37af3418e8effe191948541a.1642168254.git.florhizome@posteo.net> <20220227183415.12487-1-kevinboulain@gmail.com> <8372c3d084580f785710cdc8c0ebdcb92f45ee51.camel@telenet.be> In-Reply-To: <8372c3d084580f785710cdc8c0ebdcb92f45ee51.camel@telenet.be> From: Kevin Boulain Date: Mon, 28 Feb 2022 21:29:42 +0100 Message-ID: Subject: Re: [bug#53257] [PATCH] gnu: foot: Wrap the program to expose TERMINFO_DIRS To: Maxime Devos Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 53257 Cc: 53257@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Thank you, I'll send a follow-up patch to resolve the concerns (that's greatly appreciated, I'm new at both Guix and Scheme). I did test it with an ncurses program so I can confirm it works (no complaints about an unknown terminal anymore). I only have a single concern about this approach: native-search-paths made the terminfo database somewhat 'global' (as long the shell sourced the Guix profile) and it made stuff like SSH less awkward: by installing foot on both the client and the server, ncurses applications could 'just work'. Now, by making the terminfo database only visible inside the terminal itself, SSH is pretty much never guaranteed to work seamlessly (however, foot appears to be compatible with xterm so it's not that much of an issue: https://codeberg.org/dnkl/foot/src/branch/master/INSTALL.md#terminfo). I agree this has always been a pain point with ncurses programs and the proper solution would be to upstream the terminal's description to terminfo so it's easily available everywhere (or people can always install it manually), but I prefer following the recommendations of the maintainers here :) On Sun, 27 Feb 2022 at 20:22, Maxime Devos wrote: > > Kevin Boulain schreef op zo 27-02-2022 om 19:34 [+0100]: > > + (modify-phases %standard-phases > > + (add-after 'install 'wrap-program > > + (lambda* (#:key inputs outputs #:allow-other-keys) > > + (let* ((out (assoc-ref outputs "out"))) > > + ;; footclient executes programs under the server process, > > + ;; there is no need to wrap it too. > > + (wrap-program (string-append out "/bin/foot") > > + `("TERMINFO_DIRS" ":" prefix > > + (,(string-append out "/share/terminfo")))))))))) > > > You'll need to add 'bash-minimal' to 'inputs', such that this works > even when cross-compiling. I think "./pre-inst-env guix lint foot" > would warn about this. > > Also, this can be simplified a bit, to > > ,#(modify-phases %standard-phases > (add-after 'install 'wrap-program > (lambda _ > (let ((out #$output)) > ;; footclient executes programs under the server process, > ;; there is no need to wrap it too. > (wrap-program (string-append out "/bin/foot") > `("TERMINFO_DIRS" ":" prefix > (,(string-append out "/share/terminfo")))))))))) > > or, reducing the whitespace: > > > ,#(modify-phases %standard-phases > (add-after 'install 'wrap-program > (lambda _ > (define out #$output) > ;; footclient executes programs under the server process, > ;; there is no need to wrap it too. > (wrap-program (string-append out "/bin/foot") > `("TERMINFO_DIRS" ":" prefix > (,(string-append out "/share/terminfo"))))))))) > > (you'll need to add (guix gexp) to the list of imports to do this) > > YMMV on whether this is an improvement. > > I hope you don't mind, I went ahead and used wrap-program as > discussed (I was encountering this issue and had a very similar patch > as the OP's). Did I get the idea that was discussed in this thread > right? > > Yes, this was the idea, though to be 100% sure it would need to be tested (by running "guix shell --pure foot -- foot" and then running > ~/.guix-profile/bin/SOME-NCURSES-APP in the terminal, or something like that. > > If yes, should I send another patch to fix the other terminals > (e.g.: > > https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/terminals.scm?id=85a5110de79f4fe9fd822ede3915654ee699d6c5#n220 > )? > > That would be nice, but keep in mind that this might not be needed > for every terminal app -- some apps set TERMINFODIR automatically (I forgot which) and hence don't need any wrapping. > > Greetings, > Maxime.