-
Notifications
You must be signed in to change notification settings - Fork 665
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
Check wehter file is locked before we move #8768
Conversation
43d2ff5
to
b60b543
Compare
This comment has been minimized.
This comment has been minimized.
fde9956
to
1bd2cc7
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.
Looks good.
src/common/filesystembase.cpp
Outdated
@@ -191,6 +196,11 @@ bool FileSystem::uncheckedRenameReplace(const QString &originFileName, | |||
} | |||
|
|||
#else //Q_OS_WIN | |||
if (FileSystem::isFileLocked(originFileName, FileSystem::LockMode::Exclusive)) { | |||
*errorString = QCoreApplication::tr("FileSystem", "Can't rename %1, the file is currently in use").arg(originFileName); |
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.
Same here, in this function errorString
is used completely unchecked.
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 added an assert, as the function required an error parameter from the start
if (error) | ||
*error = tr("File %1 is currently in use").arg(fn); | ||
return false; | ||
} |
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.
before this new block, touchedFile()
is emitted. However, if the file is locked, we do not touch anything, so the emits should probably be moved below.
emit propagator()->seenLockedFile(fn, FileSystem::LockMode::Exclusive); | ||
done(SyncFileItem::SoftError, tr("%1 is currently in use").arg(fn)); | ||
return; | ||
} |
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 wonder who/what removes the tmp file of the download that is stopped here. But there are already other checks that interrupt the download, so that is probably handled elsewhere. Otherwise that would leave tmp files behind, no?
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'd doubt it but that something for a different review :D
1bd2cc7
to
94f8d0e
Compare
94f8d0e
to
4650029
Compare
Kudos, SonarCloud Quality Gate passed! |
4650029
to
b7ed176
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.
nice.
No description provided.