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

lib/model: Create root directory for paused folders (fixes #4094) #4095

Closed
wants to merge 4 commits into from

Conversation

imsodin
Copy link
Member

@imsodin imsodin commented Apr 13, 2017

see #4094

One possible caveat: Paused folders in config.xml are not handled (e.g. https://github.com/syncthing/syncthing/blob/master/cmd/syncthing/main.go#L817), but possibly other places too (?).

l.Warnln("Creating folder:", err)
}
}
createRootFolder(cfg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved off the real computer for the evening so I'm not gong to test tonight, but I can bitch about the naming :D it's a folder root, not a root folder. ;)

@AudriusButkevicius
Copy link
Member

Lgtm

@calmh
Copy link
Member

calmh commented Apr 18, 2017 via email

@calmh
Copy link
Member

calmh commented Apr 20, 2017

This looks sane and probably works as such, but it doesn't solve the underlying problem. That is, if I

  • "add folder"
  • fill in a path
  • hit "ignore patterns"
  • fill in some crap
  • "save"
  • "save"

the folder gets added, the directory is created, no error is shown, but no ignore patterns are created in the folder

@calmh
Copy link
Member

calmh commented Apr 22, 2017

Friendly reminder here just to make sure it's not forgotten or anything :)

@imsodin
Copy link
Member Author

imsodin commented Apr 23, 2017

Not forgotten, but off skitouring = offline.
I cannot reproduce your problem, the .stignore file is created with the entered content when I follow these steps.

@calmh
Copy link
Member

calmh commented Apr 23, 2017 via email

@calmh
Copy link
Member

calmh commented Apr 23, 2017

Found the issue, there is a race condition in the javscript which I'll fix in a followup commit.

@calmh
Copy link
Member

calmh commented Apr 23, 2017

@st-review merge

@st-review
Copy link

👌 Merged as 914b09f. Thanks, @imsodin!

@st-review st-review closed this Apr 23, 2017
st-review pushed a commit that referenced this pull request Apr 23, 2017
calmh added a commit that referenced this pull request Apr 23, 2017
Given the saveConfig() is async, it might not have happened before we
try to save the ignores and unpause. Likewise must wait for saving
ignores before unpausing or the scan might start before ignores are on
disk.

Javsacript <3
@@ -815,6 +815,7 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
// Add and start folders
for _, folderCfg := range cfg.Folders() {
if folderCfg.Paused {
folderCfg.CreateRoot()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imsodin Happened to be looking back at this... This is a problem if we're starting up, a folder is paused, and the folder is unmounted or otherwise missing. We will then create a new, empty, root for it. If the folder is then unpaused, we'll assume it became empty and sync a complete delete of it...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@calmh I seem to remember that this came up before but was considered not a problem, as the missing folder marker prevents it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateRoot does not create the marker though?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't, that's done by cfg.CreateMarker.

@imsodin imsodin deleted the fix-4094 branch October 5, 2017 18:24
@st-review st-review added the pr-merged Legacy label used in the past for pull requests merged to the main tree label Jan 15, 2018
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Jul 15, 2018
@syncthing syncthing locked and limited conversation to collaborators Jul 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion pr-merged Legacy label used in the past for pull requests merged to the main tree
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants