Subject: bug#30335: closed (Re: bug#30335: ‘make uninstall’ exceeds command-line length limit)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 18 Feb 2018 13:14:05 +0000

Your bug report

#30335: ‘make uninstall’ exceeds command-line length limit

which was filed against the automake package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
30335: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=30335
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#30335: ‘make uninstall’ exceeds command-line length limit
From: Mathieu Lirzin <[email-masked]>
To: [email-masked]
Date: Sun, 18 Feb 2018 14:13:33 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Mathieu Lirzin <[email-masked]> writes:

> "t/instmany-python.sh" test fails for the ‘uninstall’ target.

This is fixed by commit 006c4dfede96091f5bed622c17946cbec067347f

>From 006c4dfede96091f5bed622c17946cbec067347f Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin <[email-masked]>
Date: Sun, 4 Feb 2018 00:09:31 +0100
Subject: [PATCH] python: Avoid exceeding command-line length limit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With Python implementations following PEP-3174, a large number of files
are installed in the ‘__pycache__’ directory.  As a consequence
“t/instmany-python.sh” test was failing due to the
‘uninstall-pythonPYTHON’ target deleting installed files in a single
‘rm’ command.  Doing that in multiple steps avoids exceeding the
command-line length limit.  This fixes bug#30335.

* lib/am/python.am (uninstall-%DIR%PYTHON): For byte-compiled files
installed in '__pycache__' directory, uninstall them by batch of 40.
[?FIRST?] (am__pep3147_tweak): Adapt.
---
 lib/am/python.am | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/lib/am/python.am b/lib/am/python.am
index e29ecfcd0..21e6f842c 100644
--- a/lib/am/python.am
+++ b/lib/am/python.am
@@ -97,7 +97,7 @@ endif %?INSTALL%
 if %?INSTALL%
 
 ?FIRST?am__pep3147_tweak = \
-?FIRST?  sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|'
+?FIRST?  sed -e 's|\.py$$||' -e 's|[^/]*$$|&.*.pyc\n&.*.pyo|'
 
 .PHONY uninstall-am: uninstall-%DIR%PYTHON
 uninstall-%DIR%PYTHON:
@@ -108,26 +108,19 @@ uninstall-%DIR%PYTHON:
 	test -n "$$py_files" || exit 0; \
 	dir='$(DESTDIR)$(%NDIR%dir)'; \
 ## Also remove the .pyc and .pyo byte compiled versions.
-## This is somewhat tricky, because for newer pythons we have to take
-## PEP-3147 into account.
 	pyc_files=`echo "$$py_files" | sed 's|$$|c|'`; \
 	pyo_files=`echo "$$py_files" | sed 's|$$|o|'`; \
-	py_files_pep3147=`echo "$$py_files" | $(am__pep3147_tweak)`; \
-	echo "$$py_files_pep3147";\
-	pyc_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|c|'`; \
-	pyo_files_pep3147=`echo "$$py_files_pep3147" | sed 's|$$|o|'`; \
 	st=0; \
-	for files in \
-	  "$$py_files" \
-	  "$$pyc_files" \
-	  "$$pyo_files" \
-## Installation of '.py' files is not influenced by PEP-3147, so it
-## is correct *not* to have $pyfiles_pep3147 here.
-	  "$$pyc_files_pep3147" \
-	  "$$pyo_files_pep3147" \
-	; do \
+	for files in "$$py_files" "$$pyc_files" "$$pyo_files"; do \
 	  $(am__uninstall_files_from_dir) || st=$$?; \
 	done; \
+## This is somewhat tricky, because for newer pythons we have to take PEP-3147
+## into account.  Avoid exceeding the command-line length limit.
+	dir='$(DESTDIR)$(%NDIR%dir)/__pycache__'; \
+	echo "$$py_files" | $(am__pep3147_tweak) | $(am__base_list) | \
+	  while read files; do \
+	    $(am__uninstall_files_from_dir) || st=$$?; \
+	  done || exit $$?; \
 	exit $$st
 endif %?INSTALL%
 
-- 
2.16.1

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

Subject: ‘make uninstall’ exceeds command-line length limit
From: Mathieu Lirzin <[email-masked]>
To: [email-masked]
Date: Sat, 03 Feb 2018 15:09:59 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

"t/instmany-python.sh" test fails for the ‘uninstall’ target.  Here is
the failing part which runs a 6558 characters command:

--8<---------------cut here---------------start------------->8---
/home/mthl/src/automake/t/instmany-python.dir/x-bin/rm: safe command line limit of 2500 characters exceeded
--8<---------------cut here---------------end--------------->8---

See the attached log for more details.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37