-
-
Save lduboeuf/6318ee3eb4b3cb63645b017e99e9a33b to your computer and use it in GitHub Desktop.
Music app can't play imported file. | |
The File is well copied but no entry in MediaStore db. | |
watch inotify events: | |
inotifywait -rme modify,attrib,move,close_write,create,delete,delete_self /home/phablet/Music/Imported/2021/09/03 | |
QFile::rename + QFile::copy ( actual content-hub code contentItem.cpp/move method ) | |
/home/phablet/Music/Imported/2021/09/03/ CREATE 094451-pikatchu.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY 094451-pikatchu.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY 094451-pikatchu.wav | |
/home/phablet/Music/Imported/2021/09/03/ CLOSE_WRITE,CLOSE 094451-pikatchu.wav | |
/home/phablet/Music/Imported/2021/09/03/ DELETE 094451-pikatchu.wav => (QFile::rename fails, thus try to restore state by removing the destination part ) | |
Now "move" method from ContentHub ContentItem.cpp try to use copy: | |
/home/phablet/Music/Imported/2021/09/03/ CREATE qt_temp.noaGQp | |
/home/phablet/Music/Imported/2021/09/03/ CLOSE_WRITE,CLOSE qt_temp.noaGQp | |
/home/phablet/Music/Imported/2021/09/03/ CREATE 094451-pikatchu.wav | |
/home/phablet/Music/Imported/2021/09/03/ DELETE qt_temp.noaGQp | |
/home/phablet/Music/Imported/2021/09/03/ ATTRIB 094451-pikatchu.wav | |
QFile::copy only ( test in content-hub code contentItem.cpp/move method ) | |
/home/phablet/Music/Imported/2021/09/03/ CREATE qt_temp.FWblFL | |
/home/phablet/Music/Imported/2021/09/03/ CLOSE_WRITE,CLOSE qt_temp.FWblFL | |
/home/phablet/Music/Imported/2021/09/03/ CREATE 102117-hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ DELETE qt_temp.FWblFL | |
/home/phablet/Music/Imported/2021/09/03/ ATTRIB 102117-hhhh.wav | |
QFile::copy ( not on UT ): | |
/home/xxx/untitled/ MODIFY #3414925 | |
/home/xxx/untitled/ CREATE twa-dev.png | |
/home/xxx/untitled/ CLOSE_WRITE,CLOSE #3414925 | |
/home/xxx/untitled/ ATTRIB twa-dev.png | |
copy with filemanager: | |
/home/phablet/Music/Imported/2021/09/03/ CREATE hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ CLOSE_WRITE,CLOSE hhhh.wav | |
/home/phablet/Music/Imported/2021/09/03/ ATTRIB hhhh.wav | |
copy via cp: | |
/home/phablet/Music/Imported/2021/09/03/ CREATE tikitildjdjdj.wav | |
/home/phablet/Music/Imported/2021/09/03/ MODIFY tikitildjdjdj.wav | |
/home/phablet/Music/Imported/2021/09/03/ CLOSE_WRITE,CLOSE tikitildjdjdj.wav | |
mv: | |
/home/phablet/Music/Imported/2021/09/03/ MOVED_TO tombrr.wav |
QFile::rename in content-hub (https://gitlab.com/ubports/core/content-hub/-/blob/ubports/xenial/import/Ubuntu/Content/contentitem.cpp#L229) is not working, fails when trying to remove the source file
AppArmor issue :
apparmor="DENIED" operation="link" profile="com.ubuntu.music_music_2.9.23" name="/home/phablet/Music/Imported/2021/09/03/094451-pikatchu.wav" pid=5310 comm="qmlscene" requested_mask="wacd" denied_mask="wacd" fsuid=32011 ouid=32011 target="/home/phablet/.cache/com.ubuntu.music/HubIncoming/2/094451-pikatchu.wav"
This is intentional rule:
apparmor-easyprof-ubuntu/data/policygroups/ubuntu/16.04/content_exchange
deny @{HOME}/.cache/@{APP_PKGNAME}/HubIncoming/** w,
we could use QFile::copy but that will not trigger the right inotify events
except if QT_NO_TEMPORARYFILE definition is set
So actually, mediaScanner listen to CLOSE_WRITE event to create an entry in db, but as we see, a DELETE event is fired which remove that entry,.. That explain the model being null and music app doesn't play it.
Another issue here is that tmp file is created by Qt in destination folder, that triggers a useless insert/delete in the mediaStorage.