[pve-devel] applied: [PATCH pve-network] dhcp: dnsmasq: Use dir_glob_foreach for deleting configuration files

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Nov 29 11:09:04 CET 2023


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 at proxmox.com>
> Signed-off-by: Stefan Hanreich <s.hanreich at 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!




More information about the pve-devel mailing list