[systemd-devel] [PATCH] systemd-tmpfiles: Fix IGNORE_DIRECTORY_PATH age handling

Richard Weinberger richard at nod.at
Tue Sep 2 07:32:47 PDT 2014


Am 27.08.2014 14:55, schrieb Richard Weinberger:
> If one has a config like:
> d /tmp 1777 root root -
> X /tmp/important_mount
> 
> All files below /tmp/important_mount will be deleted as the
> /tmp/important_mount item will spuriously inherit a max age of 0
> from /tmp.
> /tmp has a max age of 0 but age_set is (of course) false.
> 
> Fix this by checking ->age_set in the IGNORE_DIRECTORY_PATH logic.
> 
> Signed-off-by: Richard Weinberger <richard at nod.at>
> ---
>  src/tmpfiles/tmpfiles.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
> index 79fd0b7..c8d4abb 100644
> --- a/src/tmpfiles/tmpfiles.c
> +++ b/src/tmpfiles/tmpfiles.c
> @@ -1572,7 +1572,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
>                                  candidate_item = j;
>                  }
>  
> -                if (candidate_item) {
> +                if (candidate_item && candidate_item->age_set) {
>                          i->age = candidate_item->age;
>                          i->age_set = true;
>                  }
> 

Ping?

Would be nice to see this merged, it fixes a nasty issue with PrivateTmp=yes.
Without that patch all files in private /tmp and /var/tmp will get deleted unconditionally
by systemd-tmpfiles if you configure it *not* to delete anything in /tmp and /var/tmp.
i.e:
d /tmp 1777 root root -
d /var/tmp 1777 root root -

This is the default on openSUSE.

Thanks,
//richard


More information about the systemd-devel mailing list