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 ms5.migadu.com with LMTPS id gP/VJ6z+WWOGRwEAbAwnHQ (envelope-from ) for ; Thu, 27 Oct 2022 05:44:44 +0200 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 5Mf5Jqz+WWPkNgAAG6o9tA (envelope-from ) for ; Thu, 27 Oct 2022 05:44:44 +0200 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 5221A2A1E for ; Thu, 27 Oct 2022 05:44:44 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ontnM-0001Ih-I3; Wed, 26 Oct 2022 23:43:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ontnL-0001Gj-2n for guix-patches@gnu.org; Wed, 26 Oct 2022 23:43:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ontnK-0007sS-Qj for guix-patches@gnu.org; Wed, 26 Oct 2022 23:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ontnK-0001sQ-49 for guix-patches@gnu.org; Wed, 26 Oct 2022 23:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58812] [PATCH 0/5] Add --symlink option to 'guix shell'. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 Oct 2022 03:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58812 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58812@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16668421537175 (code B ref -1); Thu, 27 Oct 2022 03:43:01 +0000 Received: (at submit) by debbugs.gnu.org; 27 Oct 2022 03:42:33 +0000 Received: from localhost ([127.0.0.1]:55688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ontmc-0001rQ-Fj for submit@debbugs.gnu.org; Wed, 26 Oct 2022 23:42:33 -0400 Received: from lists.gnu.org ([209.51.188.17]:41788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ontmP-0001r7-CX for submit@debbugs.gnu.org; Wed, 26 Oct 2022 23:42:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ontmP-00036k-4U for guix-patches@gnu.org; Wed, 26 Oct 2022 23:42:05 -0400 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ontmJ-0007bM-TG for guix-patches@gnu.org; Wed, 26 Oct 2022 23:42:04 -0400 Received: by mail-qv1-xf2a.google.com with SMTP id n18so202112qvt.11 for ; Wed, 26 Oct 2022 20:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=D8mWfN0XzLz08gJwAzSvf2zqwuBOISMFIGApHbN2lVE=; b=HPvvQF64m+WzMvEDQAP7QxQh3EqjkLkCDTPWzUt+Hru2JS1tn7659mUIgwsavFl7Xw o5hO7AkFJ7Sw++GM8QAhMXO4AXuANVIb/SMZlN7HK8ce+5zB6lqKsibeaBKNBu8yffp4 YnzjpJV7De0wum5dl6zF+zWbHFgtvs2vMjeNUBJs55r7tV7N3n/d3EwA3fBOJ8crhBCl zQb9IO6jhOgsfCSZDTEtkomJdJGNxjiYn08rONuuiu9UkUhUfkfYTFE3rLO+n+3upfjW VvtRgqVIyo6i0CB0faaysixDe3XiV1tt1jk3OYiU8JWKeSab2EI6ST9N4xpZRfiTv3CJ Nz/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D8mWfN0XzLz08gJwAzSvf2zqwuBOISMFIGApHbN2lVE=; b=CJnMim9Dh5c/NhEiZkVJnq+U/x7lyswNPVUzqR8Wy3zMY7iLGk0sH+2nppzGG2Z6wV zUgECfCPYfWlNNbxajzX+09Oj3qR/u+hl0aeR97O34NbWbRYRnBgnrtdHeMzUcnDUrvw 2rtiQ5CArNCZS7BUUEXaXj+a2/dR1K/jp6cBVMVSSSTWmGK2N4b9Turrwm7+9gWiu/ik bWY5URu8nJde7hXTFSixayg3wxPNijuVrzisWA1Kj5Q28FSZfGaFuQn99v4/Ep+C8kMf a9ZRAB1RKIKVLOJ5rKQV8tZiN06FaGSkCFjg2TfFhWikO8+pGIjWDZBizmtBhwYtUlb0 /r2Q== X-Gm-Message-State: ACrzQf0RPUdN1SGavya/pTrxjbfS7fk7haqtjEApDyDP+H9747fP8L7v xqN5+tmw7yCo8eQQeip0wDJkDQZi/W8= X-Google-Smtp-Source: AMsMyM5mDozLWdPM7BmUrhzoXKbJqvf2FgGBI/2M0YkXY92mHnQMMsymjB4LxECzUo8CaiOK7hMfKQ== X-Received: by 2002:a05:6214:c6d:b0:4b1:c751:ac7 with SMTP id t13-20020a0562140c6d00b004b1c7510ac7mr40879503qvj.96.1666842116805; Wed, 26 Oct 2022 20:41:56 -0700 (PDT) Received: from localhost.localdomain (dsl-152-21.b2b2c.ca. [66.158.152.21]) by smtp.gmail.com with ESMTPSA id f11-20020a05620a280b00b006eee3a09ff3sm265260qkp.69.2022.10.26.20.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Oct 2022 20:41:56 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 26 Oct 2022 23:41:54 -0400 Message-Id: <20221027034154.28435-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::f2a; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qv1-xf2a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Sender: "Guix-patches" Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org 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=1666842284; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=D8mWfN0XzLz08gJwAzSvf2zqwuBOISMFIGApHbN2lVE=; b=AVE9F30pxtF+JtJqDbdqDgY6mUSQ1X/DDto5sXLfrUKPOb7/NDWB6DMJivDwQT+Ilj+dyD ZKjfz3+mkEcZiCksgz6i6M1G5Oq28yNfQdsStnhL9MQKlnjIttqvxCOl0pg4uwAHMB1/ja cnaELjuqoXkNR/oFpDL7awxBL6qt+lZR9237MHbpSPZlyuHevAGQc3bq/V+jrrmBi+MuAK dn8zsNqomgNgLiw/VjbAovxysmTgmKVOzqcmomZwxrAOYN9p39lSV2zmR9H/zc1WA7XSEu /f682w7XZY91MjO4n8scWXGsAO6WsKe49eBzg6TJGBfbwenMxh7U32Qtn9FmJA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666842284; a=rsa-sha256; cv=none; b=GtKNF+7SZeJ4zA8oLjvqT7EDWElEPuQ6x7H8p2UF6uMWMEV2P15FyWYy0GJHvIDy1Jl95P 0jA/nDQgR85+HJXcCKDzjrDG+1hlCaMkLbQDfs4kija0qaxD/wCMCE15cMHcpo+/hpNoln UXyTG2B/fQcdRK9HiVrY4LjdNvSXxd5v49Lv4yMGPikd/9fCiETUnJ8ItuWKzpVyEuBwz9 sSJY4LheP4vdfeFLzZh09/XRngz+OAABk1B/nv0XXV0GrS2rHgZ9JUj4MTi9bV15pgKiIJ +NzxB/2Wr5nwowRgINsLdgGBBOddvt2ew260CQ4OvtfqHijoPWWaM36KtaZOlQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=HPvvQF64; 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: 7.08 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=HPvvQF64; 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: 5221A2A1E X-Spam-Score: 7.08 X-Migadu-Scanner: scn0.migadu.com X-TUID: XSq6GWZ3n3K6 Hi, I've wanted this enough times now to finally get around implementing it :-). My main use case for it will be creating a /usr/bin/env symlink in 'guix shell' environments for portability with the #!/usr/bin/env shebang. While at it, I've improved error reporting and made it fail early when a symlink would point to a nonexistent file (dangling symlink). The test suite passes, and I've run the basic system test as well as the 'btrfs-root-os' one successfully. Thanks, Maxim Cournoyer (5): Makefile.am: Sort EXTRA_DIST entries. tests: Add a tests/utils.sh support file. install: Validate symlink target in evaluate-populate-directive. guix: shell: Add '--symlink' option. shell: Detect --symlink spec problems early. Makefile.am | 55 ++++--- doc/guix.texi | 9 +- gnu/build/install.scm | 78 ++++++--- guix/scripts/environment.scm | 298 +++++++++++++++++++---------------- guix/scripts/pack.scm | 208 ++++++++++++------------ guix/scripts/shell.scm | 77 ++++----- tests/guix-pack.sh | 2 +- tests/guix-shell.sh | 21 +++ tests/shell-utils.scm | 29 ++++ tests/utils.sh | 33 ++++ 10 files changed, 483 insertions(+), 327 deletions(-) create mode 100644 tests/shell-utils.scm create mode 100644 tests/utils.sh -- 2.37.3