kioexec: change the scary debug messages for delayed deletion
ClosedPublic

Authored by Lekensteyn on May 23 2019, 3:39 PM.

Details

Summary

After resuming my laptop, I found this scary message in journalctl:

org.kde.Spectacle[123]: about to delete "/home/user/Pictures" containing "Screenshot_....png"

Apparently this message is due to me closing Kolourpaint and Spectacle
right before system sleep which scheduled a delayed deletion. Make the
debug messages more obvious to avoid any doubt.

Test Plan

Assume /tmp to be non-empty, then touch /tmp/x.png and kioexec --tempfiles ls /tmp/x.png. Expected output:

EXEC "/usr/bin/ls /tmp/x.png"
/tmp/x.png
EXEC done
sleeping for 180 seconds before deleting file...
Three minutes have passed, deleting "/tmp/x.png"

Doing something similar, but with /tmp/z/x.txt in a directory with no other files:

...
180 seconds have passed, deleting "/tmp/z/some.txt"
Removed empty parent directory "/tmp/z"

Discussion: perhaps the sleep should only occur if the problematic loffice/Amarok case was detected, namely a process that quits quickly (e.g. <3 seconds?). However since I did not ran into any issue so far, I'll limit it to this error message change.
Deleting the parent directory is also questionable, but again it did not actually trigger any issue so far.

Diff Detail

Repository
R241 KIO
Lint
Lint Skipped
Unit
Unit Tests Skipped
Lekensteyn created this revision.May 23 2019, 3:39 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 23 2019, 3:39 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
Lekensteyn requested review of this revision.May 23 2019, 3:39 PM
dfaure accepted this revision.May 23 2019, 4:22 PM
This revision is now accepted and ready to land.May 23 2019, 4:22 PM
src/kioexec/main.cpp
261–264

While at it, maybe it could be worth to put 180 in some variable foo and then use foo/60 instead of hardcoding the number of minutes in the debug message.

Lekensteyn marked an inline comment as done.
Lekensteyn edited the test plan for this revision. (Show Details)

Addressed review comment by adding a constant for the interval. Changed minutes -> seconds in the debug message.

src/kioexec/main.cpp
262 ↗(On Diff #58640)

Please use camelCase

Lekensteyn updated this revision to Diff 58714.May 27 2019, 8:56 AM
Lekensteyn set the repository for this revision to R241 KIO.

Using camelCase now.

elvisangelaccio accepted this revision.May 27 2019, 7:26 PM
dfaure accepted this revision.May 29 2019, 7:29 AM
This revision was automatically updated to reflect the committed changes.