* [pmg-devel] [PATCH pmg-api master v1] config: silence ENOENT when comparing SMTP filter config
@ 2025-09-22 15:24 Max R. Carrara
2025-09-22 21:51 ` Stoiko Ivanov
2025-09-23 11:12 ` [pmg-devel] superseded: " Max R. Carrara
0 siblings, 2 replies; 4+ messages in thread
From: Max R. Carrara @ 2025-09-22 15:24 UTC (permalink / raw)
To: pmg-devel
If `/run/pmg-smtp-filter.cfg` doesn't yet exist when `pmgsync.service`
runs, a "No such file or directory" warning is logged. While this has
been around since a while [0], the warning might look suspicious to
some (as it did to me during testing).
Therefore, handle ENOENT separately without emitting any warnings.
[0]: https://git.proxmox.com/?p=pmg-api.git;a=commitdiff;h=e5b31a6178118981e784b225941f1502ba644ee5
Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
src/PMG/Config.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 44e5463..46e8aa2 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -1909,7 +1909,9 @@ sub compare_smtp_filter_config {
my $old;
eval { $old = PVE::Tools::file_get_contents($smtp_filter_cfg); };
- if (my $err = $@) {
+ if ($!{ENOENT}) {
+ $ret = 1;
+ } elsif (my $err = $@) {
syslog('warning', "reloading pmg-smtp-filter: $err");
$ret = 1;
} else {
--
2.47.3
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pmg-devel] [PATCH pmg-api master v1] config: silence ENOENT when comparing SMTP filter config
2025-09-22 15:24 [pmg-devel] [PATCH pmg-api master v1] config: silence ENOENT when comparing SMTP filter config Max R. Carrara
@ 2025-09-22 21:51 ` Stoiko Ivanov
2025-09-23 11:11 ` Max R. Carrara
2025-09-23 11:12 ` [pmg-devel] superseded: " Max R. Carrara
1 sibling, 1 reply; 4+ messages in thread
From: Stoiko Ivanov @ 2025-09-22 21:51 UTC (permalink / raw)
To: Max R. Carrara; +Cc: pmg-devel
works as advertised - still one question inline:
On Mon, 22 Sep 2025 17:24:57 +0200
"Max R. Carrara" <m.carrara@proxmox.com> wrote:
> If `/run/pmg-smtp-filter.cfg` doesn't yet exist when `pmgsync.service`
> runs, a "No such file or directory" warning is logged. While this has
> been around since a while [0], the warning might look suspicious to
> some (as it did to me during testing).
>
> Therefore, handle ENOENT separately without emitting any warnings.
>
> [0]: https://git.proxmox.com/?p=pmg-api.git;a=commitdiff;h=e5b31a6178118981e784b225941f1502ba644ee5
>
> Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
> ---
> src/PMG/Config.pm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
> index 44e5463..46e8aa2 100644
> --- a/src/PMG/Config.pm
> +++ b/src/PMG/Config.pm
> @@ -1909,7 +1909,9 @@ sub compare_smtp_filter_config {
> my $old;
> eval { $old = PVE::Tools::file_get_contents($smtp_filter_cfg); };
>
> - if (my $err = $@) {
> + if ($!{ENOENT}) {
> + $ret = 1;
> + } elsif (my $err = $@) {
> syslog('warning', "reloading pmg-smtp-filter: $err");
why not simply replace the line above with:
`syslog('warning', "reloading pmg-smtp-filter: $err") if ! $!{ENOENT};`
(this would seem a bit more readable to me - but maybe I'm missing
something)
> $ret = 1;
> } else {
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pmg-devel] [PATCH pmg-api master v1] config: silence ENOENT when comparing SMTP filter config
2025-09-22 21:51 ` Stoiko Ivanov
@ 2025-09-23 11:11 ` Max R. Carrara
0 siblings, 0 replies; 4+ messages in thread
From: Max R. Carrara @ 2025-09-23 11:11 UTC (permalink / raw)
To: Stoiko Ivanov; +Cc: pmg-devel
On Mon Sep 22, 2025 at 11:51 PM CEST, Stoiko Ivanov wrote:
> works as advertised - still one question inline:
>
> On Mon, 22 Sep 2025 17:24:57 +0200
> "Max R. Carrara" <m.carrara@proxmox.com> wrote:
>
> > If `/run/pmg-smtp-filter.cfg` doesn't yet exist when `pmgsync.service`
> > runs, a "No such file or directory" warning is logged. While this has
> > been around since a while [0], the warning might look suspicious to
> > some (as it did to me during testing).
> >
> > Therefore, handle ENOENT separately without emitting any warnings.
> >
> > [0]: https://git.proxmox.com/?p=pmg-api.git;a=commitdiff;h=e5b31a6178118981e784b225941f1502ba644ee5
> >
> > Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
> > ---
> > src/PMG/Config.pm | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
> > index 44e5463..46e8aa2 100644
> > --- a/src/PMG/Config.pm
> > +++ b/src/PMG/Config.pm
> > @@ -1909,7 +1909,9 @@ sub compare_smtp_filter_config {
> > my $old;
> > eval { $old = PVE::Tools::file_get_contents($smtp_filter_cfg); };
> >
> > - if (my $err = $@) {
> > + if ($!{ENOENT}) {
> > + $ret = 1;
> > + } elsif (my $err = $@) {
> > syslog('warning', "reloading pmg-smtp-filter: $err");
> why not simply replace the line above with:
> `syslog('warning', "reloading pmg-smtp-filter: $err") if ! $!{ENOENT};`
> (this would seem a bit more readable to me - but maybe I'm missing
> something)
Oh yeah, you're completely right—didn't occur to me to have the check
there instead. I find that much nicer as well. Thanks for pointing that
out!
Just sent in a v2.
>
>
> > $ret = 1;
> > } else {
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pmg-devel] superseded: [PATCH pmg-api master v1] config: silence ENOENT when comparing SMTP filter config
2025-09-22 15:24 [pmg-devel] [PATCH pmg-api master v1] config: silence ENOENT when comparing SMTP filter config Max R. Carrara
2025-09-22 21:51 ` Stoiko Ivanov
@ 2025-09-23 11:12 ` Max R. Carrara
1 sibling, 0 replies; 4+ messages in thread
From: Max R. Carrara @ 2025-09-23 11:12 UTC (permalink / raw)
To: Max R. Carrara, pmg-devel
v2: https://lore.proxmox.com/pmg-devel/20250923111000.96989-1-m.carrara@proxmox.com/
On Mon Sep 22, 2025 at 5:24 PM CEST, Max R. Carrara wrote:
> If `/run/pmg-smtp-filter.cfg` doesn't yet exist when `pmgsync.service`
> runs, a "No such file or directory" warning is logged. While this has
> been around since a while [0], the warning might look suspicious to
> some (as it did to me during testing).
>
> Therefore, handle ENOENT separately without emitting any warnings.
>
> [0]: https://git.proxmox.com/?p=pmg-api.git;a=commitdiff;h=e5b31a6178118981e784b225941f1502ba644ee5
>
> Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-23 11:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-22 15:24 [pmg-devel] [PATCH pmg-api master v1] config: silence ENOENT when comparing SMTP filter config Max R. Carrara
2025-09-22 21:51 ` Stoiko Ivanov
2025-09-23 11:11 ` Max R. Carrara
2025-09-23 11:12 ` [pmg-devel] superseded: " Max R. Carrara
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.