Subject: | Avoid invisible interactive question when rebuilding Makefile |
Under certain circumstances it is possible that using "make" apparently
hangs. It can happen if:
- the project contains subdirectories with Makefile.PLs
- at some time root created a Makefile.old in a subdirectory (this may
happen easily if "sudo make install" is used but the Makefile needs to
be recreated)
To reproduce this, grab some CPAN distribution with subdirectories, for
example "Encode" and try the following command sequence:
$ perl Makefile.PL
$ touch Byte/Makefile.old
$ sudo chown root Byte/Makefile.old
$ touch Makefile.PL
$ make
Makefile out-of-date with respect to Makefile.PL
Cleaning current config before rebuilding Makefile...
make -f Makefile.old clean > /dev/null 2>&1
At this point it hangs. To see what happens just remove the redirect to
/dev/null:
$ make DEV_NULL=
...
mv Makefile Makefile.old
mv: overwrite `Makefile.old', overriding mode 0644?
The attached patch seems to fix the problem. Note that alternatively
$(MAKEFILE_OLD) could be pushed into the @files array for removal.
Regards,
Slaven
Subject: | 0001-remove-Makefile.old-before-moving-Makefile-into-Make.patch |
From 1af04cd9a4d4c46d6895b406c5b172463aad7c9d Mon Sep 17 00:00:00 2001
From: Slaven Rezic <slaven@rezic.de>
Date: Thu, 16 Sep 2010 19:04:14 +0200
Subject: [PATCH] remove Makefile.old before moving Makefile into Makefile.old, to avoid
possible interactive questions
---
lib/ExtUtils/MM_Any.pm | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm
index cabe977..05ab6b5 100644
--- a/lib/ExtUtils/MM_Any.pm
+++ b/lib/ExtUtils/MM_Any.pm
@@ -515,6 +515,7 @@ clean :: clean_subdirs
# Leave Makefile.old around for realclean
push @m, <<'MAKE';
+ -$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
- $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
MAKE
--
1.7.0.3