Subject: bug#59064: closed (Re: bug#59064: 29.0.50; build problem git worktree linked to main worktree (repo))

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 07 Nov 2022 17:25:02 +0000

Your bug report

#59064: 29.0.50; build problem git worktree linked to main worktree (repo)

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
59064: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59064
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#59064: 29.0.50; build problem git worktree linked to main worktree (repo)
From: Matt Armstrong <[email-masked]>
To: Philip Kaludercic <[email-masked]>, Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 07 Nov 2022 09:24:04 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Philip Kaludercic <[email-masked]> writes:

>> Then please go ahead and revert it.
>
> Done.

Thanks Philip, I've confirmed that your commit
8fe62b2ab571ba313587e8543006eca03ff36025 on Sun Nov 6 22:18:24 2022
+0100 fixed this issue.

Subject: 29.0.50; build problem git worktree linked to main worktree (repo)
From: Gregor Zattler <[email-masked]>
To: [email-masked]
Date: Sun, 06 Nov 2022 00:11:09 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Dear Emacs developers,

building Emacs from sources in a detached linked worktree[1]
linked to a main worktree[1] fails, because necessary
-by.el, -wy.el files are not generated as described in
admin/grammars/Makefile for targets `bovine` and `wisent`.
Instead while these files are generated error messages "Args
out of range: "master", 0, 7" are shown and the respective
files are not generated.

Why this is the case, I have no clue.  The respective code
for generating these files is way above my skills.

But I found out that building instead from sources in a
linked worktree linked to a bare repository[1] works as
expected.

This is what I will do from now on, therefore the
aforementioned failure is no problem for me any more.

If there is a bug in the Emacs build system regarding linked
worktrees linked to main worktrees, though, is up to you.

In order to rule out any misconfiguration on my side, I
installed Emacs build dependencies on a minimal installation
of Debian/bullseye, cloned the emacs git repo with a freshly
created and otherwise unconfigured user.  To trigger the
build process this user then issued only "make V=1 -j 1" to
get the most default build process.  All tests were made
with freshly cloned repos respectively freshly generated git
worktrees created from those pristine git repos.

The difference between a linked worktree and its main
worktree is in the .git directory only, as this diff shows:
$ diff -aNurx.git/* emacs2 emacs2-worktree
File emacs2/.git is a directory while file emacs2-worktree/.git is a regular file

While investigating, I learned that the build process embeds
the repository revision into the Emacs binary.  This is the
case if Emacs is build in a linked worktree linked to a bare
repository, as the template from emacs-report-bug shows.

In case of the linked worktree linked to the main worktree
the build process does *not* fail if one removes the .git
file before.  This destroy the link to the repo, though and
the repository version is not embedded in the
resulting binary accordingly.

Why the existence of the .git file disturbs the production
of the grammar files, I have no clue.

If you have further specific questions, I'm happy to help as
far as my very limited knowledge allows.

Thanks for your attention, Gregor

P.S.: This started with a message on help-gnu-emacs:
https://lists.gnu.org/archive/html/help-gnu-emacs/2022-10/msg00860.html
and helpful answers by Eli:
https://lists.gnu.org/archive/html/help-gnu-emacs/2022-11/msg00002.html
and following messages.

[1] In git parlance a
    - "linked worktree" has no .git directory, but a .git
      *file* which's contents points to either a
      - "main worktree" which contains the .git directory,
        (is a git repo with a checked out worktree of its
        own), or a
      - bare repository, which basically is a directory
        containing the contents of a .git dir but without a
        checked out worktree.