]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
make-dist: refuse to run if script path contains a colon 41086/head
authorNathan Cutler <ncutler@suse.com>
Tue, 6 Apr 2021 11:04:04 +0000 (13:04 +0200)
committerNathan Cutler <ncutler@suse.com>
Thu, 29 Apr 2021 16:41:52 +0000 (18:41 +0200)
Colons are not permissible in POSIX paths and their presence is known to break
the script.

Fixes: https://tracker.ceph.com/issues/39556
Signed-off-by: Nathan Cutler <ncutler@suse.com>
(cherry picked from commit cb520aa914415bea027b8dd7f4591ae5721ffec4)

make-dist

index 991c1bf90e20d67137079817661f9d98d9737c62..2e97a1a12705ab11f295e1b104b55993d4303de1 100755 (executable)
--- a/make-dist
+++ b/make-dist
@@ -1,7 +1,21 @@
 #!/bin/bash -e
 
+SCRIPTNAME="$(basename "${0}")"
+BASEDIR="$(readlink -f "$(dirname "${0}")")"
+
 if [ ! -d .git ]; then
-    echo "no .git present.  run this from the base dir of the git checkout."
+    echo "$SCRIPTNAME: Full path to the script: $BASEDIR/$SCRIPTNAME"
+    echo "$SCRIPTNAME: No .git present. Run this from the base dir of the git checkout."
+    exit 1
+fi
+
+# Running the script from a directory containing a colon anywhere in the path
+# will expose us to the dreaded "[BUG] npm run [command] failed if the directory
+# path contains colon" bug https://github.com/npm/cli/issues/633
+# (see https://tracker.ceph.com/issues/39556 for details)
+if [[ "$BASEDIR" == *:* ]] ; then
+    echo "$SCRIPTNAME: Full path to the script: $BASEDIR/$SCRIPTNAME"
+    echo "$SCRIPTNAME: The path to the script contains a colon. Their presence has been known to break the script."
     exit 1
 fi