Can't initialise vendored submodule

Dear all, I'm currently unable to build GHC's master branch as some of the submodules (presumably used by Hadrian) are making git pretty unhappy (I've used various variants of the command below, in a cleaned repository): ```console $ git submodule update --init error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal'. Retry scheduled error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal' a second time, aborting ``` Please advise on how to get unblocked. And, if I'm allowed to conclude with a plea: please be careful not to abuse Git's submodule system, it's wonky enough when used simply. -- Arnaud Spiwack Director, Research at https://moduscreate.com and https://tweag.io.

I think you want --recursive
On Fri, 2 Aug 2024, 8:05 pm Arnaud Spiwack,
Dear all,
I'm currently unable to build GHC's master branch as some of the submodules (presumably used by Hadrian) are making git pretty unhappy (I've used various variants of the command below, in a cleaned repository):
```console $ git submodule update --init error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal'. Retry scheduled error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal' a second time, aborting ```
Please advise on how to get unblocked.
And, if I'm allowed to conclude with a plea: please be careful not to abuse Git's submodule system, it's wonky enough when used simply.
-- Arnaud Spiwack Director, Research at https://moduscreate.com and https://tweag.io. _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

It seems you might have a some very old configuration from when hadrian
used to be a submodule? Perhaps a fresh clone would help things along?
The usage of submodules in `hadrian/vendored` is a standard usage.
Cheers,
Matt
On Fri, Aug 2, 2024 at 11:08 AM Vaibhav Sagar
I think you want --recursive
On Fri, 2 Aug 2024, 8:05 pm Arnaud Spiwack,
wrote: Dear all,
I'm currently unable to build GHC's master branch as some of the submodules (presumably used by Hadrian) are making git pretty unhappy (I've used various variants of the command below, in a cleaned repository):
```console $ git submodule update --init error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal'. Retry scheduled error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal' a second time, aborting ```
Please advise on how to get unblocked.
And, if I'm allowed to conclude with a plea: please be careful not to abuse Git's submodule system, it's wonky enough when used simply.
-- Arnaud Spiwack Director, Research at https://moduscreate.com and https://tweag.io. _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Thanks Matthew, this helped me find the solution. Which, is turn out, was simply to remove the old directory: $ rm -rf .git/modules/hadrian/ It's not removed by `git submodule desync` or any command that I could find (though, now that I think about it, I didn't try to garbage collect the repo, so maybe?). But it's sound to just delete, as far as I can tell: it's just a cache.
The usage of submodules in `hadrian/vendored` is a standard usage.
This goes to show that I was at least right when saying that submodules are
wonky :D .
On Fri, 2 Aug 2024 at 12:11, Matthew Pickering
It seems you might have a some very old configuration from when hadrian used to be a submodule? Perhaps a fresh clone would help things along?
The usage of submodules in `hadrian/vendored` is a standard usage.
Cheers,
Matt
On Fri, Aug 2, 2024 at 11:08 AM Vaibhav Sagar
wrote: I think you want --recursive
On Fri, 2 Aug 2024, 8:05 pm Arnaud Spiwack,
wrote: Dear all,
I'm currently unable to build GHC's master branch as some of the submodules (presumably used by Hadrian) are making git pretty unhappy (I've used various variants of the command below, in a cleaned repository):
```console $ git submodule update --init error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal'. Retry scheduled error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal' a second time, aborting ```
Please advise on how to get unblocked.
And, if I'm allowed to conclude with a plea: please be careful not to abuse Git's submodule system, it's wonky enough when used simply.
-- Arnaud Spiwack Director, Research at https://moduscreate.com and https://tweag.io. _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
-- Arnaud Spiwack Director, Research at https://moduscreate.com and https://tweag.io.

Hi,
I also frequently encounter these errors.
I think they are caused by me copying from an ancient local clone, one
that still has historic account of when hadrian used to live in its own
submodule.
Recently, the hadrian system vendored Cabal into hadrian/vendored/Cabal,
but the root repository had still listed a submodule at
.git/modules/hadrian, explaining the error.
Indeed, just removing the ancient .git/modules/hadrian is the solution.
Note that the vendored submodule means you cannot easily check out a
branch from ... 5 years (?) ago, because then you will get the reverse
error.
Fresh clones should not be affected.
Cheers,
Sebastian
------ Originalnachricht ------
Von "Arnaud Spiwack"
Thanks Matthew, this helped me find the solution.
Which, is turn out, was simply to remove the old directory:
$ rm -rf .git/modules/hadrian/
It's not removed by `git submodule desync` or any command that I could find (though, now that I think about it, I didn't try to garbage collect the repo, so maybe?). But it's sound to just delete, as far as I can tell: it's just a cache.
The usage of submodules in `hadrian/vendored` is a standard usage.
This goes to show that I was at least right when saying that submodules are wonky :D .
On Fri, 2 Aug 2024 at 12:11, Matthew Pickering
wrote: It seems you might have a some very old configuration from when hadrian used to be a submodule? Perhaps a fresh clone would help things along?
The usage of submodules in `hadrian/vendored` is a standard usage.
Cheers,
Matt
On Fri, Aug 2, 2024 at 11:08 AM Vaibhav Sagar
wrote: I think you want --recursive
On Fri, 2 Aug 2024, 8:05 pm Arnaud Spiwack,
wrote: Dear all,
I'm currently unable to build GHC's master branch as some of the submodules (presumably used by Hadrian) are making git pretty unhappy (I've used various variants of the command below, in a cleaned repository):
```console $ git submodule update --init error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal'. Retry scheduled error: submodule git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' is inside git dir '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian' fatal: refusing to create/use '/home/aspiwack/projects/tweag/ghc/master/.git/modules/hadrian/vendored/Cabal' in another submodule's git dir Failed to clone 'hadrian/vendored/Cabal' a second time, aborting ```
Please advise on how to get unblocked.
And, if I'm allowed to conclude with a plea: please be careful not to abuse Git's submodule system, it's wonky enough when used simply.
-- Arnaud Spiwack Director, Research at https://moduscreate.com and https://tweag.io. _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
-- Arnaud Spiwack Director, Research at https://moduscreate.com and https://tweag.io.
participants (4)
-
Arnaud Spiwack
-
Matthew Pickering
-
Sebastian Graf
-
Vaibhav Sagar