Pádraig noticed a bug in gnulib-tool.py that I am a bit surprised I did
not notice before [1].

When using 'gnulib-tool --import --symlink', local modules would be
copied instead of symlinked. This is because if --local-symlink or
--local-hardlink were not specified, the local copy mode would default
to a normal copy.

The behavior of gnulib-tool.sh is that if --local-symlink or
--local-hardlink are not specified, the default value would be the value
of --symlink or --hardlink. If none were specified, it would use a
normal copy.

I pushed the attached patch to fix it.

Collin

[1] https://lists.gnu.org/r/coreutils/2026-03/msg00015.html

>From ddea1a41eb1843f0df47f8185dc205c2990f1750 Mon Sep 17 00:00:00 2001
Message-ID: <ddea1a41eb1843f0df47f8185dc205c2990f1750.1772778537.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Thu, 5 Mar 2026 22:22:41 -0800
Subject: [PATCH] gnulib-tool.py: Use --symlink or --hardlink for local
 modules.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reported by Pádraig Brady in
<https://lists.gnu.org/r/coreutils/2026-03/msg00015.html>.

* pygnulib/GLConfig.py (__init__): If --local-symlink or
--local-hardlink are not specified, use the value specified by --symlink
or --hardlink for local modules instead of copying.
---
 ChangeLog            | 9 +++++++++
 pygnulib/GLConfig.py | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4941dc027f..ac883e1de1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-03-05  Collin Funk  <[email protected]>
+
+	gnulib-tool.py: Use --symlink or --hardlink for local modules.
+	Reported by Pádraig Brady in
+	<https://lists.gnu.org/r/coreutils/2026-03/msg00015.html>.
+	* pygnulib/GLConfig.py (__init__): If --local-symlink or
+	--local-hardlink are not specified, use the value specified by --symlink
+	or --hardlink for local modules instead of copying.
+
 2026-03-03  Bruno Haible  <[email protected]>
 
 	Don't use 'typeof' built-in with -std=c99 or -std=c11.
diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py
index 1874e0f27b..528ff91106 100644
--- a/pygnulib/GLConfig.py
+++ b/pygnulib/GLConfig.py
@@ -209,8 +209,8 @@ def __init__(self,
         # lcopymode (--local-symlink and --local-hardlink)
         self.resetLCopyMode()
         if lcopymode == None:
-            # Default to copying.
-            lcopymode = CopyAction.Copy
+            # Default to the mode used for non-local modules.
+            lcopymode = copymode
         self.setLCopyMode(lcopymode)
         # configure_ac
         self.resetAutoconfFile()
-- 
2.53.0

Reply via email to