On Sun, Nov 10, 2013 at 11:13:57PM +0100, Lennart Poettering wrote:
> On Fri, 08.11.13 14:36, Michal Sekletar (msekl...@redhat.com) wrote:
> 
> > 
> > On Thu, Nov 07, 2013 at 10:39:19PM +0100, Lennart Poettering wrote:
> > > On Wed, 06.11.13 11:18, Michal Sekletar (msekl...@redhat.com) wrote:
> > > 
> > > > Type x in tmpfiles configuration accepts shell style globs instead of 
> > > > normal
> > > > paths. If user uses normal path he might expect that the path will be 
> > > > left
> > > > untouched. However this is not the case for directories and content of 
> > > > the
> > > > directory will be cleaned according to the Age parameter, we should 
> > > > rather skip
> > > > the path entirely in such case.
> > > 
> > 
> > Hi Lennart,
> > 
> > > Not sure I follow. dir_cleanup() already skips all items listed in the
> > > glob hashmap anyway, no? What does your patch add on top of that?
> > 
> > In dir_cleanup() we skip if there is an item configured for the path or it
> > matches the glob, however we are doing it on the subpaths of currently 
> > processed
> > directory. This won't work in the case mentioned in the commit message. If 
> > user
> > wants to exclude path from cleanup entirely he has to use x /path/*, this 
> > way
> > all subpaths match the glob. In case of x /path/ no subpath matches such 
> > glob
> > and we remove them, hence checking explicitly beforehand.
> 
> Hmm, still not following...

Hi Lennart,

> 
> When we iterate through a directory tree to clean things up we check if
> the path in we currently look at matches any glob or whether there is
> any line defined for it at all. 

True, but in the case I described in previous email there is no specific item
for subpaths of the currently processed directory nor subpaths match any glob
since user uses x /some/path in the configuration. If user would have used x
/some/path/* then we match subpaths of /some/path against such glob and
correctly skip them.

> If so, we skip the entry (and do not
> descend further into it!). This is in the two if blocks that carry the
> "Is there an item configured for this path?" comment?

Well, we open dir and then call readdir() in a while loop, we skip ., .. and
then we process process directory content. In case there is a matching glob 
or specific item configured we call continue to process next file in the
directory.

This is my interpretation of what is happening, if it doesn't make any sense to
you then I guess that I am terribly wrong.

> 
> So I still don't get the problem you are trying to point out. Can you
> give a minimal example where the problem manifests? Maybe I grok it
> then...
> 

Please consider following configuration and steps to reproduce:

*** /etc/tmpfiles.d/test.conf ***
d /tmp/testdir 0755 lennart lennart 1s
x /tmp/testdir

# systemd-tmpfiles --create test.conf
$ mkdir /tmp/testdir/a
$ mkdir /tmp/testdir/b
# systemd-tmpfiles --clean test.conf
$ ls -l

Before applying a patch and following steps to reproduce you should end up with
empty /tmp/testdir, i.e. manually created directories a and b are removed. This
is not the case after applying the patch, thus making things more 
understandable to
admin since in both cases he used configuration x /tmp/testdir but in the former
case is content deleted.

> Thanks!

Hope that helps!

Michal
> 
> Lennart
> 
> -- 
> Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to