From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 4EF311FF146 for ; Tue, 21 Jul 2026 10:58:12 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 78111214BC; Tue, 21 Jul 2026 10:58:11 +0200 (CEST) Message-ID: Date: Tue, 21 Jul 2026 10:58:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH proxmox-backup v3 14/15] tape: use proxmox-product-config to generate create options To: Christian Ebner , pbs-devel@lists.proxmox.com References: <20260701140412.200920-1-c.ebner@proxmox.com> <20260701140412.200920-15-c.ebner@proxmox.com> <43945d83-ad3c-4988-9f27-83dac1577ca8@proxmox.com> <7569e0e1-79dc-4455-a68c-59a0eddf7d49@proxmox.com> <7d6143c2-3de8-4bef-8996-898302b6a8ff@proxmox.com> Content-Language: en-US, de-AT From: Robert Obkircher In-Reply-To: <7d6143c2-3de8-4bef-8996-898302b6a8ff@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1784624262466 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.279 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: A6VUPN4QVBASGMN7EQPQZ3VTDT7UKRVO X-Message-ID-Hash: A6VUPN4QVBASGMN7EQPQZ3VTDT7UKRVO X-MailFrom: r.obkircher@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 21.07.26 10:25, Christian Ebner wrote: > On 7/20/26 5:19 PM, Robert Obkircher wrote: >> >> On 20.07.26 16:12, Christian Ebner wrote: >>> On 7/6/26 2:28 PM, Robert Obkircher wrote: >>>> >>>> On 01.07.26 16:05, Christian Ebner wrote: >>>>> Instead of redefining them, use the global helper defined in >>>>> proxmox-product-config. Requires the crates init function to be >>>>> called exactly once before using in any callpath. >>>>> >>>>> Signed-off-by: Christian Ebner >>>>> --- >>>>>    src/tape/inventory.rs           |  6 +----- >>>>>    src/tape/media_catalog_cache.rs | 10 +--------- >>>>>    2 files changed, 2 insertions(+), 14 deletions(-) >>>>> >>>>> diff --git a/src/tape/inventory.rs b/src/tape/inventory.rs >>>>> index 6c54738fb..12cca02c6 100644 >>>>> --- a/src/tape/inventory.rs >>>>> +++ b/src/tape/inventory.rs >>>>> @@ -177,11 +177,7 @@ impl Inventory { >>>>>                // We cannot use chown inside test environment (no >>>>> permissions) >>>>>                CreateOptions::new().perm(mode) >>>>>            } else { >>>>> -            let backup_user = pbs_config::backup_user()?; >>>>> -            CreateOptions::new() >>>>> -                .perm(mode) >>>>> -                .owner(backup_user.uid) >>>>> -                .group(backup_user.gid) >>>>> +            proxmox_product_config::default_create_options() >>>>>            }; >>>> I think the then branch of this if statement could be removed, >>>> because >>>> for cfg!(test) the backup_user is already set to the current user. >>> >>> Thanks for the hint, at first glance it should behave as you >>> expected but I can trigger test failures without that, getting an >>> EPERM error on fchown on CreateOptions::apply_at(). I guess this is >>> caused by (man 2 fchown): >>> >>>> Only a privileged process (Linux: one with the CAP_CHOWN >>> capability) may change the owner of a file. >>> >>> Didn't investigate further though and opted for leaving the checks >>> in place. >> >> >> Chown does work if the user stays the same and is a member of the >> target group: >> >> robkircher@devel:~$ strace --trace=fchownat chown >> robkircher:robkircher test >> fchownat(AT_FDCWD, "test", 1000, 1000, 0) = 0 >> >> It looks like the real problem is that pbs_config is a separate crate, >> so cfg(test) is always false there. > > Ah right, that does make sense. But since this would imply that > boilerplate code is required anyways to cover the case, I would > leave the code as is. > > Unless there is an elegant way to propagate this I'm overlooking?  PROXMOX_PRODUCT_CONFIG_INIT_FOR_TESTS could potentially just set the current user as the api user, but I haven't checked if that breaks anything else (and I also don't fully understand why we have multiple users in the first place).