From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 4B30816799; Thu, 25 Sep 2025 04:30:30 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 28C4A1677A; Thu, 25 Sep 2025 04:30:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_PASS,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by atuin.qyliss.net (Postfix) with ESMTPS id CED1C16779 for ; Thu, 25 Sep 2025 04:30:25 +0000 (UTC) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-57b8fc6097fso561441e87.1 for ; Wed, 24 Sep 2025 21:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758774620; x=1759379420; darn=spectrum-os.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0CVZvSDdJvvbnuhSO3ayHnGYhDno2gWKtLHnS8b3xp0=; b=BpkR+FeiWG/AnACjxcZK95hcnWHWNyS27h9AbAoAUnsbHbELm+WNvRTrBK5tTUMmZ+ d8qpvmxgrDrEF9iKYD3rBRo7weOCPtr7nDQxpf8JVa4Un98b1tLxZHF5inQbWeJuYW8V XiaLaaR2lO6sRyySVxetW56+h+zpjNAj6nkDsHAZnA39LAOTp4vXx+fVPK39CcXJMFzR QqtPX1ANGznoMzqlwjwCqWITbpeOPI/tPdx0jFjJjJrSzffzXXkadG1HCMDyhuH6xl7x kie583St9pjlDVyjgBx+jydZH/i2VkXTVPCVaW9bzCZs3i+OF7+uoJXhpsG/4ekG3WOz c4OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758774620; x=1759379420; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0CVZvSDdJvvbnuhSO3ayHnGYhDno2gWKtLHnS8b3xp0=; b=okEY1CpuV9zKjt7rIBXvoQmaGHZw8vCxDKtLq2ZvzmKDceQ8G6zNYscoWf7RQORtZp 0SwLR6NqAf7hiQVxU9/0urqVoLzhXcwJNx6kptIQVnaXtu1P/A9GLXRQR+0DsqBPG2Qk NiWuEm+L5zi51u2/gVtJ1DjlIqkv5DKXnRG49SdECRvFx3LvZkfTrdWUSy2td3y6cLL0 nme3QT29wx6TLBjO1FMM3Rwh9gXofpuaXdBv/izICRZIY+VH8fdMomCsPsv8CSbFye9d oryEwyfMWVMZrQI31a8+eRMWH6NG0m2KQ+GNjLCKPbqnd4wUwQk8uVvqU8KJ5RuZ4umc akoQ== X-Forwarded-Encrypted: i=1; AJvYcCV3IY1PwZy9KoPyXKznZm/qywtlb3hZu7rZ0O49M8rm5DUa3+JSuMrS1GulkicUEbwBCiz5LQ==@spectrum-os.org X-Gm-Message-State: AOJu0YypjmMfaXYcrFUudyaVh1D8BfaK3IUwBKu/nU4F97bF8nSP9Rst hAmZkH3a+0nv2RzXeOtuWSSmx3+TUqGJkDHdgVx85DmYcLPxnbRy/34u X-Gm-Gg: ASbGncspx8NKyoku5cqZpfYr52Yd3ZcqtQqypzktwDU+wGzR/toAPSK8YaZVwq8rYo3 ILTRRJkYAzPPBWOPUFyn9jqOJCTO8QzqAXMcMJtknGWkWMxk50DYLu99/idhA/cYxm1b86u2zqM wPoUMTCkjt2GOt0PUCqw/QvDPsk7L+DhKhIocdxAolNJEsXdrJe+nooRSl3ChosIcQ4G//xlCa5 xzhH800qqeihwHX1J61wdiHymHy1sfseqbOAvkew3NglCstUUQc2S9M9NNkfS4PUQ++9yRZoUfc dO6d3dD7BbgM8EWNifIQkjRqQvPa6QQk0jbzOtmWf273yxSFOTSJsm4MgJmJT9E+0QbiGs5Spa7 dtwpIH3BVg3TjdUaR+VKTz1n3/j3Ww3cSagRhNQ5Kjs9IZfVKfYlBaBRkZW/rmvyysMBpss4Z X-Google-Smtp-Source: AGHT+IGYv5xgkUvmPf4xlJGK/6fes1rdfW9U/uvsjtKZSIP+Ym99UqazTsGOf9kTizWJzi+6E7LTOg== X-Received: by 2002:a05:6512:1094:b0:57a:3d7e:7275 with SMTP id 2adb3069b0e04-582d2583dffmr600369e87.36.1758774619484; Wed, 24 Sep 2025 21:30:19 -0700 (PDT) Received: from ?IPV6:2a00:1370:8180:3b0f:4a6a:92ad:1748:bccb? ([2a00:1370:8180:3b0f:4a6a:92ad:1748:bccb]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-583134312ffsm339968e87.13.2025.09.24.21.30.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Sep 2025 21:30:18 -0700 (PDT) Message-ID: Date: Thu, 25 Sep 2025 07:30:17 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [systemd-devel] Non-idempotent RUN+= scripts To: Demi Marie Obenour , =?UTF-8?Q?Mantas_Mikul=C4=97nas?= References: <65bf66b4-142e-40ae-b7af-885669da53c7@gmail.com> <290988e7-6a18-43b7-bd90-4e518f463c5c@gmail.com> Content-Language: en-US, ru-RU From: Andrei Borzenkov In-Reply-To: <290988e7-6a18-43b7-bd90-4e518f463c5c@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID-Hash: KB3WGVSZRRC2LOZAC3FLUR7JCNTC3YBF X-Message-ID-Hash: KB3WGVSZRRC2LOZAC3FLUR7JCNTC3YBF X-MailFrom: arvidjaar@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: systemd development , Spectrum OS Development X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 24.09.2025 23:46, Demi Marie Obenour wrote: > On 9/24/25 13:46, Mantas Mikulėnas wrote: >> On Wed, Sep 24, 2025 at 8:27 PM Demi Marie Obenour >> wrote: >> >>> There are cases where a RUN+= script needs to do something >>> exactly once each time a device appears, such as binding a >>> different driver to the device. If the udev rule matches >>> based on a property (such as PCI device information) that >>> is set only by the kernel, is it okay to use ACTION=="add" >>> in the rule? The only other options I know of are to either >>> >> >> Such events can still be caused by the admin doing "udevadm trigger >> --action=". Not sure why one might do that, but probably better to not rely >> on nobody doing that. > > In *this* case that should never happen, as Spectrum OS's host > is basically an appliance and ideally nobody would be able to > run commands like that. > systemd-udev-trigger.service does it > Will an ACTION=="add" event always come before any other events? > >>> 1. Add additional code to the script to make sure it is >>> idempotent. This might require adding a lock. >>> >> >> Maybe not necessarily a lock as I *think* udev event processing is >> serialized (for a given device at least); a flag file in /run or an xattr >> on the /dev node might be enough. > > These are PCI devices with no driver. The difficulty with a flag file > is that it needs to be reliably removed. > You may try adding device property and importing it in events (IMPORT{db}).