threads / rfc / 3215

RFC patchSolaris 8: ENOSYS when mkdir applied to automount.

Subject: [RFC & PATCH] Solaris 8: ENOSYS when mkdir applied to automount.

## tl;dr

4 messages between Feb 2, 2006 and Feb 2, 2006. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

Jason Riedy· Feb 2, 2006, 00:39 UTC · lore

I guess our home directories recently were changed from symlinks to autmounts. Solaris 8's mkdir(2) returns ENOSYS when applied to these, breaking safe_create_leading_directories. I don't know if ENOSYS is available everywhere, or if this odd behavior is appropriate everywhere.

This works for me, but should I wrap mkdir for bizarre behavior by adding a compat/gitmkdir.c?

Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
---
 sha1_file.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
4f388cf48271ec1547817a407ef1afe432cd59d4
Show changes to sha1_file.c +8 −0
diff --git a/sha1_file.c b/sha1_file.c
index 20f6419..65407e2 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -83,7 +83,15 @@ int safe_create_leading_directories(char
 			break;
 		*pos = 0;
 		if (mkdir(path, 0777) < 0) {
+#if !defined(ENOSYS)
 			if (errno != EEXIST) {
+#else
+			if (errno != EEXIST && errno != ENOSYS) {
+#endif
+/* 
+ * Solaris 8 appears to return ENOSYS when mkdir is applied 
+ * to an automount.
+ */
 				*pos = '/';
 				return -1;
 			}
-- 
1.1.6.g7159
Junio C Hamano· Feb 2, 2006, 00:46 UTC · re: Jason Riedy · lore

Re: [RFC & PATCH] Solaris 8: ENOSYS when mkdir applied to automount.

Jason Riedy <ejr@EECS.Berkeley.EDU> writes:
Show 8 quoted lines
> I guess our home directories recently were changed from symlinks
> to autmounts.  Solaris 8's mkdir(2) returns ENOSYS when applied
> to these, breaking safe_create_leading_directories.  I don't
> know if ENOSYS is available everywhere, or if this odd behavior
> is appropriate everywhere.
>
> This works for me, but should I wrap mkdir for bizarre behavior
> by adding a compat/gitmkdir.c?

There was a similar patch for working around Cygwin that threw different errno in an earlier thread:

    From: Alex Riesen <raa.lkml@gmail.com>
    Subject: [PATCH] Set errno to EEXIST if mkdir returns EACCES or EPERM

Somehow I started to trust your ability to code portably a lot better than I trust myself, so please first disregard the suggestion I gave in that thread and give me your honest opinion on what the right fix/workaround would be.

Jason Riedy· Feb 2, 2006, 04:14 UTC · re: Junio C Hamano · lore

Re: [RFC & PATCH] Solaris 8: ENOSYS when mkdir applied to automount.

And Junio C Hamano writes:
 - There was a similar patch for working around Cygwin that threw
 - different errno in an earlier thread:

Thanks. The thread mentioned in that one seems to have a few "right" solutions. A compat/gitmkdirat.c likely is the best, modelled after the gnulib one. I'll look at it when I can in the next week or so, so you can ignore my patch.

 - Somehow I started to trust your ability to code portably a lot
 - better than I trust myself, [...]

eep. ;) I only have access to three major variations at the moment (Linux, semi-old Solaris, recent AIX), so I'm not an authority... Solaris 8 is from before the general Linux/glibc compatability movement, so it's pretty useful for testing.

Jason
H. Peter Anvin· Feb 2, 2006, 04:18 UTC · re: Jason Riedy · lore

Re:

Jason Riedy wrote:
Show 8 quoted lines
> I guess our home directories recently were changed from symlinks
> to autmounts.  Solaris 8's mkdir(2) returns ENOSYS when applied
> to these, breaking safe_create_leading_directories.  I don't
> know if ENOSYS is available everywhere, or if this odd behavior
> is appropriate everywhere.
> 
> This works for me, but should I wrap mkdir for bizarre behavior
> by adding a compat/gitmkdir.c?
Wow, Solaris really can be braindamaged sometimes...
	-hpa

← back to recent threads