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

4 messages from 2006-02-02 to 2006-02-02. Participants: Jason Riedy, Junio C Hamano, H. Peter Anvin.
Thread: https://gitlist.dev/t/3215

## Jason Riedy, 2006-02-02 00:39

Subject: [RFC & PATCH] Solaris 8: ENOSYS when mkdir applied to automount.
Message-ID: <24768.1138840762@lotus.CS.Berkeley.EDU>
URL: https://gitlist.dev/e/24768.1138840762%40lotus.CS.Berkeley.EDU

```
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
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, 2006-02-02 00:46

Subject: Re: [RFC & PATCH] Solaris 8: ENOSYS when mkdir applied to automount.
Message-ID: <7vwtge37w5.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vwtge37w5.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <24768.1138840762@lotus.CS.Berkeley.EDU>

```
Jason Riedy <ejr@EECS.Berkeley.EDU> writes:

> 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, 2006-02-02 04:14

Subject: Re: [RFC & PATCH] Solaris 8: ENOSYS when mkdir applied to automount.
Message-ID: <25920.1138853640@lotus.CS.Berkeley.EDU>
URL: https://gitlist.dev/e/25920.1138853640%40lotus.CS.Berkeley.EDU
In-Reply-To: <7vwtge37w5.fsf@assigned-by-dhcp.cox.net>

```
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, 2006-02-02 04:18

Subject: Re:
Message-ID: <43E1882A.307@zytor.com>
URL: https://gitlist.dev/e/43E1882A.307%40zytor.com
In-Reply-To: <24768.1138840762@lotus.CS.Berkeley.EDU>

```
Jason Riedy wrote:
> 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

```
