On 5/14/24 7:54 AM, Paul Eggert wrote:
> I am still falling back on the shell implementation when I discover
> gnulib-tool.py bugs or issues, and that's still happening to me (as recently
> as yesterday). So Collin, if it's not too much trouble, please update
> gnulib-tool.sh for this mkdir issue. (I'll do it if you don't have the time.)
> Thanks.
Sorry, it took me a bit to get around to this. I've committed the
attached patch.
Collin
From b2666d326a53dd24e2fc832e0c85b351d25fd0ee Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Tue, 14 May 2024 23:21:00 -0700
Subject: [PATCH] gnulib-tool.sh: Don't continue creating testdirs when destdir
exists.
* gnulib-tool.sh (create-testdir, create-megatestdir): Fail if the
destination directory exists instead of creating files and failing to
patch test driver.
---
ChangeLog | 7 +++++++
gnulib-tool.sh | 6 ++++++
2 files changed, 13 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 23b489054d..e0c6141e88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-05-14 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.sh: Don't continue creating testdirs when destdir exists.
+ * gnulib-tool.sh (create-testdir, create-megatestdir): Fail if the
+ destination directory exists instead of creating files and failing to
+ patch test driver.
+
2024-05-14 Paul Eggert <egg...@cs.ucla.edu>
stdbit: fix dependency
diff --git a/gnulib-tool.sh b/gnulib-tool.sh
index b5aadcaeaa..12f0b82461 100755
--- a/gnulib-tool.sh
+++ b/gnulib-tool.sh
@@ -7454,6 +7454,9 @@ s/\([.*$]\)/[\1]/g'
if test -z "$destdir"; then
func_fatal_error "please specify --dir option"
fi
+ if test -d "$destdir"; then
+ func_fatal_error "not overwriting destination directory: $destdir"
+ fi
mkdir "$destdir"
test -d "$destdir" \
|| func_fatal_error "could not create destination directory"
@@ -7465,6 +7468,9 @@ s/\([.*$]\)/[\1]/g'
if test -z "$destdir"; then
func_fatal_error "please specify --dir option"
fi
+ if test -d "$destdir"; then
+ func_fatal_error "not overwriting destination directory: $destdir"
+ fi
mkdir "$destdir" || func_fatal_error "could not create destination directory"
test -n "$auxdir" || auxdir="build-aux"
func_create_megatestdir "$destdir" "$*"
--
2.45.0