-
Notifications
You must be signed in to change notification settings - Fork 17
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
Notebook export canceled #188
Comments
Did you install any Android update? Did you change any permessions? |
Thanks for your response! I did not change any permissions, but when I checked the permissions the storage permission was turned off. I turned it on but the export still fails (also after a reboot of the phone). After the exports started failing I updated the app using F-droid to version 3.1.3. I don't see EBADF error anymore, but I do get the following error: |
I am getting the same.
I think you need to pass the ParcelFileDescriptor to ExportNotebook, otherwise when the garbage collector cleans it up the file gets closed. You probably can't reproduce because you do not have enough notes for the garbage collector to run before everything is written. There are some other annoying issues, for example the name of the zip file is used to select the notebook to export, which means you just get an empty file when you change it. That's probably what caused he "null object reference" from the previous message (as the dialog to select the save location automatically renames the file if it would overwrite something, so every time you want to export you have to delete the previous export first). |
When the ParcelFileDescriptor gets garbage collected that will close the associated file descriptor. Since the exporting happens async in a different block, we can end up trying to write to a closed file descriptor. To fix this, just pass the ParcelFileDescriptor to the object doing the async export, so it will be destroyed only after we have closed the stream we write to. Fixes issue konradrenner#188.
I sent a pull request and I tested that it does indeed fix the issue. |
Hi, thank you for the fix! I will asap release it (maybe next week). |
Thanks, to not put you under unnecessary pressure I'll add that with some trial-and-error and zip recovery tools I managed to get a backup out already, so this is not an immediate issue for me anymore. |
I exported my notebooks many times before, but I now receive the following error when trying to export:
Notebook export canceled
local/Notes/Notes/write failed: EBADF (Bad file descriptor)
Any idea what's happening and how to fix it?
The text was updated successfully, but these errors were encountered: