Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jrnl should not create 0-length "encrypted" file on startup #1493

Closed
dcg929 opened this issue Jun 2, 2022 · 2 comments · Fixed by #1690
Closed

jrnl should not create 0-length "encrypted" file on startup #1493

dcg929 opened this issue Jun 2, 2022 · 2 comments · Fixed by #1690
Labels
bug Something isn't working ready for pr Okay to start work. Feel free to ask questions.
Milestone

Comments

@dcg929
Copy link

dcg929 commented Jun 2, 2022

Support Request

Environment

  • Jrnl --diagnostic 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

@dcg929 dcg929 added 🆕 New! support End user support labels Jun 2, 2022
@micahellison micahellison changed the title jrnl password incorrect jrnl should not create 0-length "encrypted" file on startup Jun 4, 2022
@micahellison micahellison added bug Something isn't working and removed support End user support 🆕 New! labels Jun 4, 2022
@micahellison micahellison added this to the Backlog milestone Jun 4, 2022
@micahellison
Copy link
Member

micahellison commented Jun 4, 2022

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:

  • A fix that saves a new empty encrypted jrnl properly when first setting up jrnl
  • 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.

@micahellison
Copy link
Member

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.

@micahellison micahellison added the ready for pr Okay to start work. Feel free to ask questions. label Jun 4, 2022
wren pushed a commit that referenced this issue Feb 25, 2023
…file (#1690)

* Add failing test for issue #1493
* Write journal upon creation instead of just creating 0-length file
* Fix test to accommodate current password mocking form
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready for pr Okay to start work. Feel free to ask questions.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants