New issue
Advanced search Search tips

Issue 729529 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 498087
Owner: ----
Closed: Oct 31
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Empty files are created when file copy is cancelled or source files are unreadable.

Project Member Reported by tetsui@chromium.org, Jun 5 2017

Issue description

What steps will reproduce the problem?
(1) Copy hundreds of files, including files that are broken/unreadable (ex. corrupted on the file system)
(2) Cancel at the middle of the copy task.

What is the expected result?
No broken or empty files should be generated.

What happens instead?
Broken files and empty files are generated, for unreadable files and a file that was under copying when cancelled.
 
Status: Started (was: Assigned)
Status: Assigned (was: Started)
I tried this, but it turned out to require a lot of work compared to the importance, so I stop working on that for now.

My attempts:
https://codereview.chromium.org/2918273002/
https://codereview.chromium.org/2923163002/

1. File operation is not atomic. There is no guarantee that deleting the destination file after copy failure always works as intended. It's OK that sometimes the cleanup fails. But, for example, assume the destination file was already existed when Copy() was called and it failed. It would delete the destination file which might be different from the source file, so it leads to user data loss. It's hard to safely exclude these cases because error reporting is dependent on each file system.

2. For cancellation, it's relatively safe to delete the destination files. However, if copied entries contain directory, it becomes hard to handle it properly. We want to delete the specific file that was under copying and not the entire directory. fileManagerPrivate.onCopyProgress gives start and end event for individual files. But, it's hard to remove the last file because status.type === 'begin_copy_entry' does not contain status.destinationUrl even though 'end_copy_entry' does, and recursive directory traversal is file system dependent. (so we cannot safely predict destinationUrl from sourceUrl.)

https://codesearch.chromium.org/chromium/src/ui/file_manager/file_manager/background/js/file_operation_util.js?l=377&rcl=f5fb415739fdd30d61a3507ccd624553c8f46eef

(Thank you kinuko@ and fukino@ for help)

Comment 3 by tetsui@chromium.org, Jun 19 2017

The problem arises because detail of directory traversal depends on each file system, and FileManager does not receive a complete list of copied files and their destinations beforehand. I first thought it does not traverse directories before copy at all, but it is also not accurate. In fact it does so on JavaScript side (fileOperationUtil.resolveRecursively_). But the retrieved information is only used for calculating progress, and there's no guarantee that the traversal performed by JS side and the corresponding file system implementation is same. If they are different, FileManager just ignores the file from copy progress.
https://codesearch.chromium.org/chromium/src/ui/file_manager/file_manager/background/js/file_operation_util.js?l=794&rcl=e5ef406c5191bf506cb24a1c6306b135ea2732fa

Related issue:  https://crbug.com/491044 

Comment 4 by tetsui@chromium.org, Dec 19 2017

Cc: tetsui@chromium.org
Owner: ----
Status: Available (was: Assigned)

Comment 5 by sashab@chromium.org, Feb 24 2018

Labels: CrOS-FilesApp

Comment 6 by sashab@chromium.org, Feb 28 2018

Labels: -CrOS-FilesApp
Mergedinto: 498087
Status: Duplicate (was: Available)

Sign in to add a comment