On 3/11/24 2:46 AM, Collin Funk wrote:
> So I think it is safe to say the problem occurs somewhere around
> there... All of those modules are Coreutils --local-dir modules. Then
> dynamic typing things happen.

I just started looking into this issue a bit more. With a clean
Coreutils directory, I get the same issue as Simon.

I think I have found where this issue occurs. Here is the output with
a few print statements that I have added to show the issue.

$ gnulib-tool.py --add-import
Module list with included dependencies (indented):
File list:
  lib/dummy.c
  m4/00gnulib.m4
  m4/gnulib-common.m4
  m4/zzgnulib.m4
self.config['tempdir']: /tmp/tmpnxeke9x1
lookedup:               /home/collin/.local/src/gnulib/lib/dummy.c
tmpfile:                /dummy.c.tmp
/home/collin/.local/src/gnulib/gnulib-tool.py: *** could not create file 
/home/collin/.local/src/gnulib/lib/dummy.c
/home/collin/.local/src/gnulib/gnulib-tool.py: *** Stop.

As shown by the extra print statements I added, it seems that the
temporary files are written to the root directory of my file system
instead of the temporary directory.

I have to look into it a bit more, but it seems that
GLFileSystem.add_or_update calls GLFileSystem.tmpfilename which
mangles the file name. I'm not sure if the issue is
GLFileSystem.tmpfilename or joinpath.

Here is a small diff just showing the print statements I added.

diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py
index f60e3fc6ea..8b4d608f51 100644
--- a/pygnulib/GLFileSystem.py
+++ b/pygnulib/GLFileSystem.py
@@ -347,6 +347,9 @@ class GLFileAssistant(object):
         try:  # Try to copy lookedup file to tmpfile
             copyfile(lookedup, tmpfile)
         except Exception as error:
+            print(f'self.config[\'tempdir\']: {self.config["tempdir"]}')
+            print(f'lookedup:               {lookedup}')
+            print(f'tmpfile:                {tmpfile}')
             raise GLError(15, lookedup)
         # Don't process binary files with sed.
         if not (original.endswith(".class") or original.endswith(".mo")):

Collin

Reply via email to