On 2/24/24 4:47 PM, Collin Funk wrote: > Anyways, upon further inspection not all of the gnulib-modules are > sorted in merge-gnulib. When "unlocked-io" was added to Emacs it was > placed after "update-copyright" [1]. I assume that they are sorted > somewhere before the actioncmd step in gnulib-tool. Let me experiment > with the --avoid modules and I'll reply if I notice anything.
I think that I have confirmed this behavior by changing the order of "GNULIB_MODULES" and "AVOIDED_MODULES" in Emacs admin/merge-gnulib script. Changing GNULIB_MODULES so the first modules are ordered 1. dup2, 2. alignasof, 3. copy-file-range, 4. alloca-opt, ... and AVOIDED_MODULES so the first modules are ordered 1. chmod, 2. btowc, 3. access produces the following diff: diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 711ddcf1260..f16c018b728 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -34,9 +34,9 @@ # --no-libtool \ # --macro-prefix=gl \ # --no-vc-files \ -# --avoid=access \ -# --avoid=btowc \ # --avoid=chmod \ +# --avoid=btowc \ +# --avoid=access \ # --avoid=close \ # --avoid=crypto/af_alg \ # --avoid=dup \ So the --avoid modules are emitted in the order they are passed to gnulib-tool, but the actual modules will be alphabetically sorted. Therefore, I think the correct code would be: if len(avoids) > 0: actioncmd += ''.join([f" \\\n# --avoid={x}" for x in avoids]) if len(modules) > 0: actioncmd += ''.join([f" \\\n# {x}" for x in sorted(modules)]) Seems sort of strange but it produces the correct output for that test. Collin