Launchpadlib doesn't respect the XDG Base Directory specifcation

Bug #509168 reported by Sense Egbert Hofstede
42
This bug affects 6 people
Affects Status Importance Assigned to Milestone
launchpadlib
Triaged
Low
Unassigned
python-launchpadlib (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Launchpadlib saves its cache in the text file ~/.launchpadlib/cache. However, this doesn't comply with the XDG Base Directory specification. The specification defines three directories:
* $XDG_DATA_HOME: default ~/.local/share/, contains irreplaceable data;
* $XDG_CONFIG_HOME: default ~/.config/, contains configuration;
* $XDG_CACHE_HOME: default ~/.cache/, contains cached data.

The default directories can be changed by changing the environment variables, therefore I would suggest Launchpadlib to use 'python-xdg', also known as 'pyxdg', to determine the cache directory.

The XDG Base Directory specification can be found here: <http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>.

Revision history for this message
Gavin Panella (allenap) wrote :

This makes sense, but bear in mind that launchpadlib will often be run in a non-desktop environment. How applicable is the XDG Base Directory spec for server and other non-desktop environments?

Changed in launchpadlib:
status: New → Incomplete
Revision history for this message
Sense Egbert Hofstede (sense) wrote :

Indeed I'm not sure if this specification was written with servers in mind. However, I do think that it would still be a good thing for Launchpadlib to have, and not only because it's used on desktop as well.

This blogpost has a good list of reasons: <http://ploum.frimouvy.org/?207-modify-your-application-to-use-xdg-folders>.
    * a lot less cluttered $HOME (my mother will not cry anymore when the gtk file selector randomly choose to display hidden folders)
    * Make backups a lot more safer and easier. (you know that backuping your $XDG_DATA_HOME along with your files is enough)
    * A lot easier to reset a default configuration if you want/need it (and without any risk to loose informations). Even for the software itself could choose to reset $XDG_CONFIG_HOME if needed.
    * Avoid some strange bugs that happens because you had a old version of some configuration file
    * A lot more of flexibility and portability because no path are hardcoded. You use the XDG library that does the job for you. If you don't want the dependency, implementing the XDG specification is only a few lines of code.

Although the first reason probably doesn't apply to servers, the rest do.

Python-xdg is already a dependency of python-desktopcouch, bzr-svn and sinntp.

Revision history for this message
Gavin Panella (allenap) wrote :

Sounds like a good feature to have :)

Changed in launchpadlib:
importance: Undecided → Medium
status: Incomplete → Triaged
Revision history for this message
Martin Owens (doctormo) wrote :

I already use launchpadlib with xdg, mostly I simply specify the cache dir. see here: http://bazaar.launchpad.net/~doctormo/groundcontrol/trunk/annotate/head%3A/GroundControl/launchpad.py

Although my code uses a friendly xdg wrapper called xdgapp.py it should be easy to see what it's doing.

Revision history for this message
Sense Egbert Hofstede (sense) wrote :

Subscribing Brian Murray since a change to this will make at least lp:~ubuntu-bugcontrol/apport/ubuntu-bugpatterns unusable since it looks in ~/.launchpadlib for the credentials.

Revision history for this message
Leonard Richardson (leonardr) wrote :

I'm interested in hearing how this bug interacts with bug 293623. Is there a standard place for putting information like credentials that ought to be kept encrypted?

Revision history for this message
Martin Pool (mbp) wrote :

bug 293623 ought to be closed wontfix in favor of putting its credentials in the keyring, and Launchpad should cache its data in the standard location.

Revision history for this message
Martin Pool (mbp) wrote :

Sorry, that previous comment was a bit unclear; I do realize the keyring is not going to be available everywhere. My point was more that the possibility the user might want to keep their credentials encrypted or otherwise secured is a reason _to_ put it in the standard location, rather than otherwise.

Changed in launchpadlib:
importance: Medium → Low
Changed in python-launchpadlib (Ubuntu):
status: New → Triaged
importance: Undecided → Low
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.