The sound distributed version control system

#429 [CRASH] diff on corrupted change

Opened by tankf33der on May 10, 2021
tankf33der on May 10, 2021

Boring, lets corrupt a trivial change by change a year from 2021 to 2020:

# xxd PDKMB7AMKZ4SKGMGGBKRCC4PK5Q44SJPYL6OXIDHTNMLKU3ATQC.change
00000000: 0400 0000 0000 0000 0c01 0000 0000 0000  ................
00000010: eb00 0000 0000 0000 0000 0000 0000 0000  ................
00000020: fc00 0000 0000 0000 0600 0000 0000 0000  ................
00000030: 2801 0000 0000 0000 28b5 2ffd 0060 6503  (.......(./..`e.
00000040: 0074 0404 0001 2e00 1e32 3032 312d 3035  .t.......2021-05
00000050: 2d31 3054 3133 3a31 363a 3439 2e33 3634  -10T13:16:49.364
00000060: 3134 3632 3737 5a00 0301 0011 0000 0311  146277Z.........
00000070: 0461 0100 0000 db61 e668 b44b 6347 e467  .a.....a.h.KcG.g
00000080: 80d1 d727 9a50 6d45 5961 0e00 3132 301f  ...'.PmEYa..120.
00000090: 0220 439e 1da3 8974 54c8 5808 864b da4c  . C....tT.X..K.L
000000a0: 9709 1360 5c73 2d79 56f2 1d00 1628 b52f  ...`\s-yV....(./
000000b0: fd00 6061 0000 6397 61ec 1cca 2e0d 8613  ..`a..c.a.......
000000c0: 09f7 5e2a 4d18 2100 0000 7500 0000 0001  ..^*M.!...u.....
000000d0: 0000 db63 06ea 1500 0000 0c00 0000 a08e  ...c............
000000e0: c0a5 0200 0000 80b1 ea92 8f5e 2a4d 1809  ...........^*M..
000000f0: 0000 0000 0000 0080 b1ea 928f 28b5 2ffd  ............(./.
00000100: 0060 3100 0000 0061 0000 005e 2a4d 1815  .`1....a...^*M..
00000110: 0000 000f 0000 0006 0000 0047 90d0 4a01  ...........G..J.
00000120: 0000 0080 b1ea 928f                      ........
$

A lot of commands, even credit can handle this:

$ pijul credit a
Error: ZSTD("Corrupted block detected")
$

Except diff:

# no changes in working dir
$ pijul diff
# CRASH
$ cat /tmp/report-eeb26899-7848-4f19-a0f6-a596137ef650.toml
name = 'pijul'
operating_system = 'unix:Unknown'
crate_version = '1.0.0-alpha.48'
explanation = '''
Panic occurred in file '/root/pijul/libpijul/src/record.rs' at line 461
'''
cause = 'called `Result::unwrap()` on an `Err` value: Changestore(ChangeFile(Zstd(ZSTD("Corrupted block detected"))))'
method = 'Panic'
backtrace = '''

   0: 0x55d543dbdaa3 - core::result::unwrap_failed::h0fcfc49c27fca26a
   1: 0x55d543678576 - libpijul::record::Builder::record::hbdd96fb1e81febc6
   2: 0x55d5438432f9 - pijul::commands::diff::Diff::run::{{closure}}::hf884660cbd47ff00
   3: 0x55d543873d49 - pijul::run::{{closure}}::h3d2a427015af1bde
   4: 0x55d5438237fb - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hac5702c5708aff5d
   5: 0x55d5436344ef - tokio::park::thread::CachedParkThread::block_on::h9dfa4f8ab9fc00ad
   6: 0x55d54363472d - tokio::runtime::thread_pool::ThreadPool::block_on::h31480bcfb09ebd5c
   7: 0x55d5437ba190 - tokio::runtime::Runtime::block_on::h0c42b5fb9e01d944
   8: 0x55d54378da46 - pijul::main::h69a29ac771933d4a
   9: 0x55d54379ff53 - std::sys_common::backtrace::__rust_begin_short_backtrace::h0d90fe0f00bec166
  10: 0x55d54376ddb9 - std::rt::lang_start::{{closure}}::ha554b8868006b00c
  11: 0x55d543d9ae57 - std::rt::lang_start_internal::h0c3fae9f987cf9c0
  12: 0x55d54378db02 - main
  13: 0x7f3ba8be5e0a - __libc_start_main
                at /builddir/glibc-2.32/csu/../csu/libc-start.c:314
  14: 0x55d5435f02ba - _start
                at /builddir/glibc-2.32/csu/../sysdeps/x86_64/start.S:120
  15:        0x0 - <unresolved>'''
$