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

Journal: Don't use a ._ path if it won't work #5633 #5844

Merged
merged 2 commits into from
Jun 20, 2017
Merged

Journal: Don't use a ._ path if it won't work #5633 #5844

merged 2 commits into from
Jun 20, 2017

Conversation

ckamm
Copy link
Contributor

@ckamm ckamm commented Jun 16, 2017

When synchronizing a folder on a samba share, creating files that begin
with ._ is often forbidden. This prevented the client from creating
its ._sync_abcdef.db file.

Now, it'll check whether the preferred filename is creatable, and if
it isn't it'll use .sync_abcdef.db instead.

The disadvantage is that this alternative path won't be ignored by
older clients - that was the reason for the ._ prefix.

When synchronizing a folder on a samba share, creating files that begin
with ._ is often forbidden. This prevented the client from creating
its ._sync_abcdef.db file.

Now, it'll check whether the preferred filename is creatable, and if
it isn't it'll use .sync_abcdef.db instead.

The disadvantage is that this alternative path won't be ignored by
older clients - that was the reason for the ._ prefix.
@ckamm
Copy link
Contributor Author

ckamm commented Jun 16, 2017

@SamuAlfageme I haven't actually tested this yet!

Copy link
Contributor

@guruz guruz left a comment

Choose a reason for hiding this comment

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

Code looks good!

To make it even more clear, can you also add the new pattern to https://github.com/owncloud/client/blob/2.3.2/sync-exclude.lst#L9 ? Then users will see it in their UI too.

@guruz guruz added the ReadyToTest QA, please validate the fix/enhancement label Jun 16, 2017
Copy link
Contributor

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

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

I disagree with @guruz about adding it in the exclude list. This would have a negative effect on performence.

}

// Neither worked, just keep the original and throw errors later
qDebug() << "Could not find a writable database path" << file.fileName();
Copy link
Contributor

Choose a reason for hiding this comment

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

qCWarning please

QFile file2(QDir(localPath).filePath(alternateJournalPath));
if (file2.open(QIODevice::ReadWrite)) {
// The alternative worked, use it
qDebug() << "Using alternate database path" << alternateJournalPath;
Copy link
Contributor

Choose a reason for hiding this comment

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

qCInfo

@ckamm
Copy link
Contributor Author

ckamm commented Jun 19, 2017

@ogoffart This patch is against 2.3, the logging change is in master only.

@guruz I agree with @ogoffart about not adding it to the exclude pattern list. I'll make it show up in the ui though.

The ignore patterns for the journal files are hardcoded. Add them to
the UI to make them discoverable.
@ckamm
Copy link
Contributor Author

ckamm commented Jun 19, 2017

@SamuAlfageme Tested now. To me it looks like

  • Old and new sync folders use the old path if ._ file creation is allowed
  • When I create a new sync folder on a samba folder with ._* forbidden, the new journal name is used
  • When I switch on ._* veto on a samba share with an existing sync folder with a ._sync journal on it, the client creates a new journal with the .sync name (correct, because the ._ file becomes unavailable)
  • On a samba share with ._* vetoed, migrating an old .csync_journal.db database to .sync_*.db works.

Can be merged into 2.3 once we have approval from Samu and either guruz or ogoffart.

Copy link
Contributor

@SamuAlfageme SamuAlfageme left a comment

Choose a reason for hiding this comment

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

@ckamm just went over the same scenarios and got the same results. Nice!

Only comment I have

I thought [the journal] was going to be recreated while running [with the "Unable to find sync journal] or forcing sync but didn't happen until I restarted [the client] (maybe we could do it on the fly? - like it happens when deleting the journal on a normal local sync folder -)

👍

@ckamm
Copy link
Contributor Author

ckamm commented Jun 19, 2017

@SamuAlfageme I'm glad your tests worked out.

Doing the check and migration of journal on loading of settings seems sufficent to me - cases where ._ files become suddenly unavailable while the client is running sound vanishingly rare.

@@ -48,6 +48,9 @@ IgnoreListEditor::IgnoreListEditor(QWidget *parent) :
"and cannot be modified in this view.")
.arg(QDir::toNativeSeparators(cfgFile.excludeFile(ConfigFile::SystemScope)));

addPattern(".csync_journal.db*", /*deletable=*/false, /*readonly=*/true);
addPattern("._sync_*.db*", /*deletable=*/false, /*readonly=*/true);
addPattern(".sync_*.db*", /*deletable=*/false, /*readonly=*/true);
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

@guruz guruz merged commit 1e78a14 into 2.3 Jun 20, 2017
@guruz guruz deleted the journalname branch June 20, 2017 11:35
@SamuAlfageme SamuAlfageme mentioned this pull request Jul 24, 2017
84 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ReadyToTest QA, please validate the fix/enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants