The sound distributed version control system

#693 Crash in `pijul change` when passing a state ID instead of a change ID

Closed on February 27, 2023
mtkennerly on July 7, 2022

I got this crash when running pijul change with a state ID obtained from pijul tag.

report-15d75105-59c2-4195-8dc3-f43e633545ac.toml:

name = 'pijul'
operating_system = 'windows'
crate_version = '1.0.0-beta.2'
explanation = '''
Panic occurred in file 'C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\pijul-1.0.0-beta.2\src\commands\change.rs' at line 45
'''
cause = 'called `Result::unwrap()` on an `Err` value: ChangeFile(IoHash { err: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }, hash: H2GTPXWKCJOYULTRIQL6QS62UO5B6WYR7KHZW4G7LCXIMTUGNO3QC })'
method = 'Panic'
backtrace = '''

   0: 0x7ff7fe20e4e9 - <unresolved>
   1: 0x7ff7fe4b6555 - <unresolved>
   2: 0x7ff7fe4b6663 - <unresolved>
   3: 0x7ff7fda72ec3 - <unresolved>
   4: 0x7ff7fda0e35e - <unresolved>
   5: 0x7ff7fda4090e - <unresolved>
   6: 0x7ff7fdc35aa9 - <unresolved>
   7: 0x7ff7fdba7a4b - <unresolved>
   8: 0x7ff7fda86b45 - <unresolved>
   9: 0x7ff7fdab5adb - <unresolved>
  10: 0x7ff7fdc4b296 - <unresolved>
  11: 0x7ff7fda5090c - <unresolved>
  12: 0x7ff7fe20b1cf - <unresolved>
  13: 0x7ff7fdaba587 - <unresolved>
  14: 0x7ff7fe482b8c - <unresolved>
  15: 0x7ffcd28554e0 - BaseThreadInitThunk
  16: 0x7ffcd398485b - RtlUserThreadStart'''
tankf33der on July 8, 2022

Confirmed, I do not understand how it was missed from my wide sonar.

It crashes only when use full ID.

Steps are:

$ pijul init p1
$ cd p1
$ touch a
$ pijul add a
$ pijul record -am "."
$ pijul tag create
$ pijul tag
State 674MJQ73P5J63JBB4K3LSELV64BV5YTOGF65XRQGVG3YS2VPF6KQC
Author: [Author({"key": "7aNgoHULmBdh9S178c4R7eQJBLjiNUYt9rKUnooJ1eWT"})]
Date: 2022-07-08 06:50:35.485798388 UTC

$ pijul change 674MJQ73P5J63JBB4K3LSELV64BV5YTOGF65XRQGVG3YS2VPF6KQC
CRASH
$ cat /tmp/report-7ecc77bd-b986-404f-a9b5-6a55d456ebc3.toml
name = 'pijul'
operating_system = 'unix:Manjaro'
crate_version = '1.0.0-beta.2'
explanation = '''
Panic occurred in file 'pijul/src/commands/change.rs' at line 45
'''
cause = 'called `Result::unwrap()` on an `Err` value: ChangeFile(IoHash { err: Os { code: 2, kind: NotFound, message: "No such file or directory" }, hash: 674MJQ73P5J63JBB4K3LSELV64BV5YTOGF65XRQGVG3YS2VPF6KQC })'
method = 'Panic'
backtrace = '''

   0: 0x63bcd3a69ee3 - core::result::unwrap_failed::h995262f85f9c4e2c
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/result.rs:1785
   1: 0x63bcd3b0a12b - pijul::commands::change::Change::run::h091e1b907dc44121
   2: 0x63bcd3d77bab - pijul::run::{{closure}}::h87422be061feb5c9
   3: 0x63bcd3d51640 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hc3307138fbb9ad40
   4: 0x63bcd3a7283d - std::thread::local::LocalKey<T>::with::h27bf115f872d7155
   5: 0x63bcd3cac04a - tokio::park::thread::CachedParkThread::block_on::h7da6e4cec23406bd
   6: 0x63bcd3befead - tokio::runtime::thread_pool::ThreadPool::block_on::h6164b0e10b6e3430
   7: 0x63bcd3b2d2a2 - tokio::runtime::Runtime::block_on::hc2fa4de4be0c44c1
   8: 0x63bcd3b7d92a - pijul::main::h35a3407d3b10766c
   9: 0x63bcd3c98a13 - std::sys_common::backtrace::__rust_begin_short_backtrace::heff074e1be76be12
  10: 0x63bcd3ae07f9 - std::rt::lang_start::{{closure}}::hfc02a599c36262ea
  11: 0x63bcd42c079e - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hf833e7144973d4be
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/ops/function.rs:280
                 - std::panicking::try::do_call::h79761d203bfb6b46
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:492
                 - std::panicking::try::h0561cbbe1722251d
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:456
                 - std::panic::catch_unwind::hbca347ddd031b141
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panic.rs:137
                 - std::rt::lang_start_internal::{{closure}}::h0492050ad281ec32
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:128
                 - std::panicking::try::do_call::h3ebce69871996bb3
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:492
                 - std::panicking::try::hbed537d20e728475
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:456
                 - std::panic::catch_unwind::h4185e2024c6a5d05
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panic.rs:137
                 - std::rt::lang_start_internal::h1899cfd715ca6829
                at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/rt.rs:128
  12: 0x63bcd3b7da02 - main
  13: 0x1210b8b25290 - <unresolved>
  14: 0x1210b8b2534a - __libc_start_main
  15: 0x63bcd3a6a095 - _start
                at /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:115
  16:        0x0 - <unresolved>'''

pmeunier on February 27, 2023

Nice catch! Sorry @mtkennerly it took so long for me to read this report.

I just fixed it with #SGFYGAXKCEALV2JOZEVWLUCJSUGAF22FF774PVTQLBVYLB4A3ZCAC

pmeunier closed this discussion on February 27, 2023
pmeunier on February 27, 2023

And congrats on finding a bug of this kind that @tankf33der didn’t see, I believe that’s worth a rather prestigious badge.