qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dinah Baum <dinahbaum123@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, "Dinah Baum" <dinahbaum123@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>
Subject: [PATCH] configure: Add 'mkdir build' check
Date: Sun,  5 Feb 2023 00:26:36 -0500	[thread overview]
Message-ID: <20230205052636.11822-1-dinahbaum123@gmail.com> (raw)

QEMU configure script goes into an infinite error printing loop
when in read only directory due to 'build' dir never being created.

Checking if 'mkdir dir' succeeds and if the directory is
writeable prevents this error.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/321

Signed-off-by: Dinah Baum <dinahbaum123@gmail.com>
---
 configure | 37 ++++++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 64960c6000..fe9028991f 100755
--- a/configure
+++ b/configure
@@ -32,9 +32,11 @@ then
     fi
 
     mkdir build
-    touch $MARKER
+    if [ -d build ] && [ -w build ]
+    then
+        touch $MARKER
 
-    cat > GNUmakefile <<'EOF'
+        cat > GNUmakefile <<'EOF'
 # This file is auto-generated by configure to support in-source tree
 # 'make' command invocation
 
@@ -56,8 +58,15 @@ force: ;
 GNUmakefile: ;
 
 EOF
-    cd build
-    exec "$source_path/configure" "$@"
+        cd build
+        exec "$source_path/configure" "$@"
+    elif ! [ -d build ]
+    then
+        echo "ERROR: Unable to create ./build dir, try using a ../qemu/configure build"
+    elif ! [ -w build ]
+    then
+        echo "ERROR: ./build dir not writeable, try using a ../qemu/configure build"
+    fi
 fi
 
 # Temporary directory used for files created while
@@ -181,9 +190,12 @@ compile_prog() {
 
 # symbolically link $1 to $2.  Portable version of "ln -sf".
 symlink() {
-  rm -rf "$2"
-  mkdir -p "$(dirname "$2")"
-  ln -s "$1" "$2"
+  if [ -d $source_path/build ] && [ -w $source_path/build ]
+  then
+      rm -rf "$2"
+      mkdir -p "$(dirname "$2")"
+      ln -s "$1" "$2"
+  fi
 }
 
 # check whether a command is available to this shell (may be either an
@@ -2287,7 +2299,18 @@ fi
 #######################################
 # generate config-host.mak
 
+if ! [ -d $source_path/build ] || ! [ -w $source_path/build ]
+then
+    echo "ERROR: ./build dir unusable, exiting"
+    # cleanup
+    rm -f config.log
+    rm -f Makefile.prereqs
+    rm -r "$TMPDIR1"
+    exit 1
+fi
+
 if ! (GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
+    echo "BAD"
     exit 1
 fi
 
-- 
2.30.2



             reply	other threads:[~2023-02-05  7:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-05  5:26 Dinah Baum [this message]
2023-02-06 14:42 ` [PATCH] configure: Add 'mkdir build' check Peter Maydell
2023-02-07  3:34   ` Dinah B

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230205052636.11822-1-dinahbaum123@gmail.com \
    --to=dinahbaum123@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).