From: Christian Ebner <c.ebner@proxmox.com>
To: Robert Obkircher <r.obkircher@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: Re: [PATCH proxmox-backup v3 14/15] tape: use proxmox-product-config to generate create options
Date: Tue, 21 Jul 2026 10:26:21 +0200 [thread overview]
Message-ID: <7d6143c2-3de8-4bef-8996-898302b6a8ff@proxmox.com> (raw)
In-Reply-To: <7569e0e1-79dc-4455-a68c-59a0eddf7d49@proxmox.com>
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 <c.ebner@proxmox.com>
>>>> ---
>>>> 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?
next prev parent reply other threads:[~2026-07-21 8:26 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 14:03 [PATCH proxmox-backup v3 00/15] fix 7642: avoid expensive uid/gid lookups for lock- and config-files Christian Ebner
2026-07-01 14:03 ` [PATCH proxmox-backup v3 01/15] bin: api: early init proxmox-product-config Christian Ebner
2026-07-06 10:06 ` Robert Obkircher
2026-07-01 14:03 ` [PATCH proxmox-backup v3 02/15] bin: daily update: refactor to use proxmox-product-config Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 03/15] pbs-config: use proxmox-product-config::replace_secret_config() Christian Ebner
2026-07-06 12:28 ` Robert Obkircher
2026-07-01 14:04 ` [PATCH proxmox-backup v3 04/15] pbs-config: use proxmox-product-config::replace_config() Christian Ebner
2026-07-06 12:28 ` Robert Obkircher
2026-07-20 14:13 ` Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 05/15] fix #7642: avoid expensive user lookups on file locking Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 06/15] pbs-config: use proxmox-product-config helpers Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 07/15] pbs-config: drop backup_group helper, use users gid instead Christian Ebner
2026-07-06 12:28 ` Robert Obkircher
2026-07-01 14:04 ` [PATCH proxmox-backup v3 08/15] pbs-datastore: use proxmox-product-config cached backup user Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 09/15] pbs-datastore: use general helpers for file lock create options Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 10/15] server: auth helpers: use proxmox-product-config create options helpers Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 11/15] api: subscription: use proxmox-product-config create options Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 12/15] tape: use proxmox-product-config helper for user lookup Christian Ebner
2026-07-06 12:28 ` Robert Obkircher
2026-07-01 14:04 ` [PATCH proxmox-backup v3 13/15] tape: use proxmox-product-config lock file create options Christian Ebner
2026-07-01 14:04 ` [PATCH proxmox-backup v3 14/15] tape: use proxmox-product-config to generate " Christian Ebner
2026-07-06 12:29 ` Robert Obkircher
2026-07-20 14:12 ` Christian Ebner
2026-07-20 15:19 ` Robert Obkircher
2026-07-21 8:26 ` Christian Ebner [this message]
2026-07-21 8:58 ` Robert Obkircher
2026-07-01 14:04 ` [PATCH proxmox-backup v3 15/15] tree-wide: use proxmox-product-config::get_api_user for user lookup Christian Ebner
2026-07-20 14:17 ` superseded: [PATCH proxmox-backup v3 00/15] fix 7642: avoid expensive uid/gid lookups for lock- and config-files Christian Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d6143c2-3de8-4bef-8996-898302b6a8ff@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
--cc=r.obkircher@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox