GNU bug report logs - #71732
30.0.50; [FR] xdg: provide an ability to create XDG directory, if it does not exist

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Sun, 23 Jun 2024 09:40:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 71732 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: bjorn.bidar <at> thaodan.de, 71732 <at> debbugs.gnu.org
Subject: Re: bug#71732: 30.0.50;
 [FR] xdg: provide an ability to create XDG directory, if it does not
 exist
Date: Sun, 23 Jun 2024 13:12:42 +0300
> Cc: Eli Zaretskii <eliz <at> gnu.org>, Björn Bidar <bjorn.bidar <at> thaodan.de>
> From: Ihor Radchenko <yantar92 <at> posteo.net>
> Date: Sun, 23 Jun 2024 09:40:49 +0000
> 
> Currently `xdg-cache-home`, and other functions in xdg.el only return
> the path, but never create any directories.

Yes, because whether or not to create a missing directory is up to the
calling application.  For example, if the application is looking for a
file in several possible locations, then a missing directory means
that particular location doesn't have the file, and the application
should look in the other places.

> However, to follow XDG spec, XDG directories must follow certain
> rules. In particular:
> 
>     If, when attempting to write a file, the destination directory is
>     non-existent an attempt should be made to create it with permission
>     0700. If the destination directory exists already the permissions
>     should not be changed.
>   https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
> 
> May you please add a functionality to xdg.el to create the directory
> with right permissions, so that xdg.el users do not need to know these
> technical details of the spec?

xdg.el is not about creating directories, it is about returning their
names.

The ability to create a directory with arbitrary permissions already
exists, and Emacs uses that in umpteen places.  So I'm not sure what
is missing here.  Not every two-liner needs a dedicated named API.




This bug report was last modified 1 year and 59 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.