martinvonz / jj

A Git-compatible VCS that is both simple and powerful
https://martinvonz.github.io/jj/
Apache License 2.0
8.24k stars 276 forks source link

thread 'main' panicked at lib/src/simple_op_heads_store.rs:93:59: #4040

Open kappa opened 2 months ago

kappa commented 2 months ago

Description

jj 0.19.0 has problems working with an old jj repository.

I have an old repo that I created in 2022 with jj 0.2.0. Most of the commits there are from 2022, but the latest change I see is from May 9 2024:

$ ls -lR .jj | grep -v 2022
...
.jj/repo/index:
total 164
-rw-------. 1 kappa kappa  308 May  9 21:52 055e7dcd8378309124bfb2889b38c740470c62c8e4d47737d800b1f895a930aef3f31276b509304df75551595102b0ffdd8dfc9473424bba6f45f90a47608884
-rw-------. 1 kappa kappa  644 May  9 21:52 2c52688e312ba6c027bd891002b8f005c19c4bb1b277d12fbb93a8833a91522ba07a7e1b65835edcecc85ed5f4d5a1c45f13be1cd92b9e500341b041c31ba38d
drwxr-xr-x. 1 kappa kappa 9984 May  9 21:52 operations
-rw-r--r--. 1 kappa kappa    7 May  9 22:05 type
...

I have just upgraded to 0.19.0 and every command gives me this:

$ RUST_BACKTRACE=full jj log
thread 'main' panicked at lib/src/simple_op_heads_store.rs:93:59:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
stack backtrace:
   0:     0x7f333ffabd75 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h56c396e6ec1a6d25
   1:     0x7f333fff9eeb - core::fmt::write::h8d9f62e4196a6251
   2:     0x7f333ffa718f - std::io::Write::write_fmt::hfeda4b672809964d
   3:     0x7f333ffabb4e - std::sys_common::backtrace::print::h92792842c9200fcf
   4:     0x7f333ffad539 - std::panicking::default_hook::{{closure}}::h4fa40162feafd3ea
   5:     0x7f333ffad27d - std::panicking::default_hook::h5a52bd4fbc34f99c
   6:     0x7f333ffad9d3 - std::panicking::rust_panic_with_hook::h33e85abbf3f92159
   7:     0x7f333ffad8b4 - std::panicking::begin_panic_handler::{{closure}}::h6e89e0968a11dcc7
   8:     0x7f333ffac239 - std::sys_common::backtrace::__rust_end_short_backtrace::h6f80b72bde67d6fa
   9:     0x7f333ffad5e7 - rust_begin_unwind
  10:     0x7f333f18fa93 - core::panicking::panic_fmt::hb37c2646452904e3
  11:     0x7f333f18ff46 - core::result::unwrap_failed::h95d9de04097dd2c4
  12:     0x7f333f7bb955 - <jj_lib::simple_op_heads_store::SimpleOpHeadsStore as jj_lib::op_heads_store::OpHeadsStore>::get_op_heads::hc536122ad73400c9
  13:     0x7f333f272ef1 - jj_lib::op_heads_store::resolve_op_heads::hddbeec5443f704e5
  14:     0x7f333f3b1c68 - jj_cli::cli_util::CommandHelper::resolve_operation::h50f33505ce120a95
  15:     0x7f333f3b14d4 - jj_cli::cli_util::CommandHelper::workspace_helper_no_snapshot::hbcc26179cb5f3367
  16:     0x7f333f3b1038 - jj_cli::cli_util::CommandHelper::workspace_helper::h554e34cfe51b3dda
  17:     0x7f333f45f4e2 - jj_cli::commands::run_command::he05f74fe177a66a6
  18:     0x7f333f1e5e80 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h2ab11909daae85bc
  19:     0x7f333f29d475 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd355cb5d53015356
  20:     0x7f333f3c50ec - jj_cli::cli_util::CliRunner::run::h2b02e3029c275c1f
  21:     0x7f333f190461 - jj::main::h7dd324b260da07cb
  22:     0x7f333f1903e3 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha5764fb959ad47a6
  23:     0x7f333f1903f9 - std::rt::lang_start::{{closure}}::ha56f2b515579ac14
  24:     0x7f333ff9c9dd - std::rt::lang_start_internal::ha99684538b0582d2
  25:     0x7f333f190495 - main

Specifications

kappa commented 2 months ago

I was trying to bisect running "jj log" from older versions but I didn't make a backup and some versions probably tried to fix it or upgrade. It is still broken but in a different way.

$ jj log
@  wnxturwm (no email set) 2024-07-06 13:16:15 645e33c0
│  (no description set)
◉  skwxtyoz (no email configured) 2024-05-09 21:52:23 7caf6812
│  .
◉  lxrxulrx (no email configured) 2022-09-03 16:01:19 16f95077
│  More
◉  snqyvrvn (no email configured) 2022-08-20 12:57:16 d41fa7e5
│  many
◉  smqpswuv (no email configured) 2022-06-29 22:35:15 a12ea8de
│  +many
◉  opzntqsx (no email configured) 2022-06-26 17:47:39 3d4f1d28
│  + many
◉  lzmyumuo (no email configured) 2022-06-18 13:32:20 06184a24
│  ++
◉  uvmsopok (no email configured) 2022-06-11 16:28:24 339538f0
│  +many
◉  msywpxpk (no email configured) 2022-06-11 12:14:09 698403f0
│  108 done!
◉  punvqzso (no email configured) 2022-06-11 11:34:11 e4f638a7
│  ++ many
◉  tyulnyyv (no email configured) 2022-06-07 23:51:56 fffd64ad
│  +many
◉  kxqlmyqp (no email configured) 2022-06-04 02:13:09 57817164
│  (no description set)
◉  vwwpmlus (no email configured) 2022-05-29 22:05:19 d51db015
│  +4
◉  vxxvwlru (no email configured) 2022-05-29 15:57:53 8bb364e1
│  3n+1
◉  xkummwmn (no email configured) 2022-05-29 13:59:52 89c53213
   <Error: Object 482ae5a29fbe856c7272f2071b8b0f0359ee2d89ff392b8a900643fbd0836eccd067b8bf41909e206c90d45d6e7d8b6686b93ecaee5fe1a9060d87b672101310 of type tree not found:
 No such file or directory (os error 2)> Brave warrior Hashmat
◉  zzzzzzzz root() 00000000
$

I think that 0.4.0 was able to print the log the first but now it fails completely.

yuja commented 2 months ago

some versions probably tried to fix it or upgrade.

Yes, we have ~6months backward compatibility policy right now.

BTW, the panicking behavior will be fixed by https://github.com/martinvonz/jj/pull/3934

<Error: Object 482ae5a29fbe856c7272f2071b8b0f0359ee2d89ff392b8a900643fbd0836eccd067b8bf41909e206c90d45d6e7d8b6686b93ecaee5fe1a9060d87b672101310 of type tree not found:

Maybe the backing Git repository is corrupted? Try git fsck