public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Stefan Hanreich <s.hanreich@proxmox.com>
Subject: [pve-devel] applied: [PATCH pve-network] dhcp: dnsmasq: Use dir_glob_foreach for deleting configuration files
Date: Wed, 29 Nov 2023 11:09:04 +0100	[thread overview]
Message-ID: <96822933-a867-4d51-bf9d-17b363198173@proxmox.com> (raw)
In-Reply-To: <20231128085857.61974-1-s.hanreich@proxmox.com>

Am 28/11/2023 um 09:58 schrieb Stefan Hanreich:
> The current invocation is quite unsafe and triggers the taint mode of
> Perl. Replacing it with dir_glob_foreach solves those issues.
> 
> Reported-By: Friedrich Weber <f.weber@proxmox.com>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
> I wasn't sure whether directly unlinking the files in the callback
> would influence the iteration, hence why I store them in an
> intermediate array. Also, unlinking them all at once probably is
> better than unlinking them one-by-one (although it shouldn't matter
> with the low amount of files here..)

At least POSIX doesn't gives any guarantee:

> If a file is removed from or added to the directory after the most
> recent call to opendir() or rewinddir(), whether a subsequent call to
> readdir() returns an entry for that file is unspecified.

And Linux seems to only guarantee that files not added or removed since
the last opendir are returned, so it probably would work for this use
case, but IMO it's just not worth the hassle finding out if there's
some odd edge case, so a intermediate array was a good call.

> 
>  src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
>

applied, thanks!




      reply	other threads:[~2023-11-29 10:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28  8:58 [pve-devel] " Stefan Hanreich
2023-11-29 10:09 ` Thomas Lamprecht [this message]

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=96822933-a867-4d51-bf9d-17b363198173@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.hanreich@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal