knqyf263/pet

pet version v0.8.1 overwrites snippets file

Closed this issue · 6 comments

Privileged issue

  • I've been directed through Discussions to create an issue here.

Issue Content

After the update to latest pet version v0.8.1 when executing "pet search" command it shows 0 commands.
I had a snippets file backed up. I restored pet to previous version v0.7.1 and restored old snippets file and all worked fine.
One again I upgraded to v0.8.1 and it again overwrited my snippets file and showed 0 snippets saved.
I tried the "pet new" and it successfully saved 1 snippet into overwritten snippets file.

Thanks for reporting this, also experience it locally

Seems like the new toml library encoding doesn't then decode properly for some reason.

  • Just ran a test through a debugger: creating a new snippet gets appended properly.
    Listing or searching after that yields no results.

  • Creating another new snippet after that overwrites the file completely since it couldn't read the old snippets so it assumed that this new command is the only command. Then it saves a list of snippets made of just this one new command, overwriting everything.

It's a pretty serious issue, so need to resolve asap. Will look into it a bit see if I can fix quickly, if not will revert to old library.

Oh just spotted another bug. Man this new library is hard to work with.. hold off on updating until I comment here again.

Okay try out 0.8.4 and let me know. It should be on brew.

brew update then brew upgrade pet

@RamiAwar Thank yo. I had some odd character in my snippets file "�". Newest version of pet works and doesn't overwrites snippets file anymore

Ah nice! Thank you for reporting this so quickly. It was indeed a hidden bug that only surfaced due to the recent update.