From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MALlHxYxHWIFoAAAgWs5BA (envelope-from ) for ; Mon, 28 Feb 2022 21:31:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id mAexGBYxHWKDeAAAG6o9tA (envelope-from ) for ; Mon, 28 Feb 2022 21:31:18 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0857317BC3 for ; Mon, 28 Feb 2022 21:31:18 +0100 (CET) Received: from localhost ([::1]:56576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOmfs-0006o6-Qe for larch@yhetil.org; Mon, 28 Feb 2022 15:31:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOmfe-0006ml-Uy for guix-patches@gnu.org; Mon, 28 Feb 2022 15:31:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:40959) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOmfe-00061e-Lu for guix-patches@gnu.org; Mon, 28 Feb 2022 15:31:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nOmfe-0004hj-E1 for guix-patches@gnu.org; Mon, 28 Feb 2022 15:31:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53257] [PATCH] gnu: foot: Wrap the program to expose TERMINFO_DIRS Resent-From: Kevin Boulain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 28 Feb 2022 20:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53257 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos Cc: 53257@debbugs.gnu.org Received: via spool by 53257-submit@debbugs.gnu.org id=B53257.164608022718035 (code B ref 53257); Mon, 28 Feb 2022 20:31:02 +0000 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: Content-Type: text/plain; charset="UTF-8" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1646080278; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=9+swH/ksGPLBgZx6eTa1sbvER3eHKRINCxUzkxyrbWI=; b=bSSjTVfntz5YyFuRAxx9ukGM8TJy+JDCX7rPugdqoE2tjxJxVY9g3Go/zjT3ArZ7RxBj/Q VhVmsi7sX5v+xrkPS/mL8ey3WnSlJH7L01Ckf4xCaYs0Q8Jr1l8Uzc3hjnmzmBeiX5cy3/ 8xUAK5vfHIa6wUR53OHFFm9GnFanp7fxZ6aEokMIJLo4sb/2PxT9w75PIqEPpvf1MEfPt7 r+/KbhkBHUEBob1zb+jlzK6iZCGp7QapHuWy1+VcESnl+8CXaniU04EpGV3eLlN90DI5vh lJjxcSRNy8td0si2LFAv9Xveood74DUY2S4iX+jY8VaJ/xyZoBy8Kb+QSES03Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1646080278; a=rsa-sha256; cv=none; b=CXSIkfP9r0c1TYKRdoM9Wkj4XKqo+E2rv1ZUC7NrtwEeDbhGB02pPoPEUzxaZwDu4bncsV znjcYIMDs72Rp58RDiyy4jDa/w5uAGzrH6mHz4nzJJBsfbQGxY0rnzc8/rlclxszpT9b2A ewvABqJVC5Gr1cQNPkOpa7NU/Pk9Ue9e6GNgYNu9mqaN4jRUD4ro5CZkt35C68EHQvEmvb vG78fvq5Y597JMT7AENlrB6l8PoTVkQ3iKM2+FBHqL30kGetKjxeKNSmyoi9+IAcC5ibXQ J+tmQQ9uxCtyceHLIKdiG/hqRPLqgahst4vpoQahfhdv9GMfkYyku5raTg+Scg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=V7uQA07q; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 5.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=V7uQA07q; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 0857317BC3 X-Spam-Score: 5.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: qUwRLk44jmRn 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.