Commit fb1c4b1b authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Do not register non-persistent crostini shared paths

We can't be sure at any given time that the VM has not
restarted and that a non-persistent share is still shared.
So we will not register them as shared.  If we happen to
take an action on the file more than once, there is little
harm to (re)attempt to share the path.

Bug: 925973
Change-Id: Ie3a4b4a3009c5846cd31754c2b642f2a369cebb4
Reviewed-on: https://chromium-review.googlesource.com/c/1481183
Auto-Submit: Joel Hockey <joelhockey@chromium.org>
Commit-Queue: Stuart Langley <slangley@chromium.org>
Reviewed-by: default avatarStuart Langley <slangley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634441}
parent 857fd20b
...@@ -687,10 +687,9 @@ FileTasks.prototype.maybeShareWithCrostiniOrShowDialog_ = function( ...@@ -687,10 +687,9 @@ FileTasks.prototype.maybeShareWithCrostiniOrShowDialog_ = function(
'Error sharing with linux to execute: ' + 'Error sharing with linux to execute: ' +
chrome.runtime.lastError.message); chrome.runtime.lastError.message);
} }
// Register paths as shared, and now we are ready to execute. // crbug.com/925973. Do not register non-persisted shared paths since
entriesToShare.forEach((entry) => { // we can't be sure at any time that the VM has not restarted and they
this.crostini_.registerSharedPath(entry); // are still shared.
});
callback(); callback();
}); });
}; };
......
...@@ -636,6 +636,8 @@ function testMaybeShareCrostiniOrShowDialog() { ...@@ -636,6 +636,8 @@ function testMaybeShareCrostiniOrShowDialog() {
expect( expect(
'2 entries, not shared, same dir', [notShared1, notShared2], true, '', '2 entries, not shared, same dir', [notShared1, notShared2], true, '',
''); '');
// Non-persistent shares should not be registered.
assertFalse(crostini.isPathShared(notShared1));
expect( expect(
'2 entries, not shared, different dir', [notShared1, otherNotShared], '2 entries, not shared, different dir', [notShared1, otherNotShared],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment