The sound distributed version control system

#193 Panic in `pijul record` – perhaps because it contains something that looks like a patch?

Closed on December 7, 2020
marians on December 7, 2020

I tried to push a change for the pijul manual containing a couple of diff outputs and patch examples.

Pijul gave me the “Well, that’s embarrassing” output, I’ll attach the log file in a separate comment.

marians on December 7, 2020

First try - alpha.15:


name = ‘pijul’

operating_system = ‘unix:Arch’

crate_version = ‘1.0.0-alpha.15’

explanation = ‘’’ Panic occurred in file ‘/home/markus/.cargo/registry/src/github.com-1ecc6299db9ec823/libpijul-1.0.0-alpha.11/src/change.rs’ at line 2430 ‘’’

cause = ‘called Option::unwrap() on a None value’

method = ‘Panic’

backtrace = ‘’’

0: 0x564218942a2d - core::panicking::panic::h184ede6dd822ffb4 at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:50

1: 0x564218559258 - libpijul::change::text_changes::change_ref::h17f90dd4469e1b8c

2: 0x564218559340 - libpijul::change::text_changes::parse_pos::ha8487235e80af2e7

3: 0x5642185a44d5 - libpijul::change::Record,libpijul::change::Local>::read::h17ac1d22ffc232ef

4: 0x564218178dee - libpijul::change::LocalChange::read_and_deps::h9e5c0607ab3367b3

5: 0x564218312f8f - pijul::commands::record::Record::record::ha158db80aadc188d

6: 0x5642181e1145 - pijul::commands::record::Record::run::{{closure}}::h159012cdd5874403

7: 0x5642181f1e3a - pijul::run::{{closure}}::h625809ae423eb7fa

8: 0x5642181c6073 - as core::future::future::Future>::poll::hefae22723cbc7c4f

9: 0x5642183257ef - tokio::runtime::enter::Enter::block_on::hf78462ec1d4157ed

10: 0x564218254f01 - tokio::runtime::thread_pool::ThreadPool::block_on::h742e79274abd5cdd

11: 0x56421814f8ba - tokio::runtime::context::enter::h3b92cf426d137b08

12: 0x5642182fea32 - tokio::runtime::handle::Handle::enter::h6c45e09803af2bb4

13: 0x5642181fa44d - pijul::main::h1e8de83b15cb8e22

14: 0x5642181412f3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3446c99313be5445

15: 0x5642181415c9 - std::rt::lang_start::{{closure}}::hd9c07cc9f26601be

16: 0x56421891fdd7 - core::ops::function::impls:: for &F>::call_once::he179d32a5d10d957

            at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/ops/function.rs:259

             - std::panicking::try::do_call::hcb3d5e7be089b2b4

            at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:381

             - std::panicking::try::h7ac93b0cd56fb701

            at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:345

             - std::panic::catch_unwind::h7b40e396c93a4fcd

            at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panic.rs:382

             - std::rt::lang_start_internal::h142b9cc66267fea1

            at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/rt.rs:51

17: 0x5642181fa602 - main

18: 0x7f05e4ae1152 - __libc_start_main

19: 0x5642181282be - _start

20: 0x0 - ‘’’

marians on December 7, 2020

Second try - alpha.19

name = ‘pijul’ operating_system = ‘unix:Arch’ crate_version = ‘1.0.0-alpha.19’ explanation = ‘’’ Panic occurred in file ‘/home/markus/.cargo/registry/src/github.com-1ecc6299db9ec823/libpijul-1.0.0-alpha.14/src/change/text_changes.rs’ at line 1090 ‘’’ cause = ‘called Option::unwrap() on a None value’ method = ‘Panic’ backtrace = ‘’’

0: 0x55bb6913614d - 1: 0x55bb68d5a9e7 - 2: 0x55bb68d5aad0 - 3: 0x55bb68d3a1f4 - 4: 0x55bb68896c1e - 5: 0x55bb689a6775 - 6: 0x55bb689b7706 - 7: 0x55bb6898b1c9 - 8: 0x55bb68958c4f - 9: 0x55bb68aab51d - 10: 0x55bb68a5cc5c - 11: 0x55bb689c47e5 - 12: 0x55bb688b8603 - 13: 0x55bb68a081e9 - 14: 0x55bb69113167 - 15: 0x55bb689c49c2 - 16: 0x7fcd96552152 - __libc_start_main 17: 0x55bb6887817e - 18: 0x0 - ‘’’

pmeunier on December 7, 2020

If you can reproduce, I’d be interested to see what the file looked like.

pmeunier on December 7, 2020

Yes, definitely interested. You can send it to pe@pijul.org if it’s too large to be pasted here.

marians on December 7, 2020

message = ‘’ timestamp = ‘2020-12-07T18:37:43.416172095Z’

[[authors]] name = ‘marians’ full_name = ‘Markus Arians’ email = ‘markus.r.arians@gmail.com’

Dependencies

[2] LYR3UWPMN2GBD5CKIB37RJM6TP5N5D4M2KF5VUZ2CIPTSPEISLBAC [3]+SCSV2FNSTQ4FVACUQZM4EISV72FP5SEBGKGMLQB3323KHSCDP67QC

Changes

  1. File addition: “splitting_and_combining_changes.md” in “src/workflows” 644 up 2.451, new 0:36
  • Recording, splitting and combining changes

  • When working on code in your repository, you might come to a point where you
  • feel that the pijul log doesn’t look quite as nice as it could: Some changes
  • don’t work on their own, or some change is changing unrelated pieces of code.
  • So you’d like to re-arrange (split and / or combine) your changes so that
  • other, well-cut changes result.
  • On this page, you can learn how to achieve pijul log nirvana with the tools
  • at hand.
  • Recording a change

  • After editing the files in your repository, you want to make pijul aware of the
  • changes. You already came across the command(s) to do that: pijul add any
  • files that aren’t tracked yet (probably using the -r flag for directories),
  • and then pijul record all changes.
  • pijul record opens an editor for you containing a view of the change as it
  • will be recorded:
  • message = ‘’
  • timestamp = ‘2020-12-07T06:59:38.257226181Z’
  • [[authors]]
  • name = ‘me’
  • full_name = My Name
  • email = ‘me@gmail.com’
  • Dependencies

  • [2] 5PI4BUI3SDD23P7V3NNCA3FR6NA7YCMF7PJRIJNMZH5TGDA7AGWQC
  • [3] H6EG7X443HN5LXRZ3TZLRQSIGW46NXGOMFXT2NP6KBGUKVDMF4RAC
  • [4]+NM32CQUCZLDJIE3H4SZJU35WJTWES6X2CAVWVZCPDEINQKHYAXTAC
  • Changes

    1. File addition: “file3.txt” in “/” 644
  • up 1.0, new 0:11
    • ui
    • ae
    • nr
    • td
    1. Edit in file2.txt:2 3.12
  • B:BD 3.22 -> 3.22:31/3
    • uiaeuiae
    1. Edit in file2.txt:3 3.12
  • up 3.40, new 26:35
    • uiaexvlc
    1. Edit in file.txt:4 4.11
  • up 2.5, new 36:49
    • xvlcuiaexvlc
  • You can see the file is divided into three big blocks: the preamble with
  • metadata about the change like message and author; one block describing the
  • dependencies of this change; and one block containing a representation of all
  • changes you made since recording the last change.
  • To finish recording, this file needs to be edited a bit and saved, and the
  • editor window needs to be closed.
  • The message field has to be filled in, the fields under the [[author]]
  • heading can be changed. Changes between # Dependenices and # Changes
  • will not be regarded by pijul; the dependencies will be computed after you
  • close the editor window. This part is purely informational.
  • The diff below # Changes, however, is where you can get creative with your
  • change. The diff is composed of several small sections. Each section is
  • introduced by an enumeration and a very short description of the diff (in the
  • example you can see Edit in file and File addition) and what file the diff
  • refers to.
  • You can remove any of these enumerated sections. This will leave the diff out
  • of the recorded change, but your working copy will not be touched. This way,
  • you can split up a big chunk of changes into several small ones or - if there
  • were changes you didn’t want to keep in your repo - pijul reset whatever is
  • left.
  • Amending

  • Suppose you (or someone else working in the same repository) have already
  • recorded a large change, which you want to split into two separate changes
  • (maybe because you’d like to be able to push just one):
  • me@host ~/pijul-test $ pijul change 5HWYGVSSDKMEQP43H3JDSURPS7FJB4TXMAGMUAKSKWIFH6QRZN3QC
  • message = ‘Big change, should be split up’
  • timestamp = ‘2020-12-05T15:34:38.416301967Z’
  • [[authors]]
  • name = ‘me’
  • full_name = ‘My Name’
  • email = ‘me@gmail.com’
  • Dependencies

  • [2] 5PI4BUI3SDD23P7V3NNCA3FR6NA7YCMF7PJRIJNMZH5TGDA7AGWQC
  • [3]+NM32CQUCZLDJIE3H4SZJU35WJTWES6X2CAVWVZCPDEINQKHYAXTAC
  • Changes

    1. File addition: “file2.txt” in “/” 644
  • up 1.0, new 0:11
    • xvlcxvlc
    • uiaeuiae
    • nrtdnrtd
    1. Edit in file.txt:4 3.11
  • up 2.5, new 41:54
    • xvlcuiaexvlc
  • To edit the recorded change, you issue the command
  • me@host ~/pijul-test $ pijul record –amend 5HWYGVSSDKMEQP43H3JDSURPS7FJB4TXMAGMUAKSKWIFH6QRZN3QC
  • An editor will open showing the change (see above, Recording a change). Now,
  • you can remove all sections you don’t want to go into the first change.
  • Whatever you remove, the files themselves will still look the same as before
  • the amend, only the record will have changed.
  • From here, you can pijul record the next change, again removing any sections
  • you don’t want to have in it. Repeat until done.
  • Splitting a change

  • Although amending a change should be enough in most, if not all, scenarios, you
  • might be happy to know there’s an alternative:
  • By doing pijul unrecord, directly followed by pijul record, and then
  • opening a few instances of your favourite text editor to cut and paste the
  • result into multiple temporary text files, you can pipe them into `pijul
  • apply`. The whole procedure would look something like this:
  • Suppose we started with the change from above, and already did pijul unrecord
  • to strip the record of the change, but not the content of the change itself.
  • When you issue pijul record, you will be presented with the following in your
  • editor:
  • message = ‘’
  • timestamp = ‘2020-12-07T06:59:38.257226181Z’
  • [[authors]]
  • name = ‘me’
  • full_name = My Name
  • email = ‘me@gmail.com’
  • Dependencies

  • [2] 5PI4BUI3SDD23P7V3NNCA3FR6NA7YCMF7PJRIJNMZH5TGDA7AGWQC
  • [3] H6EG7X443HN5LXRZ3TZLRQSIGW46NXGOMFXT2NP6KBGUKVDMF4RAC
  • [4]+NM32CQUCZLDJIE3H4SZJU35WJTWES6X2CAVWVZCPDEINQKHYAXTAC
  • Changes

    1. File addition: “file3.txt” in “/” 644
  • up 1.0, new 0:11
    • ui
    • ae
    • nr
    • td
    1. Edit in file2.txt:2 3.12
  • B:BD 3.22 -> 3.22:31/3
    • uiaeuiae
    1. Edit in file2.txt:3 3.12
  • up 3.40, new 26:35
    • uiaexvlc
    1. Edit in file.txt:4 4.11
  • up 2.5, new 36:49
    • xvlcuiaexvlc
  • Now, you can split this text up into several files as you like, remembering to
  • copy over the preamble of the original, resulting in something like this:
  • In file1:
  • message = ‘First change’
  • timestamp = ‘2020-12-07T06:59:38.257226181Z’
  • [[authors]]
  • name = ‘me’
  • full_name = My Name
  • email = ‘me@gmail.com’
  • Dependencies

  • [2] 5PI4BUI3SDD23P7V3NNCA3FR6NA7YCMF7PJRIJNMZH5TGDA7AGWQC
  • [3] H6EG7X443HN5LXRZ3TZLRQSIGW46NXGOMFXT2NP6KBGUKVDMF4RAC
  • [4]+NM32CQUCZLDJIE3H4SZJU35WJTWES6X2CAVWVZCPDEINQKHYAXTAC
  • Changes

    1. File addition: “file3.txt” in “/” 644
  • up 1.0, new 0:11
    • ui
    • ae
    • nr
    • td
    1. Edit in file2.txt:2 3.12
  • B:BD 3.22 -> 3.22:31/3
    • uiaeuiae
  • In file2:
  • message = ‘Second change’
  • timestamp = ‘2020-12-07T06:59:38.257226181Z’
  • [[authors]]
  • name = ‘me’
  • full_name = My Name
  • email = ‘me@gmail.com’
  • Dependencies

  • [2] 5PI4BUI3SDD23P7V3NNCA3FR6NA7YCMF7PJRIJNMZH5TGDA7AGWQC
  • [3] H6EG7X443HN5LXRZ3TZLRQSIGW46NXGOMFXT2NP6KBGUKVDMF4RAC
  • [4]+NM32CQUCZLDJIE3H4SZJU35WJTWES6X2CAVWVZCPDEINQKHYAXTAC
  • Changes

    1. Edit in file2.txt:3 3.12
  • up 3.40, new 26:35
    • uiaexvlc
  • And in file3:
  • message = ‘Third change’
  • timestamp = ‘2020-12-07T06:59:38.257226181Z’
  • [[authors]]
  • name = ‘me’
  • full_name = My Name
  • email = ‘me@gmail.com’
  • Dependencies

  • [2] 5PI4BUI3SDD23P7V3NNCA3FR6NA7YCMF7PJRIJNMZH5TGDA7AGWQC
  • [3] H6EG7X443HN5LXRZ3TZLRQSIGW46NXGOMFXT2NP6KBGUKVDMF4RAC
  • [4]+NM32CQUCZLDJIE3H4SZJU35WJTWES6X2CAVWVZCPDEINQKHYAXTAC
  • Changes

    1. Edit in file.txt:4 4.11
  • up 2.5, new 36:49
    • xvlcuiaexvlc
  • You don’t need to worry about the # Dependencies block, it just needs to be
  • there. The dependencies themselves will be re-computed by pijul when you record
  • the change.
  • Now that your 3 files are saved, back out of the original pijul record by
  • closing the editor without a message for your change.
  • Finish the task by doing
  • me@host ~/pijul-test $ pijul apply <file1
  • me@host ~/pijul-test $ pijul apply <file2
  • me@host ~/pijul-test $ pijul apply <file3
  • or, if you have a real lot of files, you can do some clever shell script like
  • for file in file*; do pijul apply <$file; done
  • 
    
  1. Edit in src/SUMMARY.md:20 3.503120 up 2.3167, new 7595:7683, down 3.503772
  • - [Splitting and combining changes](./workflows/splitting_and_combining_changes.md)
    
marians closed this discussion on December 7, 2020
marians on December 7, 2020

Urgh, I’ll re-send it to you via discourse, just a sec

marians reopened this discussion on December 7, 2020
marians on December 7, 2020

I tried to record only parts of the patch – it looks like the problem definitely is the patches in the change…

pmeunier added a change on December 7, 2020
KJDQ2WOMIUTVDEEQ7NMJYBZAVUZ3NIVOVJ6MUCZPRAWIEWOV6TWQC
main
pmeunier on December 7, 2020

Thanks! It turned out \d means “digit” in the Regex crate, but this includes +, apparently. I just fixed it.

pmeunier closed this discussion on December 7, 2020
marians on December 7, 2020

Wow, that was really quick – even for you ;-)

pmeunier on December 7, 2020

Well, I do want that change in the manual!