GNU bug report logs - #67240
dev: “make” of Guix fails, non-existent .git/hooks directory

Previous Next

Package: guix;

Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>

Date: Fri, 17 Nov 2023 16:13:01 UTC

Severity: normal

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67240 in the body.
You can then email your comments to 67240 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#67240; Package guix. (Fri, 17 Nov 2023 16:13:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon Tournier <zimon.toutoune <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 17 Nov 2023 16:13:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: bug-guix <at> gnu.org
Subject: dev: “make” of Guix fails, non-existent
 .git/hooks directory
Date: Fri, 17 Nov 2023 16:46:59 +0100
[Message part 1 (text/plain, inline)]
Hi,

On a very fresh install of a system, I have just cloned the Guix
repository then run the dance ./bootstrap, ./configure and make.  It
fails because:

--8<---------------cut here---------------start------------->8---
cp: cannot create regular file '.git/hooks/pre-push': No such file or directory
make[2]: *** [Makefile:7454: .git/hooks/pre-push] Error 1
make[2]: Leaving directory '/home/simon/src/guix/guix'
make[1]: *** [Makefile:6137: all-recursive] Error 1
make[1]: Leaving directory '/home/simon/src/guix/guix'
make: *** [Makefile:4253: all] Error 2
--8<---------------cut here---------------end--------------->8---

In the file Makefile.am, nothing check that the directory .git/hooks
exists before copying to it.  By default, it does not seem created.  At
least, it was not with a fresh clone using Git from Guix revision
fc6bdaa.

I propose this patch attached.

[p.patch (text/x-diff, inline)]
diff --git a/Makefile.am b/Makefile.am
index cbc3191dfc..6e9a22fae5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1170,6 +1170,7 @@ cuirass-jobs: $(GOBJECTS)
 # Git auto-configuration.
 .git/hooks/pre-push: etc/git/pre-push
 	$(AM_V_at)if test -d .git; then \
+	mkdir -p .git/hooks; \
 	cp etc/git/pre-push .git/hooks/pre-push; \
 	fi
 
[Message part 3 (text/plain, inline)]
Cheers,
simon

Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Tue, 12 Nov 2024 07:08:02 GMT) Full text and rfc822 format available.

Notification sent to Simon Tournier <zimon.toutoune <at> gmail.com>:
bug acknowledged by developer. (Tue, 12 Nov 2024 07:08:02 GMT) Full text and rfc822 format available.

Message #10 received at 67240-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: 67240-done <at> debbugs.gnu.org
Subject: Re: bug#67240: dev: “make” of Guix fails,
 non-existent .git/hooks directory
Date: Tue, 12 Nov 2024 16:06:21 +0900
Hi,

Simon Tournier <zimon.toutoune <at> gmail.com> writes:

> Hi,
>
> On a very fresh install of a system, I have just cloned the Guix
> repository then run the dance ./bootstrap, ./configure and make.  It
> fails because:
>
> cp: cannot create regular file '.git/hooks/pre-push': No such file or directory
> make[2]: *** [Makefile:7454: .git/hooks/pre-push] Error 1
> make[2]: Leaving directory '/home/simon/src/guix/guix'
> make[1]: *** [Makefile:6137: all-recursive] Error 1
> make[1]: Leaving directory '/home/simon/src/guix/guix'
> make: *** [Makefile:4253: all] Error 2
>
> In the file Makefile.am, nothing check that the directory .git/hooks
> exists before copying to it.  By default, it does not seem created.  At
> least, it was not with a fresh clone using Git from Guix revision
> fc6bdaa.

It should, according to [0]:

"When you initialize a new repository with git init, Git populates the
hooks directory with a bunch of example scripts, many of which are
useful by themselves [...]"

I believe 'git clone' calls 'git init' under the hood.

[0] https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks.html

It also appears to do that, even using the older Guix commit you
provided:

$ guix time-machine -q --commit=fc6bdaa -- shell --pure git nss-certs \
  -- git clone https://git.savannah.gnu.org/git/guix.git /tmp/guix
$ ls /tmp/guix/.git/
branches/  config  description	HEAD  hooks/  index  info/  logs/  objects/  packed-refs  refs/

As you can see; the 'hooks' directory is there.

> I propose this patch attached.
>
> diff --git a/Makefile.am b/Makefile.am
> index cbc3191dfc..6e9a22fae5 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1170,6 +1170,7 @@ cuirass-jobs: $(GOBJECTS)
>  # Git auto-configuration.
>  .git/hooks/pre-push: etc/git/pre-push
>  	$(AM_V_at)if test -d .git; then \
> +	mkdir -p .git/hooks; \
>  	cp etc/git/pre-push .git/hooks/pre-push; \
>  	fi

If you could come up with a reproducer, I don't mind applying such a
change, but so far it seems unnecessary?

I'm tentatively closing this old report.

-- 
Thanks,
Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#67240; Package guix. (Tue, 12 Nov 2024 19:25:02 GMT) Full text and rfc822 format available.

Message #13 received at 67240-done <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 67240-done <at> debbugs.gnu.org
Subject: Re: bug#67240: dev: “make” of Guix fails,
 non-existent .git/hooks directory
Date: Tue, 12 Nov 2024 20:20:18 +0100
Hi,

On Tue, 12 Nov 2024 at 16:06, Maxim Cournoyer <maxim.cournoyer <at> gmail.com> wrote:

>> cp: cannot create regular file '.git/hooks/pre-push': No such file or directory
>> make[2]: *** [Makefile:7454: .git/hooks/pre-push] Error 1
>> make[2]: Leaving directory '/home/simon/src/guix/guix'
>> make[1]: *** [Makefile:6137: all-recursive] Error 1
>> make[1]: Leaving directory '/home/simon/src/guix/guix'
>> make: *** [Makefile:4253: all] Error 2

[...]

>> +	mkdir -p .git/hooks; \
>>  	cp etc/git/pre-push .git/hooks/pre-push; \
>
> If you could come up with a reproducer, I don't mind applying such a
> change, but so far it seems unnecessary?

Bah I barely clone. ;-)

Well, I am not able to reproduce too.  Maybe an issue with a clone that
had been completed at once.  Anyway.

In all, I think it’s always a good idea to check if the folder
destination exists before copying.  It costs almost nothing and it
avoids spurious annoyances, as initially reported.

Cheers,
simon




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 11 Dec 2024 12:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 151 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.