From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id yPgqMlmHYmRcywAASxT56A (envelope-from ) for ; Mon, 15 May 2023 21:26:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cEkZMlmHYmRiUAAA9RJhRA (envelope-from ) for ; Mon, 15 May 2023 21:26:17 +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 7D87D3FB86 for ; Mon, 15 May 2023 21:26:17 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pydpc-0005Qn-3h; Mon, 15 May 2023 15:26: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 1pydpa-0005QG-SU for guix-patches@gnu.org; Mon, 15 May 2023 15:26:02 -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 1pydpa-0006Br-LC for guix-patches@gnu.org; Mon, 15 May 2023 15:26:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pydpa-0003tO-Go for guix-patches@gnu.org; Mon, 15 May 2023 15:26:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63508] [PATCH] gnu: udev: Allow EUDEV_RULES_DIRECTORY to shadow built-in rules. References: In-Reply-To: Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 May 2023 19:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63508 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63508@debbugs.gnu.org Cc: felix.lechner@lease-up.com Received: via spool by 63508-submit@debbugs.gnu.org id=B63508.168417875114931 (code B ref 63508); Mon, 15 May 2023 19:26:02 +0000 Received: (at 63508) by debbugs.gnu.org; 15 May 2023 19:25:51 +0000 Received: from localhost ([127.0.0.1]:44448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pydpP-0003sk-3i for submit@debbugs.gnu.org; Mon, 15 May 2023 15:25:51 -0400 Received: from mail-ej1-f67.google.com ([209.85.218.67]:52598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pydpM-0003sW-Eg for 63508@debbugs.gnu.org; Mon, 15 May 2023 15:25:50 -0400 Received: by mail-ej1-f67.google.com with SMTP id a640c23a62f3a-96a2b6de3cbso1147459766b.1 for <63508@debbugs.gnu.org>; Mon, 15 May 2023 12:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684178743; x=1686770743; h=mime-version:cc:to:subject:date:from:message-id:from:to:cc:subject :date:message-id:reply-to; bh=FeY6+KzMjQmBKIrDRUrCJ1KwhvXb8omWfbyqtvqGnhg=; b=jG47v5gqvR5zKd6IOFDlQ6Jgi3f4KM11PM0XHUxEFHIF8ACcY34k+p5n2Rp+CSMqPV uYkl81ngpDTmRrPaSfzFRZ5K/nRwlyQaiqvSHOjCarKRyOZgGoByx4Ep2V03H+ofQW4v tNgbfN0o9Ds9EOWoaqX7vqu1YE28OWbBAfxmGSIQPUbOtwLaT/cm9tSzarzEr+6V/HuS RNbwSRFc0knNu/fd+Nu7G7rG/sQj7lg1nzIsRoYaoP83B3GB6c5xmrDPH70CKrCaVfDt H3tVrz/t68dRad5i1WXNWLH3ab85w0eAVLWZ0nUR1R3lD5ehfL0UeknBF9a5rAL3TAFm EzVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684178743; x=1686770743; h=mime-version:cc:to:subject:date:from:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=FeY6+KzMjQmBKIrDRUrCJ1KwhvXb8omWfbyqtvqGnhg=; b=ghz1MEUa1xbkE6xx0UbJas+Rl+ZQp4bLip4FXAWNmTa3Erq4Fs/vewbFr4No/REieW 0x2giTjTkUU+Q7IZk5Zquyixok9a9RRxU6UUudQWXp4JMkXPaqNqWfy5XqDOjorWD2OH gDxWh6CAnIG9yaOyHjQ5BNw5jgzvVrpRutTybYUHa3bv03DMJUgrdVvTi+ndPk42lZgE I9Y15hxG3rBcmgQTK96XpI4Taj8fTAhA5+Fwxda4WfK1zvTmO3g6rzk08n5zKP7BcrR6 b7vKOuC+7R/mKH+ZiQsJQjU4eluk4yhUV+S+kIKVRDUT9dRFkK4wXPxstq1yBk3qGHz0 dbFw== X-Gm-Message-State: AC+VfDx3pBmHmTlUgz7TNudEhvswSR4l1uWVh2OwREN9EiE7IhOQCn37 QUFqw8eYj7f76rBIhdZrsA03G8dGvUTpKA== X-Google-Smtp-Source: ACHHUZ4aL1LH20S7c4oxB0S/ICW5pCUjs6jpYazCHRG5K2Yrk+iwE9zvmr3EN/tS9qc+nZ8s8XTNIg== X-Received: by 2002:a17:907:3683:b0:966:dd1:bae2 with SMTP id bi3-20020a170907368300b009660dd1bae2mr29721094ejc.73.1684178742346; Mon, 15 May 2023 12:25:42 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id va8-20020a17090711c800b0094f282fc29asm9722291ejb.207.2023.05.15.12.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 12:25:42 -0700 (PDT) Message-Id: <06ea6673ca13ed6bc7fb00336dafc7a3457412ee.1684178049.git.liliana.prikler@gmail.com> From: Liliana Marie Prikler Date: Mon, 15 May 2023 21:11:54 +0200 MIME-Version: 1.0 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-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1684178777; a=rsa-sha256; cv=none; b=Fzft1zdxXh19nhw3o+HpOtjHUXnImpJTWyNeZ9gWQktLtzUmKm4XmVE8/Ngl3u+FFY8di3 B+yyXNXCQ5EIxTCwMJ/q3eHJvHelE4DPcXQzB1spqqHrv7o3f31EZLh7HyLcd0UJ/I7Y10 FyqX2jId/3hDah0iR1vv7ZzIxthmR6kJoHfmAAVC1jOgzuQsaoRAKlPsGjM9BIYeiwMLE6 wVGYsYPb2vnP7hdybqgIo2SebJovGk2CxHYZ5/ZZ9UoAS2kdrCGCEmLemBACtaNzUg5mXj 8e/S7UavEKJUZ+rHkvQzCYc2X3y2LJYY5Ut//kGCOlIkdjCakYPE3EQdwfmO2A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=jG47v5gq; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1684178777; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: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=FeY6+KzMjQmBKIrDRUrCJ1KwhvXb8omWfbyqtvqGnhg=; b=pzaoyL/64LEyqtdtsrFfAGaHAf2nSoYkZ97+KoBxW6xxGEzCNXPNkRWsgCVd8g7JoejmmG pXGSH2rWIWjsWgVod8NzbN5GZXD+usYddSA82Tht5ilp6oIGtj6Y8fDSUTp6xdHa649e+X mgITrXh3CdO46fstjcLdHP6fLTCq6U5GITxE8s2bPt1+BZZbsqrbBt2sMTrohj5mWsbqUr TnImF8MOGxGOAj3m/OZT1j642Q05a1CSB5jiAxQ2+hHTZIxX6QpTXTyxwgim0xbAqlF603 UaJPcCv7wgPE22pwNvUtcN0sIV3vtHwoVOHcoZhBj6eb6E/MGj/Vf+Z0zZPiwA== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=jG47v5gq; 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.31 X-Spam-Score: 7.31 X-Migadu-Queue-Id: 7D87D3FB86 X-TUID: 4thnceEYw02Q * gnu/packages/patches/eudev-rules-directory.patch (rules_dirs): Move placeholder to the start of the array. (rules_dirs_real): New procedure. (udev_rules_dirs_new, udev_rules_check_timestamp): Adjust accordingly. --- Hi Felix, Am Sonntag, dem 14.05.2023 um 21:56 -0700 schrieb Felix Lechner: > > I don't see how this change allows users *or upstream package > > maintainers* to continue using onboard names as they have done for > > ages and as they would want to continue to do. > > I have one of those cards. While the interface name did not change > when I fiddled with the PCI configuration, I am not sure that > prioritizing ID_NET_NAME_ONBOARD over ID_NET_NAME_MAC is a reasonable > default for Guix. > > To rank ID_NET_NAME_ONBOARD below ID_NET_NAME_MAC would not address > the shortcoming you perceived because the latter always exists. > > Instead, I think people wishing to use ID_NET_NAME_ONBOARD should > install a custom udev script (and those should be recognized by the > udevadm we ship). I think the current default is probably fine for more users than the proposed change (ain't no one got the time to type their MAC addresses). I do however see your point in that udev should let you choose to prefer ID_NET_NAME_MAC over the other rules. Now, the shortcoming here actually lies with our incomplete support for EUDEV_RULES_DIRECTORY, see the patch :) > For Guix, I think we would like to see ID_NET_NAME_MAC at the top. Now, I respectully disagree on that proposition, but am here to fix the original bug of udev not honouring your preference. With the following patch your udev-rule-service should be able to override the default behaviour. If not, try matching the file name. There shouldn't be any weird predicates on the name, but if there are, that's how we'll find out. Cheers .../patches/eudev-rules-directory.patch | 44 ++++++++++++++++--- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/gnu/packages/patches/eudev-rules-directory.patch b/gnu/packages/patches/eudev-rules-directory.patch index 54fc01c6d5..7cc3f97451 100644 --- a/gnu/packages/patches/eudev-rules-directory.patch +++ b/gnu/packages/patches/eudev-rules-directory.patch @@ -4,14 +4,17 @@ The old udev 182 supported $UDEV_CONFIG_FILE, which in turn allowed the search path to be customized, but eudev no longer has this, hence this hack. ---- eudev-3.1.5/src/udev/udev-rules.c 2015-10-13 06:22:14.000000000 +0800 -+++ eudev-3.1.5/src/udev/udev-rules.c 2015-10-16 20:45:38.491934336 +0800 -@@ -47,15 +47,11 @@ +Index: eudev/src/udev/udev-rules.c +=================================================================== +--- eudev.orig/src/udev/udev-rules.c ++++ eudev/src/udev/udev-rules.c +@@ -48,15 +48,11 @@ struct uid_gid { }; }; -static const char* const rules_dirs[] = { +static const char* rules_dirs[] = { ++ NULL, /* placeholder for $EUDEV_RULES_DIRECTORY */ UDEV_CONF_DIR "/rules.d", UDEV_RULES_DIR, - UDEV_ROOT_RUN "/udev/rules.d", @@ -20,17 +23,44 @@ this hack. - "/lib/udev/rules.d", - "/usr/lib/udev/rules.d", -#endif -+ NULL, /* placeholder for $EUDEV_RULES_DIRECTORY */ NULL}; struct udev_rules { -@@ -1704,6 +1700,9 @@ +@@ -1691,6 +1687,14 @@ static int parse_file(struct udev_rules + return 0; + } + ++static const char** rules_dirs_real() ++{ ++ if (rules_dirs[0]) ++ return rules_dirs; ++ else ++ return rules_dirs + 1; ++} ++ + struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { + struct udev_rules *rules; + struct udev_list file_list; +@@ -1717,7 +1721,10 @@ struct udev_rules *udev_rules_new(struct udev_rules_check_timestamp(rules); +- r = conf_files_list_strv(&files, ".rules", NULL, rules_dirs); + /* Allow the user to specify an additional rules directory. */ -+ rules_dirs[3] = getenv("EUDEV_RULES_DIRECTORY"); ++ rules_dirs[0] = getenv("EUDEV_RULES_DIRECTORY"); + - r = conf_files_list_strv(&files, ".rules", NULL, rules_dirs); ++ r = conf_files_list_strv(&files, ".rules", NULL, rules_dirs_real ()); if (r < 0) { log_error_errno(r, "failed to enumerate rules files: %m"); + return udev_rules_unref(rules); +@@ -1776,7 +1783,9 @@ bool udev_rules_check_timestamp(struct u + if (!rules) + return false; + +- return paths_check_timestamp(rules_dirs, &rules->dirs_ts_usec, true); ++ return paths_check_timestamp(rules_dirs_real (), ++ &rules->dirs_ts_usec, ++ true); + } + + static int match_key(struct udev_rules *rules, struct token *token, const char *val) { base-commit: 28bfc5cd081458313fa8601133386209b23deb12 -- 2.40.1