From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id UC88CP7fJGa4eAAA62LTzQ:P1 (envelope-from ) for ; Sun, 21 Apr 2024 11:44:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id UC88CP7fJGa4eAAA62LTzQ (envelope-from ) for ; Sun, 21 Apr 2024 11:44:30 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713692670; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=vgVRACENuPkxc+kU2I2NZisJA/O0Yf+/H77jt1aTMkI=; b=KO6euvI35J880vB8/eNP3wqQPrZSFTNAP70LS9moMKcn9gqFeJWBcccZ1UNVORR4x2emKS qBWLqctUKOq6GsbDPaLIOJgDRHF0eWeaIpPgtMAOto+fOAreYeXOnzdOzINjMHKvFWxtO7 mJql3+oUAMw123oCjQGp2coXpCUkbyktIsWH0ZoafCIHzIEFk59b/gMb/rgsp0310hFWdX isFERIjy6INP6LKFS8iLObfS8blgj6WQjF8+LNO978gOCWXw+gnJ8cVD5CcYVVzI7fFjFA ZX+08xuCLuDkcfTo27wkyNTcpJ5XxV2MP+6e5lCf68MYcu6iE0q0p0C6yjB4WQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713692670; a=rsa-sha256; cv=none; b=WIqQ9BeL+nhgQO+S0rj2jQxOWX4SNjC3QqrP2FpVUfwuN72KlKYPnig7FV3HxihgtXQXWM +bJOqL60Mjj/DhD+HVK59c2+er3doifJ45sBfhNseRMUb4TCoqExMA5BQ2EsDjFOfwNMr2 klJZJvEghUCPa0MCGHnXWf+f+LiewQFP6buRBnqohgwPyPqxr+TVvFd8UoVa72vwCWMP97 5c55vr3GMTyjUlKmYSUaF+90JyBOp7SAdMmRUOhx9JzJ7uYqLRS0fmFcBZlq53d0WHl1A1 X611uKgfheBXbQz9mcT1bUFInRbspHxU2JjoMBtpzjV4ndFmZ8vjdWdUjT9c4A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=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"; dmarc=none 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 0E7C2534B4 for ; Sun, 21 Apr 2024 11:44:30 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ryTjz-0005Z1-HM; Sun, 21 Apr 2024 05:44:07 -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 1ryTjl-0005Qg-8P for guix-patches@gnu.org; Sun, 21 Apr 2024 05:43:54 -0400 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 1ryTjk-0002ms-WB; Sun, 21 Apr 2024 05:43:53 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ryTjw-0006Td-9w; Sun, 21 Apr 2024 05:44:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70494] [PATCH 09/23] store: Add validate-store-name. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sun, 21 Apr 2024 09:44:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70494 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70494@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 70494-submit@debbugs.gnu.org id=B70494.171369260324429 (code B ref 70494); Sun, 21 Apr 2024 09:44:04 +0000 Received: (at 70494) by debbugs.gnu.org; 21 Apr 2024 09:43:23 +0000 Received: from localhost ([127.0.0.1]:41760 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryTjG-0006Lr-4H for submit@debbugs.gnu.org; Sun, 21 Apr 2024 05:43:22 -0400 Received: from mira.cbaines.net ([2a01:7e00:e000:2f8:fd4d:b5c7:13fb:3d27]:39677) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ryTix-0006Hx-Jm for 70494@debbugs.gnu.org; Sun, 21 Apr 2024 05:43:04 -0400 Received: from localhost (unknown [212.132.255.10]) by mira.cbaines.net (Postfix) with ESMTPSA id 76D2827BBF1 for <70494@debbugs.gnu.org>; Sun, 21 Apr 2024 10:42:47 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 0bf7e054 for <70494@debbugs.gnu.org>; Sun, 21 Apr 2024 09:42:47 +0000 (UTC) From: Christopher Baines Date: Sun, 21 Apr 2024 10:42:27 +0100 Message-ID: <803b6bbff7d1cad61eff5b9f8c18007af53de436.1713692561.git.mail@cbaines.net> X-Mailer: git-send-email 2.41.0 In-Reply-To: <87bk632h36.fsf@cbaines.net> References: <87bk632h36.fsf@cbaines.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.38 X-Spam-Score: -3.38 X-Migadu-Queue-Id: 0E7C2534B4 X-Migadu-Scanner: mx13.migadu.com X-TUID: iJnJBP0YwL3p * guix/store.scm (validate-store-name): New procedure. Change-Id: I507d070d1cfdbd433d93830ee2937b1a1dee315a --- guix/store.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guix/store.scm b/guix/store.scm index b83f205096..096efcd128 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -205,6 +205,7 @@ (define-module (guix store) store-path-package-name store-path-hash-part direct-store-path + validate-store-name derivation-log-file log-file)) @@ -2303,6 +2304,16 @@ (define (store-path? path) ;; `isStorePath' in Nix does something similar. (string-prefix? (%store-prefix) path)) +(define (validate-store-name name) + (string-for-each + (lambda (c) + (unless (or (char-alphabetic? c) + (char-numeric? c) + (member c '(#\+ #\- #\. #\_ #\? #\=))) + (error (simple-format #f "invalid character ~A" c)))) + name) + #t) + (define (direct-store-path? path) "Return #t if PATH is a store path, and not a sub-directory of a store path. This predicate is sometimes needed because files *under* a store path are not -- 2.41.0