unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: divoplade <d@divoplade.fr>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 44130@debbugs.gnu.org
Subject: [bug#44130] [PATCH] Add a recursive version of mkdir-p
Date: Fri, 23 Oct 2020 16:14:42 +0200	[thread overview]
Message-ID: <85064b7663c320e8062b2db78151d22fc6fcddef.camel@divoplade.fr> (raw)
In-Reply-To: <87y2jxnl0z.fsf@gnu.org>

Hi,

Le vendredi 23 octobre 2020 à 15:12 +0200, Ludovic Courtès a écrit :
> It’s likely that packages that need ‘mkdir-p’ also need other high-
> level
> file system operations that Gash (say) provides.  In that case, I’d
> encourage people to depend on Gash.  If Gash is too big a dependency
> for
> the project, including its own copy of this 24-line procedure is
> probably acceptable.

This function is needed for nearly all desktop applications. In the
freedesktop.org world of specifications, your application should store
data in different places in the home directory of the user. The
application data, such as your bookmarks, should be stored in
$XDG_DATA_HOME/<app>/, or $HOME/.local/share/<app>/ if XDG_DATA_HOME is
not set. So if that's a fresh system, or you want to have different
folders in your application data, you will need to make sure that an
arbitrary long chain of directories exist before writing your files.
You can't expect a static chain of directories, since you have to rely
on an environment variable. This is one example, but as a general rule,
whenever you want to write to a file, guile will create it if it does
not exist, because the intent is "do whatever it takes to have that
file and let me write to it".

As I explained, copying the function is not a good thing, because it
will need to adapt. If not a package, the solution could take the form
of a gnulib for guile (which makes little sense since the whole guile
is the standard library), or...

> All that said, I do think that Guile itself should eventually include
> some of the utilities found in (guix build utils) or Gash.

I really think that would be the ideal solution. I understand that you
don't want my package (to be fair, I'm not satisfied with one-package-
per-function either), but the need for that particular function exceeds
that of most other from guix build utils or gash.

Look, even guix itself does not care about mkdir! I get 481 instances
of '(mkdir ' in the source, for 1317 instances of '(mkdir-p '. That
should say something about having a mkdir function by default, but not 
mkdir-p. The only functions from guix build utils that have more than
100 calls (detected as '(fun ') are with-directory-excursion (616),
install-file (1018) (half of its job being mkdir-p), copy-recursively
(559), delete-file-recursively (470), find-files (1161), which (1423,
that's more than mkdir-p), modify-phases (4556, that's a lot more but
it's very specific to guix), substitute* (4240, same), wrap-program
(311, same), and invoke (2242). So I think if you want to import one
function from guix build utils into guile, start with mkdir-p!

Best regards,

divoplade





  reply	other threads:[~2020-10-23 14:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21 23:29 [bug#44130] [PATCH] Add a recursive version of mkdir-p divoplade
2020-10-23 13:12 ` Ludovic Courtès
2020-10-23 14:14   ` divoplade [this message]
2020-10-23 16:37     ` Ludovic Courtès
2020-10-23 17:12       ` divoplade
2020-10-26 16:57         ` bug#44130: " Ludovic Courtès
2020-10-23 19:36 ` [bug#44130] " zimoun
2020-10-23 22:00   ` [bug#44130] Recursive mkdir divoplade
2020-10-23 22:11   ` [bug#44130] [PATCH] Add a recursive version of mkdir-p divoplade
2020-10-23 20:01 ` Leo Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85064b7663c320e8062b2db78151d22fc6fcddef.camel@divoplade.fr \
    --to=d@divoplade.fr \
    --cc=44130@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).