jrnl should not create 0-length "encrypted" file on startup
Support Request
Environment
- Jrnl
--diagnosticoutput: <!-- Runjrnl --diagnosticand paste the output --> - Install method: brew
What are you trying to do?
installed jrnl and created jrnl in Documents folder with encryption.Set password Closed jrnl and tried to reopen Inputting password that was just set produces Password is incorrect
What have you tried?
Other Information
Hi @dcg929, thanks for reporting. It looks like jrnl creates an empty file on startup, and empty files can't be decrypted since there is nothing to decrypt.
Instead of creating this empty file during installation, it should still save the encrypted file. And in fact, jrnl does this properly in edit mode -- for instance, one can run jrnl --edit on an encrypted journal, delete the entire journal, and save it. The file should be around 100 bytes and it will still decrypt just fine on future jrnl invocations.
A resolution to this bug should have:
- [x] A fix that saves a new empty encrypted jrnl properly when first setting up jrnl
- [x] A BDD test for this fix
This is probably best resolved by encrypting an empty string and saving the file with it, rather than simply touching the file on install.
Oh, forgot to mention the workaround! If you delete your original empty journal file (which you can find by running jrnl --list), you should be able to get past this issue.