git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: BUG: refs.c:1933: reference backend is unknown

From
René Scharfe <l.s.r@web.de>
Date
Sep 21, 2024, 21:22 UTC
Message-ID
<9bf5c254-4d87-4f6f-b278-d9df4d7897b5@web.de>
In-Reply-To
<9fdb9561bb0ad85e55ca3253cc4db9b098641e30@rjp.ie>
Am 21.09.24 um 20:06 schrieb Ronan Pigott:
Show 31 quoted lines
>
> The abort is reproducible exactly as written for me, but upon further
> examination it may depend on my config. Here is a minimal reproducer:
>
>   $ GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null git --git-dir=notexist -c 'includeif.onbranch:test/**.path=/dev/null' archive
>
>> bt
> #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
> #1  0x00007ffff7d78463 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
> #2  0x00007ffff7d1f120 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
> #3  0x00007ffff7d064c3 in __GI_abort () at abort.c:79
> #4  0x000055555585385a in BUG_vfl (file=<optimized out>, line=<optimized out>, fmt=0x555555905baf "reference backend is unknown", params=0x7fffffffd120) at /usr/src/debug/git/git-2.46.1/usage.c:317
> #5  BUG_fl (file=<optimized out>, line=<optimized out>, fmt=0x555555905baf "reference backend is unknown") at /usr/src/debug/git/git-2.46.1/usage.c:334
> #6  0x00005555557ca9d2 in ref_store_init (repo=<optimized out>, format=<optimized out>, gitdir=<optimized out>, flags=<optimized out>) at /usr/src/debug/git/git-2.46.1/refs.c:1933
> #7  ref_store_init (repo=0x5555559759a0 <the_repo.lto_priv>, format=<optimized out>, gitdir=<optimized out>, flags=15) at /usr/src/debug/git/git-2.46.1/refs.c:1923
> #8  get_main_ref_store (r=0x5555559759a0 <the_repo.lto_priv>) at /usr/src/debug/git/git-2.46.1/refs.c:1953
> #9  0x00005555556dcdf6 in include_by_branch (cond=0x55555599f503 "test/**.path", cond_len=7) at /usr/src/debug/git/git-2.46.1/config.c:309
> #10 include_condition_is_true (kvi=<optimized out>, inc=0x7fffffffd460, cond=0x55555599f503 "test/**.path", cond_len=7) at /usr/src/debug/git/git-2.46.1/config.c:409
> #11 git_config_include (var=var@entry=0x55555599f4f0 "includeif.onbranch:test/**.path", value=value@entry=0x55555599fa62 "/dev/null", ctx=ctx@entry=0x7fffffffd368, data=data@entry=0x7fffffffd460) at /usr/src/debug/git/git-2.46.1/config.c:439
> #12 0x00005555556d8753 in config_parse_pair (key=<optimized out>, value=0x55555599fa62 "/dev/null", kvi=kvi@entry=0x7fffffffd4a0, fn=fn@entry=0x5555556dcad0 <git_config_include>, data=data@entry=0x7fffffffd460) at /usr/src/debug/git/git-2.46.1/config.c:617
> #13 0x00005555556dc437 in parse_config_env_list (env=0x55555599fa40 "includeif.onbranch:test/**.path", kvi=0x7fffffffd4a0, fn=0x5555556dcad0 <git_config_include>, data=0x7fffffffd460) at /usr/src/debug/git/git-2.46.1/config.c:700
> #14 git_config_from_parameters (fn=0x5555556dcad0 <git_config_include>, data=0x7fffffffd460) at /usr/src/debug/git/git-2.46.1/config.c:773
> #15 do_git_config_sequence (opts=0x7fffffffd4b0, repo=0x0, fn=0x5555556dcad0 <git_config_include>, data=0x7fffffffd460) at /usr/src/debug/git/git-2.46.1/config.c:2131
> #16 config_with_options (fn=0x5555556dcad0 <git_config_include>, fn@entry=0x555555790940 <pager_command_config>, data=0x7fffffffd460, data@entry=0x7fffffffd7a0, config_source=config_source@entry=0x0, repo=repo@entry=0x0, opts=opts@entry=0x7fffffffd660) at /usr/src/debug/git/git-2.46.1/config.c:2174
> #17 0x00005555556dd110 in read_early_config (cb=0x555555790940 <pager_command_config>, data=0x7fffffffd7a0) at /usr/src/debug/git/git-2.46.1/config.c:2229
> #18 0x000055555555ea58 in check_pager_config (cmd=<optimized out>) at /usr/src/debug/git/git-2.46.1/pager.c:261
> #19 run_builtin (p=0x555555966a00 <commands.lto_priv+96>, argc=1, argv=0x7fffffffdd78) at /usr/src/debug/git/git-2.46.1/git.c:461
> #20 handle_builtin (argc=1, argv=0x7fffffffdd78) at /usr/src/debug/git/git-2.46.1/git.c:732
> #21 0x000055555555eaf9 in run_argv (argcp=0x7fffffffdb0c, argv=0x7fffffffdb30) at /usr/src/debug/git/git-2.46.1/git.c:796
> #22 0x00005555555597eb in cmd_main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/git/git-2.46.1/git.c:931
> #23 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/git/git-2.46.1/common-main.c:64

Thanks, that helps. The BUG occurs during setup, before any command-specific code is executed. Affects other commands with the option RUN_SETUP_GENTLY as well, e.g. git grep.

Bisects to 173761e21b (setup: start tracking ref storage format, 2023-12-29, copying Patrick.

I wonder if the BUG at refs.c:1933 should just be turned into a die(). Or should ref_store_init() return NULL (or some other value indicating an error) and all callers need to be changed to deal with that?

Simply checking whether --git-dir points to an actual repo earlier is tempting, but would leave the case of it disappearing after the check unhandled.

René
Previous: Ronan PigottNext: shejialuo
Message 4 of 13 in “BUG: refs.c:1933: reference backend is unknown”
  1. Ronan PigottSep 20, 2024
  2. shejialuoSep 21, 2024
  3. Ronan PigottSep 21, 2024
  4. René ScharfeSep 21, 2024
  5. shejialuoSep 22, 2024
  6. shejialuoSep 22, 2024
  7. 0/2 config: fix evaluating "onbranch" with nonexistent git dirPatrick Steinhardt, Sep 24, 2024
  8. 1/2 t1305: exercise edge cases of "onbranch" includesPatrick Steinhardt, Sep 24, 2024
  9. Junio C HamanoSep 24, 2024
  10. 2/2 config: fix evaluating "onbranch" with nonexistent git dirPatrick Steinhardt, Sep 24, 2024
  11. shejialuoSep 24, 2024
  12. Junio C HamanoSep 24, 2024
  13. shejialuoSep 24, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.