* [PATCH shepherd v2] support: Ignore errors in mkdir-p when the directories exist.
@ 2016-02-05 18:23 David Michael
2016-02-06 13:22 ` Ludovic Courtès
0 siblings, 1 reply; 2+ messages in thread
From: David Michael @ 2016-02-05 18:23 UTC (permalink / raw)
To: guix-devel
* modules/shepherd/support.scm (mkdir-p): Don't throw errors when
mkdir fails but the directory exists afterwards.
---
modules/shepherd/support.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index 9bc5f5d..4059770 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -172,7 +172,8 @@ output port, and PROC's result is returned."
(mkdir path))
(loop tail path))
(lambda args
- (if (= EEXIST (system-error-errno args))
+ (if (and (file-exists? path)
+ (eq? (stat:type (stat path)) 'directory))
(loop tail path)
(apply throw args))))))
(() #t))))
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH shepherd v2] support: Ignore errors in mkdir-p when the directories exist.
2016-02-05 18:23 [PATCH shepherd v2] support: Ignore errors in mkdir-p when the directories exist David Michael
@ 2016-02-06 13:22 ` Ludovic Courtès
0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2016-02-06 13:22 UTC (permalink / raw)
To: David Michael; +Cc: guix-devel
David Michael <fedora.dm0@gmail.com> skribis:
> * modules/shepherd/support.scm (mkdir-p): Don't throw errors when
> mkdir fails but the directory exists afterwards.
[...]
> - (if (= EEXIST (system-error-errno args))
> + (if (and (file-exists? path)
> + (eq? (stat:type (stat path)) 'directory))
This systematically does two ‘stat’ calls and can raise an exception if
PATH does not exist.
I’ve adjusted it in commit 66662cf such that on GNU/Linux there’s no
extra ‘stat’.
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-06 13:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-05 18:23 [PATCH shepherd v2] support: Ignore errors in mkdir-p when the directories exist David Michael
2016-02-06 13:22 ` Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.