-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
cmd/mount: honour --no-lock flag #2821
Conversation
cmd/restic/cmd_mount.go
Outdated
if err != nil { | ||
return err | ||
if !gopts.NoLock { | ||
Verbosef("create lock for repository\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of printing out an info when the repo is locked, I would print out a warning when the repo is not locked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit updated. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
I'm not sure why mount should print a warning when no other command does that, but LGTM too. |
I think that that other commands should warn as well. 😉 |
Fine with me, let's see what the maintainers think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR would also fix #1597, for some reason Github doesn't let me link this issue to the PR.
cmd/restic/cmd_mount.go
Outdated
if err != nil { | ||
return err | ||
if gopts.NoLock { | ||
Warnf("not locking the repository\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a need to print this warning. A user hopefully still remembers that they passed the --no-lock
flag. So let's keep this consistent with the other commands which respect --no-lock
and remove the warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichaelEischer done in commit a6c94ac.
Let me know if this is good for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add a short changelog entry file to this PR. After this and the warning message are fixed, this PR is ready for merging.
c0b4bc2
to
a6c94ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@renard I guess GitHub is acting up and you haven't seen the two remaining comments I made on the changelog file. Please check the "Files changed" tab to see them :)
changelog/unreleased/pull-2821
Outdated
@@ -0,0 +1,7 @@ | |||
cmd/mount: honour --no-lock flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't formatted like the changelog entry template. I suggest changing this line to (yeah, the shorter "honor" instead of "honour"): Change: Honor the --no-lock flag in the mount command
The subject line in the changelog is still not changed. |
Do not lock the repository if --no-lock global flag is set. This allows to mount repositories which are archived on a read only system. Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much!
This is a really interesting addition. Would it be possible to modify the repository via another process while it’s mounted with the —no-lock option? If so what would happen? I’m thinking that this could be useful to continue backing up my system while I restore or read a backup of a file, but I also see the potential for this to have unintended side-effects; for example, if the snapshot where a file was being accessed was forgotten or pruned. |
@ATLief as long as you just want to backup while having your repo mounted, there is not need to use the This option is IMO only interesting for the use case that you can no longer write to your repopository but still want to access it. |
Do not lock the repository if --no-lock flag is set. This allows to
mount repositories which are archived on a read only system.
Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
What is the purpose of this change? What does it change?
If remote repository is on a read-only partition no lock can be acquired making the repo un-mountable.
This small patch fixes this by honouring the
--no-lock
global flag.Was the change discussed in an issue or in the forum before?
https://forum.restic.net/t/mount-without-locking/2887
Fixes #1597
Checklist
changelog/unreleased/
that describes the changes for our users (template here)gofmt
on the code in all commits