The sound distributed version control system

#297 Applying changes to top then bottom of file eventually fails

Closed on March 2, 2021
tucker-m on February 4, 2021

This is the shortest way that I’ve managed to reproduce this bug.

EDIT: I’m doing a pijul reset every time I apply a change, since that is necessary in order to actually see the applied change on my computer. I’ve just learned that isn’t supposed to be the case, so you can skip that if you’re trying to reproduce this bug.

The general idea is that you make a change to the bottom of a file and record that. Then append something to the top of the file and record that. Then apply those changes to another channel, starting with the change at the top of the file, and then apply the change at the bottom of the file (so, opposite of the order you created them in). After doing this twice, the bottom change will not be applied.

Here a specific way to reproduce it. (Sorry for being so long!)

  • pijul init
  • touch textfile
  • echo "a" > textfile
  • pijul add textfile
  • pijul record -m "a"
  • pijul fork other
  • pijul channel switch other
  • echo "b" >> textfile textfile now looks like:
a
b
  • pijul record -m "b"
  • sed ' 1 s/.*/&c/' -i textfile (This appends “c” to the end of the first line.) textfile now looks like:
ac
b
  • pijul record -m "c"
  • pijul channel switch main
  • pijul apply THE_C_CHANGE
  • pijul reset textfile now looks like:
ac
b

So the b change came along with c, which is not what I expected, but that’s not the bug here. pijul log now shows a, b, and c. Now apply a “d” and “e” the same way.

  • pijul channel switch other
  • echo "d" >> textfile textfile now looks like:
ac
b
d
  • pijul record -m "d"
  • sed ' 1 s/.*/&e/' -i textfile textfile now looks like:
ace
b
d
  • pijul record -m "e"
  • pijul channel switch main Back on the main channel, textfile looks like:
ac
b
  • pijul apply THE_E_CHANGE
  • pijul reset textfile now looks like:
ace
b

So, d was not applied. Apply that now.

  • pijul apply THE_D_CHANGE
  • pijul reset
  • The D change will show up in pijul log, but not if you cat textfile. Switch to the other channel, then back to the main channel, and it will show up.

Strangely, I had to do this process a third time (adding “f” and “g”) to make it fail yesterday, but only two rounds were needed today.

tucker-m on February 4, 2021

Hm, based on the response in this thread, I’m wondering if this is somehow a local problem for me. Since I have to pijul reset every time I apply a change, this might somehow be related. Like changes aren’t always automatically applied on my computer, and this bug is just one manifestation of that.

tucker-m on March 2, 2021

This bug no longer happens in 1.0.0-alpha.45.

tucker-m closed this discussion on March 2, 2021