ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #13954
Re: [ubuntu-phone] QStorageInfo::bytesAvailable() returns bytes available from root path if the app is Apparmor restricted
On Tue, Jun 23, 2015 at 8:00 PM, Frans Schreuder
<fransschreuder@xxxxxxxxx> wrote:
> Hello,
>
> On 06/23/2015 05:08 PM, Alberto Mardegan wrote:
>
> Hi,
>
> On 23.06.2015 17:20, Frans Schreuder wrote:
>> I would like to show the space available for downloading maps in
>> the OSMScout app. QStorageInfo::bytesAvailable() provides exactly
>> the information that I need, however when the application is
>> confined, it returns the free space on "/" in stead of the folder I
>> specified which is "
>> /home/phablet/.local/share/osmscout.fransschreuder/"
>
>> Is there a way to get the space available as a normal user?
>
> Just initialize the QStorageInfo object with the path to your app's data:
>
> QStorageInfo(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
>
> http://doc.qt.io/qt-5/qstorageinfo.html#QStorageInfo-2
>
> Ciao,
> Alberto
>
>>
> That's exactly what I did, however it seems to be blocked by AppArmor. When
> running "unconfined" it works fine with the right path, without it it
> returns the free space of the "/" partition
You’re right, apparmor is denying system calls that would allow
QStorageInfo to return the correct available disk space. This is
rather annoying, and it also affects all webapps. I filed
https://launchpad.net/bugs/1471890 to track the issue. Let’s see if we
can find an elegant solution to it.
Cheers,
Olivier
References