JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.66k stars 2.59k forks source link

Importing an entry with the browser extension doesn't delete temporary files #11048

Open ror3d opened 8 months ago

ror3d commented 8 months ago

JabRef version

5.12 (latest release)

Operating system

Windows

Details on version and operating system

Windows 11

Checked with the latest development build (copy version output from About dialog)

Steps to reproduce the behaviour

  1. Edit the JabRefHost.ps1 file in your JabRef installation
  2. Change line 40 (Remove-Item...) with the following:
    $rout = Remove-Item $tempfile *>&1
    $wshell = New-Object -ComObject Wscript.Shell
    $wshell.Popup("ROut: $rout", 0, "JabRef", 0x0 + 0x30)
  3. Open JabRef
  4. Use the JabRef browser extension in any article to try to import it
  5. Upon import, a popup window will open showing the output of the Remove-Item command, reporting that it cannot remove the temporary file because it is being used: image

This is probably due to the JabRef command being called unblocking. The script has to exit to send back the result to the browser, but the open JabRef instance might still have the file open, so the script can't delete it before exiting.

Being able to send the file as stdin, or as a command-line argument, instead of creating a temporary file, could be a solution for this issue. Another approach could be connection using sockets in some way.

Appendix

No response

ror3d commented 8 months ago

This is related to https://github.com/JabRef/JabRef-Browser-Extension/issues/493 but that one is about the issue of the extension reporting an error, which should be solved with PR #11047, whereas this issue is about the still unresolved problem left in that PR.

tobiasdiez commented 8 months ago

Being able to send the file as stdin, or as a command-line argument, instead of creating a temporary file, could be a solution for this issue.

This is what we had before. But some of the bibtex can be quite long and then you hit the maximum length of the command line argument.

Is it really important to you to delete the temporary file? Windows 10+ normally clean the temp folder automatically, so it shouldn't really be a problem that there are still files lying around. I honestly don't see a clean way to clean them up, since as you say we need to return as fast as possible from the script.

It would perhaps work to pass a --deleteWhenClosing cmd line arg to jabref's main exe, and then clean up the file when the main jabref program is closed - but that feels a bit overkill.

ror3d commented 8 months ago

Right, as command-line argument would have such problem, sending them through stdin should work well though.

On the other hand, I am also thinking of ways that https://github.com/JabRef/JabRef-Browser-Extension/issues/481 could use a similar approach, but that might be a bit more tricky.

As for temp files being automatically deleted, if that is the case then this is not really a problem I guess.

Deehuh commented 2 months ago

Hi, I'm working with a group of 2 other CS students from Florida International University. We are part of the Tech Talent Academy program where we are required to join an open source project and make a contribution. We were wondering if we could tackle this issue

ThiloteE commented 2 months ago

@Deehuh since you and your teammates already have been assigned to another issue, I will not assign you to this one to avoid confusion. I expect you will only work on one issue anway, right?

Deehuh commented 2 months ago

Yes, that's correct. Thank you.

Noah-Martin1 commented 1 month ago

Hello, has anyone been assigned this issue yet? I am from ANU in australia and would like to work on this issue with my group for an assignment.

github-actions[bot] commented 1 month ago

Welcome to the vibrant world of open-source development with JabRef!

Newcomers, we're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.

In case you encounter failing tests during development, please check our developer FAQs!

Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.

Happy coding! 🚀

Noah-Martin1 commented 1 month ago

I apologize for the inconvenience, but I’ve been working on this issue and unfortunately, my Mac doesn’t have sufficient RAM to run both VirtualBox and IntelliJ simultaneously. Given that this issue pertains to Windows, it’s quite challenging to resolve it on my current setup.

Please unsassign me from this issue.

koppor commented 1 month ago

I apologize for the inconvenience, but I’ve been working on this issue and unfortunately, my Mac doesn’t have sufficient RAM to run both VirtualBox and IntelliJ simultaneously.

On any chance, did you try whether this issue also happens on MacOS setup?

koppor commented 1 month ago

Windows 10+ normally clean the temp folder automatically,

It does it when running tghe "Disk Cleanup tool" with a nice configuration - source: https://superuser.com/a/902645/138868

Noah-Martin1 commented 1 month ago

I apologize for the inconvenience, but I’ve been working on this issue and unfortunately, my Mac doesn’t have sufficient RAM to run both VirtualBox and IntelliJ simultaneously.

On any chance, did you try whether this issue also happens on MacOS setup?

No, I didn't extensively check if this issue happens on MacOS.

Victor476 commented 4 weeks ago

Hello, I am a student at the Federal Technological University of Paraná - Brazil, and I would like to work on this assignment for a course. I have a Windows 11 laptop to test.

koppor commented 4 weeks ago

/assign @Victor476

github-actions[bot] commented 4 weeks ago

👋 Hey @Victor476, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and don't forget to check out our workspace setup guidelines to get started smoothly.

In case you encounter failing tests during development, please check our developer FAQs!

Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on JabRef's Gitter chat. And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.

Happy coding! 🚀

⏳ Please note, you will be automatically unassigned if the issue isn't closed within 30 days (by 30 November 2024). A maintainer can also add the "📌 Pinned"" label to prevent automatic unassignment.