clock app, gallery, etc using incorrect path for config file due to StateSaver

Bug #1288742 reported by Jamie Strandboge
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ubuntu Clock App
Invalid
Undecided
Unassigned
qtbase-opensource-src (Ubuntu)
Invalid
Undecided
Unassigned
qtorganizer5-eds (Ubuntu)
Invalid
Undecided
Unassigned
ubuntu-ui-toolkit (Ubuntu)
Fix Released
High
Zsombor Egri

Bug Description

The following apparmor denials were observed with 1.0.349 of the clock-app:
Mar 6 07:22:07 ubuntu-phablet kernel: [167149.647858] type=1400 audit(1394112127.627:121): apparmor="DENIED" operation="mknod" parent=1696 profile="com.ubuntu.clock_clock_1.0.349" name="/home/phablet/.config/com.ubuntu.clock.conf.J16567" pid=16567 comm="qmlscene" requested_mask="c" denied_mask="c" fsuid=32011 ouid=32011
Mar 6 07:22:07 ubuntu-phablet kernel: [167149.648224] type=1400 audit(1394112127.627:122): apparmor="DENIED" operation="mknod" parent=1696 profile="com.ubuntu.clock_clock_1.0.349" name="/home/phablet/.config/com.ubuntu.clock.conf.T16567" pid=16567 comm="qmlscene" requested_mask="c" denied_mask="c" fsuid=32011 ouid=32011

The above looks to be a temporary file that would be written before moving the final file to /home/phablet/.config/com.ubuntu.clock.conf. This denial is preventing saving to the config file. AppArmor policy already has these rules:

@{APP_PKGNAME}="com.ubuntu.clock"
  ...
  owner @{HOME}/.config/@{APP_PKGNAME}/ rw, # subdir of XDG_CONFIG_HOME
  owner @{HOME}/.config/@{APP_PKGNAME}/** mrwkl,

Please adjust the clock app to use ~/.config/com.ubuntu.clock/com.ubuntu.clock.conf instead of ~/.config/com.ubuntu.clock.conf. I couldn't find anything in the clock app that showed it specified this file itself, so this is likely a toolkit issue.

Adding an ubuntu-ui-toolkit task. Please feel free to close the clock app task if the bug is in ubuntu-ui-toolkit or vice versa.

Related branches

description: updated
Changed in ubuntu-ui-toolkit (Ubuntu):
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Confirmed
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

I added the qtorganizer5-eds task since it was assigned via the just now duped bug, but it seems odd that the clock app would be using qtorganizer5-eds. Please adjust as necessary.

Changed in qtorganizer5-eds (Ubuntu):
assignee: nobody → Timo Jyrinki (timo-jyrinki)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

The clock app uses qtorganizer5-eds for the alarms feature. But it doesn't do it directly. It uses the Alarms API (provided by the SDK) which in turn uses EDS for storing and retrieving alarms.

Changed in qtorganizer5-eds (Ubuntu):
assignee: Timo Jyrinki (timo-jyrinki) → Renato Araujo Oliveira Filho (renatofilho)
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: nobody → Christian Dywan (kalikiana)
Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

Closing clock-app bug since this is a bug upstream in qtorganizer5-eds and ui-toolkit-plugin.

Changed in ubuntu-clock-app:
status: New → Invalid
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Actually, sarnold pointed out that the temp file seems to try to be unpredictable, but really isn't:
16:25 <@jdstrand> com.ubuntu.clock.conf.T16567
16:25 <@jdstrand> pid=16567
16:25 <@jdstrand> com.ubuntu.clock.conf.J16567
16:25 <@jdstrand> pid=16567

It would probably be a good idea to use mkstemp() or some safe Qt temporary file API instead. I'm pretty sure this applies to /tmp/*.sci files as well:
/tmp/J16373.sci
/tmp/J16461.sci

Revision history for this message
Cris Dywan (kalikiana) wrote :

I think this is StateSaver using QSettings which writes the $APP_ID.conf file - the temporariy file is not being created from within the StateSaver code.

Changed in qtorganizer5-eds (Ubuntu):
status: New → Invalid
assignee: Renato Araujo Oliveira Filho (renatofilho) → nobody
Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: Christian Dywan (kalikiana) → nobody
status: Confirmed → Invalid
Changed in qtbase-opensource-src (Ubuntu):
status: New → Confirmed
Revision history for this message
Zsombor Egri (zsombi) wrote :

Yes, Christian is right. The file has been created by the StateSaver using QSettings default behavior. There is an MR which forces the creation of the file into /tmp folder. The MR has not been landed yet.

Changed in ubuntu-ui-toolkit (Ubuntu):
assignee: nobody → Zsombor Egri (zsombi)
status: Invalid → In Progress
Revision history for this message
Cris Dywan (kalikiana) wrote :

Still discussing this issue, there may be a branch which would solve this effectively which I'm going to review.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Note: be sure to honor TMPDIR and not hardcode /tmp. Also, the tmp file path that is used suggests that the final config file will be ~/.config/com.ubuntu.clock.conf, but this is not an allowed path. Plesae verify/adjust to use this instead:
  ~/.config/com.ubuntu.clock/com.ubuntu.clock.conf

Revision history for this message
Zsombor Egri (zsombi) wrote :

The MP attached uses QStandardPaths::standardLocations(QStandardPaths::TempLocation)[0] to get the first temp folder to store the file.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

This is also affecting the gallery-app. Eg:
Mar 24 15:12:32 ubuntu-phablet kernel: [ 520.697146] type=1400 audit(1395673952.384:176): apparmor="DENIED" operation="mknod" parent=2068 profile="com.ubuntu.gallery_gallery_2.9.1.931" name="/home/phablet/.config/com.ubuntu.gallery_gallery_2.9.1.931.conf.TJ3909" pid=3909 comm="gallery-app" requested_mask="c" denied_mask="c" fsuid=32011 ouid=32011
Mar 24 15:12:32 ubuntu-phablet kernel: [ 520.698183] type=1400 audit(1395673952.384:177): apparmor="DENIED" operation="mknod" parent=2068 profile="com.ubuntu.gallery_gallery_2.9.1.931" name="/home/phablet/.config/com.ubuntu.gallery_gallery_2.9.1.931.conf.XM3909" pid=3909 comm="gallery-app" requested_mask="c" denied_mask="c" fsuid=32011 ouid=32011
Mar 24 15:12:32 ubuntu-phablet kernel: [ 520.699313] type=1400 audit(1395673952.384:178): apparmor="DENIED" operation="mknod" parent=2068 profile="com.ubuntu.gallery_gallery_2.9.1.931" name="/home/phablet/.config/com.ubuntu.gallery_gallery_2.9.1.931.conf.Lh3909" pid=3909 comm="gallery-app" requested_mask="c" denied_mask="c" fsuid=32011 ouid=32011

summary: - clock app using incorrect path for config file
+ clock app, gallery, etc using incorrect path for config file due to
+ StateSaver
Revision history for this message
Zsombor Egri (zsombi) wrote :

The MP from UITK should come in the next UITK release.

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

This was fixed a long time ago.

Changed in qtbase-opensource-src (Ubuntu):
status: Confirmed → Invalid
Changed in ubuntu-ui-toolkit (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.