[LTP] [PATCH v5 3/3] controllers/cpuacct: fix rmdir failures on early test abort

Petr Vorel pvorel@suse.cz
Thu Sep 2 18:00:38 CEST 2021


> On 02/09/2021 10:18, Petr Vorel wrote:
> > Hi Krzysztof,

> > ...
> >> -	if [ -d "$testpath/subgroup_1" ]; then
> >> -		rmdir $testpath/subgroup_*
> >> +	if [ "$testpath" ]; then
> >> +		if [ -d "$testpath/subgroup_1" ]; then
> >> +			rmdir $testpath/subgroup_*
> >> +		fi
> >> +		rmdir $testpath
> >>  	fi

> >> -	rmdir $testpath
> >> -

> > LGTM, but how about use `rm -rf' instead?

> > e.g.

> > if [ "$testpath" ]; then
> > 	rm -rf $testpath
> > fi

> > That could simplify checks. Or is it needed to use `rmdir' to make sure there is
> > no content in the directory? I suppose check like this is needed in cleanup,
> > thus no problem to use `rm -rf'.

> It isn't the point of this patch. I don't add here rmdir - all this code
> was here before. The only thing added here is to check whether the
> "testpath" variable is set or not.
Agree.

> I think using rm -rf should work, but anyway it's a separate commit :)
Agree, I just thought in simple thing like this it could be squashed (you add
code which then will be deleted), but sure, you're right.

I'll handle the cleanup with rm (unless you send follow up patch yourself).

Kind regards,
Petr


> Best regards,
> Krzysztof


More information about the ltp mailing list