From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117337 invoked by alias); 29 Nov 2017 17:38:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 117323 invoked by uid 89); 29 Nov 2017 17:38:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=i X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Nov 2017 17:38:05 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id vATHbwx2031602 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 29 Nov 2017 12:38:03 -0500 Received: by simark.ca (Postfix, from userid 112) id 766191E586; Wed, 29 Nov 2017 12:37:58 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 6CD851E51E; Wed, 29 Nov 2017 12:37:47 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 29 Nov 2017 17:38:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Fix gdb snapshots In-Reply-To: <87r2sh6lmd.fsf@tromey.com> References: <20171129163158.18968-1-tom@tromey.com> <8e2ede504e1aab0bc0cda57e10989bb2@polymtl.ca> <87zi756mw4.fsf@tromey.com> <87vaht6mov.fsf@tromey.com> <87r2sh6lmd.fsf@tromey.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.2 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 29 Nov 2017 17:37:58 +0000 X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg00782.txt.bz2 On 2017-11-29 12:27, Tom Tromey wrote: >>>>>> "Tom" == Tom Tromey 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 > 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 > > * 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 > + > + * Makefile.in (distclean): Handle the case where rmdir fails. > + > 2017-11-27 Tom Tromey > > * 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