[RFA] Fix gdb snapshots

Simon Marchi simon.marchi@polymtl.ca
Wed Nov 29 17:38:00 GMT 2017


On 2017-11-29 12:27, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
> 
> Tom> -		rmdir $$i/$(DEPDIR); \
> Tom> +		rm -rf $$i/$(DEPDIR) || true; \
> 
> Simon pointed out I failed to actually make the change.
> Haha.
> 
> Here's try 3.
> 
> Tom
> 
> commit c24e0f6a00df51160118c5020d90a1aeb92eefc6
> Author: Tom Tromey <tom@tromey.com>
> Date:   Wed Nov 29 09:27:40 2017 -0700
> 
>     Fix gdb snapshots
> 
>     Joel pointed out that gdb snapshots were broken by my Makefile 
> patch
>     series.  The bug is that rmdir in distclean was failing, because 
> the
>     directory did not exist.  This fixes the bug by only invoking rmdir 
> when
>     the directory exists.
> 
>     Tested using "src-release.sh gdb".
> 
>     2017-11-29  Tom Tromey  <tom@tromey.com>
> 
>             * Makefile.in (distclean): Handle the case where rmdir 
> fails.
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index ebb969998c..dbea503d02 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,7 @@
> +2017-11-29  Tom Tromey  <tom@tromey.com>
> +
> +	* Makefile.in (distclean): Handle the case where rmdir fails.
> +
>  2017-11-27  Tom Tromey  <tom@tromey.com>
> 
>  	* Makefile.in (REMOTE_OBS): Remove.
> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
> index 6e16bc6682..284559b030 100644
> --- a/gdb/Makefile.in
> +++ b/gdb/Makefile.in
> @@ -1995,7 +1995,7 @@ distclean: clean
>  	rm -f Makefile
>  	rm -rf $(DEPDIR)
>  	for i in $(CONFIG_SRC_SUBDIR); do \
> -		rmdir $$i/$(DEPDIR); \
> +		if test -d $$i/$(DEPDIR); then rmdir $$i/$(DEPDIR); fi \
>  	done

Since this is in distclean, we know that clean will have ran before, and 
thus .deps will be empty by now, is that right?  In my original reply, I 
got confused and thought that the problem was that .deps was non-empty, 
when the problem was actually that it was not present (my bad for not 
reading carefully your log).

If so, that version with the if looks good to me.  My suggestion to do 
"[ -d ... ] && rmdir ..." would not have worked, because it would have 
returned a non-zero exit code and stopped the execution just like the 
current code.

Thanks,

Simon



More information about the Gdb-patches mailing list