From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id kMapMYrlkl+uKAAA0tVLHw (envelope-from ) for ; Fri, 23 Oct 2020 14:15:38 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8K74K4rlkl8dHwAAB5/wlQ (envelope-from ) for ; Fri, 23 Oct 2020 14:15:38 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E79AD940396 for ; Fri, 23 Oct 2020 14:15:37 +0000 (UTC) Received: from localhost ([::1]:39524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVxqx-0002DM-FH for larch@yhetil.org; Fri, 23 Oct 2020 10:15:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVxqT-0002D8-IQ for guix-patches@gnu.org; Fri, 23 Oct 2020 10:15:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVxqQ-000814-7U for guix-patches@gnu.org; Fri, 23 Oct 2020 10:15:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVxqQ-0007pL-1U for guix-patches@gnu.org; Fri, 23 Oct 2020 10:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#44130] [PATCH] Add a recursive version of mkdir-p Resent-From: divoplade Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 23 Oct 2020 14:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44130 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 44130@debbugs.gnu.org Received: via spool by 44130-submit@debbugs.gnu.org id=B44130.160346249430058 (code B ref 44130); Fri, 23 Oct 2020 14:15:02 +0000 Received: (at 44130) by debbugs.gnu.org; 23 Oct 2020 14:14:54 +0000 Received: from localhost ([127.0.0.1]:57934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVxqI-0007oj-1u for submit@debbugs.gnu.org; Fri, 23 Oct 2020 10:14:54 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:43129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVxqD-0007oS-T8 for 44130@debbugs.gnu.org; Fri, 23 Oct 2020 10:14:52 -0400 X-Originating-IP: 86.202.110.111 Received: from divoplade.home (lfbn-lyo-1-15-111.w86-202.abo.wanadoo.fr [86.202.110.111]) (Authenticated sender: d@divoplade.fr) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id BD3212000A; Fri, 23 Oct 2020 14:14:43 +0000 (UTC) Message-ID: <85064b7663c320e8062b2db78151d22fc6fcddef.camel@divoplade.fr> From: divoplade Date: Fri, 23 Oct 2020 16:14:42 +0200 In-Reply-To: <87y2jxnl0z.fsf@gnu.org> References: <6ff632f5c1e378647cecc7177b7018fb8a0ee6d4.camel@divoplade.fr> <87y2jxnl0z.fsf@gnu.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: xBfKB+VS7X68 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//, or $HOME/.local/share// 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