Hello, wow, thanks for your efforts... I was able to reproduce the same issue 
on Arch Linux, going to try Debian too, maybe the issue is with Gentoo and Arch 
and not in grub.

Experiment with /tmp/grub.faked revealed nothing extraordinary:

renergy ~ # mkdir /tmp/grub.faked
renergy ~ # cp /usr/share/locale/en\@cyrillic/LC_MESSAGES/grub.mo 
/tmp/grub.faked/en\@cyrillic.mo
renergy ~ # ls -l /tmp/grub.faked/
total 176
-rw-r--r-- 1 root root 177539 May 24 16:38 e...@cyrillic.mo
renergy ~ #

Yeah, the files look like some sort of backup. And, besides /boot/grub/locale, 
there are no files with '~' in its name on the .iso I created on Gentoo.

Thanks again, going to try Debian.

Adam

On 5/24/25 4:25 PM, Thomas Schmitt wrote:
Hi,

just in case it was not clear from my first reply:
I cannot reproduce the problem on Debian 12 with GRUB 2.06 and 2.13.


Adam Purkrt wrote:
Hi, no, actually there is not any occurrence of the string "mo~" in
the output
renergy ~ # grub-mkrescue --verbose -o grub.iso 2>&1 | grep mo~
renergy ~ #

Well, then it has to be doubted that the grub-install functions
underneath grub-mkrescue copied files to paths like
   /tmp/grub.GoPPTa/e...@cyrillic.mo~

As "Banana" stated in https://forums.gentoo.org/viewtopic-p-8862390.html
the names look like what some softwares create as backup files.
But the /tmp/grub.* directory gets freshly created by grub-mkrescue.
What software could see the need to make backup copies of the files
which get copied into that directory ?


Questions:

Do any other files in your ISO show the suffix '~' ?

What happens if you create a directory in /tmp and copy a .mo file
to it ?
Like
   mkdir /tmp/grub.faked
   cp /usr/share/locale/en@cyrillic/LC_MESSAGES/grub.mo 
/tmp/grub.faked/e...@cyrillic.mo
Does a copy with .mo~ appear ?


-----------------------------------------------------------------------

The only other idea is to step through the file creation in the
temporary directory and to watch when the '.mo~' files appear.
This stepping could be done by gdb (although i don't know how to get
a grub-mkrescue with debugging symbols).
In this example i use grub-mkrescue 2.13 from git. The 2.06 binary
from Debian does not know the function name "copy_locales".
Hopefully your 2.12 will be much like my 2.13.

   $ mkdir minimal
   $ touch /minmal/file.txt
   $ gdb ./grub-mkrescue
   ...
   (No debugging symbols found in 
/home/thomas/projekte/grub_dir/grub-git/grub-mkrescue)
   (gdb) b copy_locales
   Breakpoint 1 at 0x10902
   (gdb) b grub_install_copy_file
   Breakpoint 2 at 0xec14
   (gdb) r --verbose -d /usr/lib/grub/x86_64-efi 
--locale-directory=/usr/share/locale -o output.iso minimal
   ...
   ./grub-mkrescue: info: temporary iso9660 dir is `/tmp/grub.CHwoVy'.

   Breakpoint 1, 0x0000555555564902 in copy_locales ()
   (gdb) c
   Continuing.

   Breakpoint 2, 0x0000555555562c14 in grub_install_copy_file ()
   (gdb) (gdb) c
   Continuing.
   ./grub-mkrescue: info: copying `/usr/share/locale/fi/LC_MESSAGES/grub.mo' -> 
`/tmp/grub.CHwoVy/boot/grub/locale/fi.mo'.

   Breakpoint 2, 0x0000555555562c14 in grub_install_copy_file ()
   (gdb)

Now i check in another terminal what's going on in /tmp
$ ls -a /tmp/grub.CHwoVy/boot/grub/locale
   .  ..  fi.mo
   $

Back to the gdb terminal:

   (gdb) c
   Continuing.
   ./grub-mkrescue: info: copying `/usr/share/locale/en@greek/LC_MESSAGES/grub.mo' 
-> `/tmp/grub.CHwoVy/boot/grub/locale/e...@greek.mo'.

   Breakpoint 2, 0x0000555555562c14 in grub_install_copy_file ()
   (gdb) c
   Continuing.
   ./grub-mkrescue: info: copying `/usr/share/locale/en_AU/LC_MESSAGES/grub.mo' 
-> `/tmp/grub.CHwoVy/boot/grub/locale/en_AU.mo'.
   ./grub-mkrescue: info: cannot open 
`/usr/share/locale/en_AU/LC_MESSAGES/grub.mo': No such file or directory.

   Breakpoint 2, 0x0000555555562c14 in grub_install_copy_file ()
   (gdb)

In the other terminal:

   $ ls -a /tmp/grub.CHwoVy/boot/grub/locale
   .  ..  e...@greek.mo  fi.mo
   $

The list of .mo files is growing but no .mo~ shows up.
Hampered by the lack of debug symbols i set a breakpoint to function
copy_by_ext() where i hope to catch execution after copy_locales()
and grub_install_copy_nls() are done, because of this code in
grub_install_copy_files():

   grub_install_copy_nls(src, dst);

   if (install_modules.is_default)
     copy_by_ext (src, dst_platform, ".mod", 1);
   else

So i do:

   (gdb) b copy_by_ext
   Breakpoint 3 at 0x55555556460a
   (gdb) del 2
   (gdb) c
   ... lots of copy messages ...
   Breakpoint 3, 0x000055555556460a in copy_by_ext ()
   (gdb)

Now /tmp/grub.CHwoVy/boot/grub/locale is well filled with .mo files.
But no .mo~ is to see.

I let grub-mkrescue run to the end without further breaks:

   (del) del 3
   (gdb) c
   ...
   Writing to 'stdio:output.iso' completed successfully.

   [Inferior 1 (process 1830) exited normally]
   (gdb) q
   $

In the other terminal:

   $ sudo mount output.iso /mnt/iso
   mount: /mnt/iso: WARNING: source write-protected, mounted read-only.
   $ ls -a /mnt/iso/boot/grub/locale

shows 41 .mo files (plus . and ..) but no .mo~.


Have a nice day :)

Thomas



Reply via email to