From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id aBwMBnDrWmUCbAEAauVa8A:P1 (envelope-from ) for ; Mon, 20 Nov 2023 06:15:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aBwMBnDrWmUCbAEAauVa8A (envelope-from ) for ; Mon, 20 Nov 2023 06:15:28 +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 091EF2197D for ; Mon, 20 Nov 2023 06:15:27 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=VfLejiZY; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1700457328; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: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=KbyOnbV4gKdLUJuaigNX5fSm0y+fcKHk9d7V1sHMsMY=; b=eXYufx04MzN0SKiWUmYDpu2Fr3GB8Pq/Nk/lTlTYD9U2kunGLsvagVUjWSZGeQzoCdylsm b9OcAM4loVqqw30Q4KSy2LMAn4uKhLYsmGbaKqir7l1wBbKvVvfFurQwK0iFiwgpNyXi4L J7oQYvhGZH4dJ8Z2V2uzlTqzjSs7xTylxxDVW/dgZCld74hawEPsYnuR6avrRqGEcYiAey Ye6rftOsgVspZat0hURCZD7XUDshqYo66GvIRdOgKPuJZS7TvwKgTm1/6zOCHEXTW/b6E2 5nSylxYEwdtp9kLZWXMf3rgt/dfuIQ8/OxzxdVyadxV5unp5bcUActeBlo1bVg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=VfLejiZY; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1700457328; a=rsa-sha256; cv=none; b=AyvFTmkZulgIzgvlXYagfs1OACZ4HIPKoh+etOYnf0hWltNwtC1RFfAXNHBNwIB7gC2BZg TAiJ5hC4eykuy0PVz3ndmTKdhdi2jX5x0v6XW+P0VkchvRcb1q5hiYyTf5Ne0ygDrrawDX TJPYnfZn/ludO/FV7l8wWNytq84uXXcAaTKLug0m/gkDwY03LgmNhPqsg4AOxUXDY4VckL pyPwsC1+b/odOpR6hG9/CxEozpJftS8p3dtQhlsBWRrfsp0LWbwAzObXGa440ZtuiLbADK YjUEWJuApWVz22Ea8z730NeviRUkUG2poTTgU4TRJHki3cpSeaGhkjuqQNvUYA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4wch-0006S5-1j; Mon, 20 Nov 2023 00:15:03 -0500 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 1r4wcf-0006QN-IN for bug-guix@gnu.org; Mon, 20 Nov 2023 00:15:01 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4wcf-0000kZ-7y for bug-guix@gnu.org; Mon, 20 Nov 2023 00:15:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r4wcg-000300-HW for bug-guix@gnu.org; Mon, 20 Nov 2023 00:15:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#64858: [PATCH] In 'guix shell', discard ad-hoc profile when 'guix.scm' file is newer. (Closes: #64858) References: In-Reply-To: Resent-From: Felix Lechner Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 20 Nov 2023 05:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64858 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 64858@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Felix Lechner , Pierre-Henry =?UTF-8?Q?Fr=C3=B6hring?= Received: via spool by 64858-submit@debbugs.gnu.org id=B64858.170045727911472 (code B ref 64858); Mon, 20 Nov 2023 05:15:02 +0000 Received: (at 64858) by debbugs.gnu.org; 20 Nov 2023 05:14:39 +0000 Received: from localhost ([127.0.0.1]:52357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4wcJ-0002yy-6U for submit@debbugs.gnu.org; Mon, 20 Nov 2023 00:14:39 -0500 Received: from sail-ipv4.us-core.com ([208.82.101.137]:43956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4wcB-0002yj-Hz for 64858@debbugs.gnu.org; Mon, 20 Nov 2023 00:14:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=7ccNz/0dx7oIO1K 5b2DKx1jQU13pq2hozqY8NmWdii0=; h=date:subject:cc:to:from; d=lease-up.com; b=VfLejiZYLykKye1Pn8SnLxTY7ARBB3ylDUElrqjcoeiQx4yogQ2+ zfgYnSQ2908wIH2tY+J5tYC9JXhFwskUOFMW7xWcQMhkUIDViFZwBchx2ifqCGNLb/ejVt 568JkUz6b/kp3yFKWwSGhk6wKmziPahrHJualdadpz2v5XCb4= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id a4acb623 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Mon, 20 Nov 2023 05:14:28 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id be66c0d9; Mon, 20 Nov 2023 05:14:27 +0000 (UTC) Date: Sun, 19 Nov 2023 21:12:36 -0800 Message-ID: <9b178dff2dec09ca8af96fae54d5519c6d1cf1a4.1700457155.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Felix Lechner From: Felix Lechner via Bug reports for GNU Guix Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -6.61 X-Spam-Score: -6.61 X-Migadu-Queue-Id: 091EF2197D X-Migadu-Scanner: mx10.migadu.com X-TUID: Pylo9i5yGqgx Fixes a bug that prevents rebuilds for folks who use 'guix shell' repeatedly to refine a package declaration located in a 'guix.scm' file. The mtime of 'guix.scm' is never evaluated because 'file' is #f here and the code path taken always returns 0 as the purported mtime. https://github.com/guix-mirror/guix/blob/71b92466430acb8c91841522dc0eb7d766af4388/guix/scripts/shell.scm#L390 In the consuming code, the 'timestamp' is always less than the mtime of the profile in the multi-line AND-ed conditional here: https://github.com/guix-mirror/guix/blob/71b92466430acb8c91841522dc0eb7d766af4388/guix/scripts/shell.scm#L250 As a result, outdated ad-hoc profiles are always reused unless they are expressly deleted via: rm ~/.cache/guix/profiles/* The bug was potentially introduced in commit c42b7baf when 'package was transformed to 'ad-hoc-package without also changing the line in this commit. A minimal reproducer can be found here: https://codeberg.org/lechner/shell-bug --- Hi Ludo' > ‘guix shell’ caches based on the mtime of ‘guix.scm’ That's how is should work, but it doesn't as explained above. Here is a patch. Please adjust the commit message to your liking. Thanks! Kind regards Felix guix/scripts/shell.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm index 10ea110fee..d29367c8ee 100644 --- a/guix/scripts/shell.scm +++ b/guix/scripts/shell.scm @@ -398,7 +398,7 @@ (define (key->file key) (values #f #f))) ((('nesting? . #t) . rest) (loop rest system file (append specs '("nested guix")))) - ((('load . ('package candidate)) . rest) + ((('load . ('ad-hoc-package candidate)) . rest) (if (and (not file) (null? specs)) (loop rest system candidate specs) (values #f #f))) base-commit: 71b92466430acb8c91841522dc0eb7d766af4388 -- 2.41.0