Skip to contentSkip to conversation

Solaris 8: ENOSYS when mkdir applied to automount.

RFC PATCH In review Jason Riedy 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Solaris 8: ENOSYS when mkdir applied to automount.

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?

---

 sha1_file.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

4f388cf48271ec1547817a407ef1afe432cd59d4

sha1_file.c +8 -0
index 20f6419..65407e2 100644
@@ -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;
 			}
Signature · 1 line
1.1.6.g7159
#1 lore raw

Re:

Quoted 8 lines · Jason Riedy

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

#2 lore raw
In reply to Jason Riedy
Quoted 8 lines · Jason Riedy

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 <[email protected]>
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.

#3 lore raw

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