Downloading files fails on non-English systems

Bug #1535666 reported by Olivier Tilloy
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Confirmed
High
Bill Filler
webbrowser-app (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

On my desktop setup (French locale), the XDG download folder is named "Téléchargements". The apparmor policy for webbrowser-app specifically requests read/write access to $HOME/Downloads/, which works only on systems where the downloads folder is named "Downloads".

When downloading a file in the browser, I’m seeing the following error in the console:

Failed moving file from "/home/osomon/.local/share/ubuntu-download-manager/webbrowser-app/Downloads/example.pdf" to "/home/osomon/Téléchargements/example.pdf"

I wonder if apparmor exposes a way to specify XDG folders in policies.

Tags: download

Related branches

Revision history for this message
Olivier Tilloy (osomon) wrote :

The XDG downloads folder name is defined by the $XDG_DOWNLOAD_DIR variable in $XDG_CONFIG_HOME/user-dirs.dirs.

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

For XDG translatable user dirs and apparmor policy, please see https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1061693. This only deals with traditional desktop policy though and not touch policy. In terms of support on Touch, it was decided long ago (I can't seem to find the thread, but I can keep looking if required) that we would not support translatable XDG user dirs on the phone (note, they have been problematic for other reasons). This decision was taken early on in the Touch project (I believe seb128 was involved). AIUI, a future converged experience would also not support the problematic translatable XDG user dirs either.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I too remember that decision to not translate XDG folders for touch.
Not sure how well that will play with convergence though.

In any case, I had a look at the contents of /etc/apparmor.d/tunables/xdg-user-dirs.d/site.local on my desktop, and it appears no XDG_* variable is overridden there (all the lines in that file are commented out). How is that supposed to work? Would referencing "@{HOME}/@{XDG_DOWNLOAD_DIR}" work in an apparmor profile?

Revision history for this message
Josué (j2g2rp) wrote :

I'm having that problem. In my case my local is spanish.
The log file from web-browser app returns me that:
Failed moving file from "/home/phablet/.local/share/ubuntu-download-manager/webbrowser-app/Downloads/example.pdf" to "/home/phablet/Downloads/example.pdf"

In my case im not sure if it is related with the local or the translation. I think that it could be because my Downloads folder in /home/phablet is a sym link to : /media/phablet/SD-CARD/Downloads

Maybe webbrowser didn't expect support to move files to a symbolic link folder...
May I report this as a new bug?
http://paste.ubuntu.com/14848556/

Revision history for this message
Olivier Tilloy (osomon) wrote :

Thanks for the report Josué, that is indeed a different issue. I think your suspicion is correct, the apparmor confinement isn’t letting you follow the symlink to the SD card. Did you create that symlink manually? Before filing a separate bug, you might want to expose the problem on the ubuntu-phone mailing list (<email address hidden>), I’m sure security experts can help figure out the issue.

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

/etc/apparmor.d/tunables/xdg-user-dirs.d/site.local is for just that, local site settings and that is why nothing is set in there. To see what apparmor is using as the defaults, see /etc/apparmor.d/tunables/xdg-user-dirs. You are free to adjust /etc/apparmor.d/tunables/xdg-user-dirs (though beware, it is a Debian conffile), /etc/apparmor.d/tunables/xdg-user-dirs.d/site.local or any other file in /etc/apparmor.d/tunables/xdg-user-dirs.d.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I have modified webbrowser-app’s apparmor profile to refer to "@{HOME}/@{XDG_DOWNLOAD_DIR}/" instead of "@{HOME}/Downloads/", but that alone is not enough, I’m still getting the same error on my system with a French locale.

Next I edited /etc/apparmor.d/tunables/xdg-user-dirs.d/site.local to set the value of @{XDG_DOWNLOAD_DIR} to "Téléchargements", reloaded the webbrowser-app profile, and that worked.

I’ll go ahead and submit a change to the browser policy to use @{XDG_DOWNLOAD_DIR}, that can’t hurt either way. However we’ll still be missing a mechanism that automatically sets the value of that variable based on the user’s locale (third bullet point in https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1061693/comments/1).

Changed in webbrowser-app (Ubuntu):
assignee: nobody → Olivier Tilloy (osomon)
Revision history for this message
Josué (j2g2rp) wrote :

@olivier
Yes i made those symlinks with command "ln -s -r" through terminal.
As you suggested I'm going to make it as separate bug. Thanks for the info. I'm not sure if it is a problem with the policy of confinement since if I download a file with dekko I haven't that problem :) thanks.

Revision history for this message
Olivier Tilloy (osomon) wrote :

AFAIK dekko doesn’t download files to the Downloads folder, which would explain why you’re not getting the error with it.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package webbrowser-app - 0.23+16.04.20160303-0ubuntu1

---------------
webbrowser-app (0.23+16.04.20160303-0ubuntu1) xenial; urgency=medium

  [ CI Train Bot ]
  * Resync trunk.

  [ Olivier Tilloy ]
  * Refer to @{XDG_DOWNLOAD_DIR} in the browser’s apparmor profile
    instead of hardcoding "Downloads" in English. (LP: #1535666)
  * Store entries in the history database on load committed, not load
    succeeded. This ensures that content-initiated navigations are also
    stored. (LP: #1455858, #1549780)
  * Update translation template.
  * Visual tweaks per designers’ review.

 -- Olivier Tilloy <email address hidden> Thu, 03 Mar 2016 19:01:40 +0000

Changed in webbrowser-app (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Olivier Tilloy (osomon) wrote :

Not fully fixed per comment #7.

Changed in webbrowser-app (Ubuntu):
assignee: Olivier Tilloy (osomon) → nobody
status: Fix Released → Confirmed
Changed in canonical-devices-system-image:
status: New → Fix Committed
importance: Undecided → High
assignee: nobody → Bill Filler (bfiller)
milestone: none → ww08-2016
Olivier Tilloy (osomon)
Changed in webbrowser-app (Ubuntu):
importance: High → Medium
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
Bill Filler (bfiller)
Changed in canonical-devices-system-image:
milestone: 10 → backlog
status: Fix Released → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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