lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master c660123 1/2: Avoid 'sh: 0: getcwd() failed'


From: Greg Chicares
Subject: [lmi-commits] [lmi] master c660123 1/2: Avoid 'sh: 0: getcwd() failed'
Date: Tue, 10 Nov 2020 11:51:05 -0500 (EST)

branch: master
commit c660123d245e02c7f29773269e15f826c7bdb120
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Avoid 'sh: 0: getcwd() failed'
---
 GNUmakefile | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/GNUmakefile b/GNUmakefile
index c9ee8cf..d3d169e 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -414,9 +414,18 @@ eviscerate: source_clean
        -$(RM) --force --recursive $(prefix)/gcc_x86_64-w64-mingw32
        -$(RM) --force --recursive $(prefix)/gcc_x86_64-pc-linux-gnu
 
+# A simple '$(RM) --force --recursive $(bindir)' would remove the
+# directory as well as its contents. However, if $(bindir) is the
+# current working directory in another terminal, hilarity ensues:
+#   sh: 0: getcwd() failed: No such file or directory
+# While '-delete' is not POSIX, it's supported by GNU coreutils and
+# {Open,Free}BSD. The command might instead have been written thus:
+#   find $(bindir) -type f -print0 | xargs -0 rm -rf
+# but '-print0' isn't POSIX either.
+
 .PHONY: uninstall
 uninstall:
-       -$(RM) --force --recursive $(bindir)
+       -find $(bindir) -type f -delete
 
 
################################################################################
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]