dist: more forcefully deal with mode 0 directories created by tests.

From https://bugs.gnu.org/67868.

* lib/am/distdir.am (am__remove_distdir): make directories
readable and searchable, not just writable. (Also typo.)
* t/local.mk (clean-local-check): ensure directories are
at least mode 700
* t/uninstall-fail.sh: restore reasonable permissions of
the mode 0 $inst/share directory at the end.
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index 264713c..301239d 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -23,7 +23,7 @@
 
 am__remove_distdir = \
   if test -d "$(distdir)"; then \
-    find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+    find "$(distdir)" -type d ! -perm -700 -exec chmod u+rwx {} ';' \
       && rm -rf "$(distdir)" \
 ## On MSYS (1.0.17) it is not possible to remove a directory that is in
 ## use; so, if the first rm fails, we sleep some seconds and retry, to
@@ -213,7 +213,7 @@
 	  fi; \
 	done
 ##
-## Test for directory existence here because previous automake
+## Test for directory existence here because a previous automake
 ## invocation might have created some directories.  Note that we
 ## explicitly set distdir for the subdir make; that lets us mix-n-match
 ## many automake-using packages into one large package, and have "dist"
diff --git a/t/local.mk b/t/local.mk
index 4fa46a0..51386fd 100644
--- a/t/local.mk
+++ b/t/local.mk
@@ -278,6 +278,7 @@
 clean-local: clean-local-check
 .PHONY: clean-local-check
 clean-local-check:
+	find . -type d ! -perm -700 -exec chmod u+rwx {} ';'
 	$(AM_V_GEN)$(PERL) $(srcdir)/t/ax/deltree.pl t/*.dir t/*/*.dir */t/*.dir
 
 # vim: ft=automake noet
diff --git a/t/uninstall-fail.sh b/t/uninstall-fail.sh
index a1a365d..60e131f 100644
--- a/t/uninstall-fail.sh
+++ b/t/uninstall-fail.sh
@@ -98,4 +98,7 @@
 
 $EGREP "(cd|sh)(\[[0-9]*[0-9]\])?: .*$inst/share" output
 
+# restore reasonable permissions so the rest of the world doesn't have to deal.
+chmod u+rwx $inst/share
+
 :