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

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



On Thu, 24 May 2018, Jan Beulich wrote:
> >>> On 23.05.18 at 20:21, <sstabellini@xxxxxxxxxx> wrote:
> > 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.
> 
> I'll leave that decision to you; I don't expect to be affected by this myself.

All right. In that case I'll keep mktemp as I did in v3. Thanks for the
review.

- Stefano

_______________________________________________
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®.