[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 10/10] xen: add cloc target



On Wed, 23 May 2018, Jan Beulich wrote:
> >>> On 22.05.18 at 22:08, <sstabellini@xxxxxxxxxx> wrote:
> > On Tue, 22 May 2018, Jan Beulich wrote:
> >> >>> On 22.05.18 at 02:53, <sstabellini@xxxxxxxxxx> wrote:
> >> > +        $(eval tmpfile := $(shell mktemp))
> >> > +        $(foreach f, $(shell find $(BASEDIR) -name *.o.d), \
> >> > +                $(eval path := $(dir $(f))) \
> >> > +                $(eval name := $(shell cat $(f) | head -1 | cut -d " " 
> >> > -f 2)) \
> >> > +                $(shell if test -f $(path)/$(name) ; then echo 
> >> > $(path)/$(name) >> $(tmpfile); fi;))
> >> > +        cloc --list-file=$(tmpfile)
> >> > +        rm $(tmpfile)
> >> 
> >> I think you also want to "rm -f $(tmpfile)" first thing in case a prior 
> >> "make cloc"
> >> was interrupted.
> > 
> > The issue is that tmpfile will be different the second time around
> > (mktemp returning a new name) so it is not quite possible to remove the
> > old tmpfile.
> 
> Oh, I'm sorry for the noise - I should have paid attention to the very
> first line of what is still quoted of your patch above.
> 
> Instead you then have the problem of the temporary file not being cleaned
> up when interrupting "make cloc". Granted there are many other cases
> where such files don't get cleaned up (judging from a look at my one /tmp),
> but it'd be nice if we didn't contribute to the problem.

Given that tmpfile will be quite small, I think it is best to keep using
mktemp and risk leaking it. However, if you prefer, I can switch to
using a well-known filename, such as "sourcelist" to avoid leaks in case
of Ctrl-C during make.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.