GNU bug report logs - #60538
[PATCH] rm: convert more cases to am__rm_f

Previous Next

Package: automake-patches;

Reported by: Mike Frysinger <vapier <at> gentoo.org>

Date: Wed, 4 Jan 2023 03:38:02 UTC

Severity: normal

Tags: patch

Done: Mike Frysinger <vapier <at> gentoo.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60538 in the body.
You can then email your comments to 60538 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to automake-patches <at> gnu.org:
bug#60538; Package automake-patches. (Wed, 04 Jan 2023 03:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mike Frysinger <vapier <at> gentoo.org>:
New bug report received and forwarded. Copy sent to automake-patches <at> gnu.org. (Wed, 04 Jan 2023 03:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mike Frysinger <vapier <at> gentoo.org>
To: automake-patches <at> gnu.org
Subject: [PATCH] rm: convert more cases to am__rm_f
Date: Tue,  3 Jan 2023 22:37:12 -0500
Fixes automake bug https://bugs.gnu.org/10828.

Clean up a few more cases where we were doing `test ... || rm ...` to
avoid calling `rm -f` without arguments by leveraging am__rm_f.  These
were harder to find in the source due to their constructed nature.

The clean programs rules in particular were much more complicated than
they needed to be.  This logic boiled down to two things: delete the
list of programs, and then delete the list without the exeext suffix,
but only if the list of programs is non-empty.

The check-TESTS rule was converted to am__rm_f, but a simplification
was missed where the $list variable is inlined.

* bin/automake.in: Delete test -z logic and always call am__rm_f.
* contrib/check-html.am: Use $(am__rm_f) helper.
* doc/automake.texi: Update examples to match current behavior.
* lib/am/check.am: Inline $list variable.
* lib/am/progs.am: Rewrite rule to use $(am__rm_f).
---
 bin/automake.in       | 7 +------
 contrib/check-html.am | 3 +--
 doc/automake.texi     | 6 +++---
 lib/am/check.am       | 4 ++--
 lib/am/progs.am       | 9 ++-------
 5 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/bin/automake.in b/bin/automake.in
index c094234bcdad..9b0b52977723 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -4733,12 +4733,7 @@ sub handle_clean
       prog_error 'invalid entry in %clean_files'
 	unless exists $rms{$when};
 
-      my $rm = "rm -f $file";
-      # If file is a variable, make sure when don't call 'rm -f' without args.
-      $rm ="test -z \"$file\" || $rm"
-	if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/);
-
-      push @{$rms{$when}}, "\t-$rm\n";
+      push @{$rms{$when}}, "\t-\$(am__rm_f) $file\n";
     }
 
   $output_rules .= file_contents
diff --git a/contrib/check-html.am b/contrib/check-html.am
index 56a2ccbff1f9..6764f9aabd83 100644
--- a/contrib/check-html.am
+++ b/contrib/check-html.am
@@ -24,8 +24,7 @@ TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)
 mostlyclean-local: mostlyclean-check-html
 .PHONY: mostlyclean-check-html
 mostlyclean-check-html:
-## Expand $(TEST_LOGS) only once, to avoid exceeding line length limits.
-	list='$(TEST_LOGS:.log=.html)'; test -z "$$list" || rm -f $$list
+	$(am__rm_f) $(TEST_LOGS:.log=.html)
 	rm -f $(TEST_SUITE_HTML)
 
 .log.html:
diff --git a/doc/automake.texi b/doc/automake.texi
index 48744e24f3e5..f3b7b86b986e 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -7527,8 +7527,8 @@ if you try to run @samp{make foo} explicitly:
 
 @example
 % make clean
-test -z "bindir.h" || rm -f bindir.h
-test -z "foo" || rm -f foo
+rm -f bindir.h
+rm -f foo
 rm -f *.o
 % : > .deps/foo.Po # Suppress previously recorded dependencies
 % make foo
@@ -11316,7 +11316,7 @@ gcc -Wall -o foo main.o func.o
 
 @i{Clean up, so that we can rebuild everything from scratch.}
 % @kbd{make clean}
-test -z "foo" || rm -f foo
+rm -f foo
 rm -f *.o
 
 @i{Silent rules enabled: the output is minimal but informative.  In
diff --git a/lib/am/check.am b/lib/am/check.am
index 6648c011d721..444670db0e7d 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -405,8 +405,8 @@ RECHECK_LOGS = $(TEST_LOGS)
 ## ------------------------------------------ ##
 
 check-TESTS: %CHECK_DEPS%
-	@list='$(RECHECK_LOGS)';           $(am__rm_f) $$list
-	@list='$(RECHECK_LOGS:.log=.trs)'; $(am__rm_f) $$list
+	@$(am__rm_f) $(RECHECK_LOGS)
+	@$(am__rm_f) $(RECHECK_LOGS:.log=.trs)
 ## We always have to remove $(TEST_SUITE_LOG), to ensure its rule is run
 ## in any case even in lazy mode: otherwise, if no test needs rerunning,
 ## or a prior run plus reruns all happen within the same timestamp (can
diff --git a/lib/am/progs.am b/lib/am/progs.am
index 753886a31580..0151c263a2b8 100644
--- a/lib/am/progs.am
+++ b/lib/am/progs.am
@@ -114,13 +114,8 @@ clean-%DIR%PROGRAMS:
 ## Cleaning the '_libs/' or '.libs/' directory is done from clean-libtool.
 ## FIXME: In the future (i.e., when it works) it would be nice to delegate
 ## this task to "libtool --mode=clean".
-?LIBTOOL?	@list='$(%DIR%_PROGRAMS)'; test -n "$$list" || exit 0; \
-?LIBTOOL?	echo " rm -f" $$list; \
-?LIBTOOL?	rm -f $$list || exit $$?; \
-?LIBTOOL?	test -n "$(EXEEXT)" || exit 0; \
-?LIBTOOL?	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
-?LIBTOOL?	echo " rm -f" $$list; \
-?LIBTOOL?	rm -f $$list
+?LIBTOOL?	$(am__rm_f) $(%DIR%_PROGRAMS)
+?LIBTOOL?	test -z "$(EXEEXT)" || $(am__rm_f) $(%DIR%_PROGRAMS:$(EXEEXT)=)
 
 
 ## ---------- ##
-- 
2.39.0





Information forwarded to automake-patches <at> gnu.org:
bug#60538; Package automake-patches. (Sun, 08 Jan 2023 16:29:02 GMT) Full text and rfc822 format available.

Message #8 received at 60538 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: vapier <at> gentoo.org
Cc: 60538 <at> debbugs.gnu.org
Subject: Re: [bug#60538] [PATCH] rm: convert more cases to am__rm_f
Date: Sun, 8 Jan 2023 09:28:06 -0700
    Fixes automake bug https://bugs.gnu.org/10828.

Hi Mike - this change looks good to me. Good catches finding these.
Please commit. --thanks, karl.




bug closed, send any further explanations to 60538 <at> debbugs.gnu.org and Mike Frysinger <vapier <at> gentoo.org> Request was from Mike Frysinger <vapier <at> gentoo.org> to control <at> debbugs.gnu.org. (Mon, 09 Jan 2023 05:21:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 06 Feb 2023 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 52 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.