Subject: Re: bug#9578: make uninstall fails after make install-data in empty prefix.

From: Stefano Lattarini <[email-masked]>
Date: Wed, 28 Sep 2011 13:24:13 +0200

On Monday 26 September 2011, Stefano Lattarini wrote:
> On Saturday 24 September 2011, Stefano Lattarini wrote:
> > On Thursday 22 September 2011, Nick Bowler wrote:
> > > Hello,
> > >
> > Hi Nick, thanks for the report.
> > 
> > > I noticed a problem testing the uninstall target of my
> > > automake-generated Makefiles.  If the install prefix does not exist
> > > before installation, automake will create the necessary directories.
> > > But if you run a plain "make install-data" (without make install-exec),
> > > the directories for executables are (unsurprisingly) not created.  The
> > > problem is that "make uninstall" fails in this case:
> > >
> > I'm not yet sure whether this should be considered a bug or a feature...
> > I'm inclined to agree with you that it's more of a bug though, so I'll
> > push the attached patch to maint in a few days if nobody objects.  This
> > change is not completely obvious, so any review would be appreciated.
> > 
> > Notice that the test coverage added by the patch is far from perfect, but
> > I'd rather improve it in the `testsuite-work' branch only, so that I'll
> > be able to use TAP and won't be forced to write 10 or so new "sister
> > tests" instead.
> >
> > Thanks,
> >    Stefano
> > 
> 
Oops, the patch as I've pushed it was causing "make maintainer-check" to
fail.  I've pushed the attached follow-up to fix this.

Sorry for the noise,
  Stefano
From a2803e6a0d65e5124dd12d89acab61ac8fc11a53 Mon Sep 17 00:00:00 2001
Message-Id: <a2803e6a0[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Wed, 28 Sep 2011 13:17:13 +0200
Subject: [PATCH] maintcheck: fix usage of `cd' instead of `$(am__cd)'

* lib/am/inst-vars.am (am__uninstall_files_from_dir): Use
`$(am__cd)', not plain `cd'.
---
 ChangeLog           |    6 ++++++
 lib/am/inst-vars.am |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4347a89..c3b041d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-28  Stefano Lattarini  <[email-masked]>
+
+	maintcheck: fix usage of `cd' instead of `$(am__cd)'
+	* lib/am/inst-vars.am (am__uninstall_files_from_dir): Use
+	`$(am__cd)', not plain `cd'.
+
 2011-09-24  Stefano Lattarini  <[email-masked]>
 
 	uninstall: "make uninstall" before "make install" works
diff --git a/lib/am/inst-vars.am b/lib/am/inst-vars.am
index 477513f..a807f79 100644
--- a/lib/am/inst-vars.am
+++ b/lib/am/inst-vars.am
@@ -67,7 +67,7 @@ am__uninstall_files_from_dir = { \
 ## is indeed desired and welcome (better to fail loudly thasn silently).
     || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         cd "$$dir" && rm -f $$files; }; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
   }
 
 endif %?FIRST%
-- 
1.7.2.3