-
Notifications
You must be signed in to change notification settings - Fork 15
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
Clients should lock .tox file #28
Comments
.tox files are not required, so requiring them to be locked doesn't make sense. |
If a client uses a .tox file in the standard location (e.g. ~/.config/tox/), it should lock it until the program ends |
Ok, now this sounds reasonable. |
Also, clients should respect locked .tox files (on linux, file locking is advisory, not mandatory) |
no I don't think so... 👎 |
So we need to avoid the issue of Windows programs crashing and leaving files locked and unusable by any program until a reboot. Also, locks should also be advisory and not mandatory because the .tox files need to be read for e.g. displaying a profile chooser |
👍 |
This sounds reasonable to me. @JFreegman thoughts? |
As discussed in IRC windows doesn't really have an "advisory lock" solution. And again, as discussed on IRC, renaming the file would be the best/easiest/crossplatform solution. |
Sounds like a good idea to me. Would like to see the PR for this. |
@GrayHatter How renaming the file would save the issue ? You'll be at a point obliged to rename it back to the original name, and it can produce writing race. |
@SkyzohKey what would the race condition be? |
@GrayHatter If you rename the profil before using it without locking it, others clients would still be able to load it and maybe produce issues. |
if you rename it to profile.tox.inuse, and another client tries to write to that. The other client would be broken... that's like having a race condition with rm -rf |
@GrayHatter Nah, when the user close it's client, the profile can get "raced" at final rename stage.
EDIT: The simplest way would be creating a |
I stand by what I said before... one of those clients is broken. profile.tox -> start qTox -> rename profile.tox to profile.tox.inuse Start ricin -> it sees profile.tox.inuse -> dispalys error, No race condition unless the user is stupid, and you can't open a PR for stupid.
|
I don't get why you are talking about different clients and about tox files. Clients are free to store the profile in any format, even in a database, and they can do so in any place -- clients don't have to store profile as |
Clients should lock the .tox file so that you can't run multiple tox clients on the same profile. Things get buggy if you do that, and I'm guessing you also have the possibility of losing your data.
https://en.wikipedia.org/wiki/File_locking
The text was updated successfully, but these errors were encountered: