Hello.

I have a fix for 'bug 21062 coreutils-8.24 - cp(1) check failures on tmpfs filesystem (Solaris 10 / Solaris 11)'.

The issue is that when on tmpfs we use acl(), trying to set ACL, it sets errno to ENOSYS (ACLs not supported). set_acls still returns 0, but it spoils errno. When we do "cp -a", later this ENOSYS appears in set_acls() results.
(I still don't quite understand, why return code is not 0).
The easiest fix here is to resetting errno to 0 when we are not going to return non-zero result immediately

https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/sysutils/coreutils/patches/set-permission.c.patch

--
System Administrator of Southern Federal University Computer Center
GNU Coreutils bug 21062 coreutils-8.24 - cp(1) check failures on tmpfs filesystem (Solaris 10 / Solaris 11)

/* Avoid spoiling errno when we are going to ignore it immediately anyway */

--- lib/set-permissions.c.~1~	2017-09-01 10:12:43.000000000 +0000
+++ lib/set-permissions.c	2018-01-26 01:03:30.175900217 +0000
@@ -230,6 +230,7 @@
         {
           if (errno == ENOSYS)
 	    {
+	      errno = 0;
 	      *must_chmod = true;
 	      return 0;
 	    }
@@ -265,6 +266,7 @@
 	if (errno == ENOSYS || errno == EOPNOTSUPP)
 	  {
 	    *must_chmod = true;
+	    errno = 0;
 	    return 0;
 	  }
 	return -1;
@@ -634,6 +636,7 @@
 	  if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
 	      && acl_nontrivial (ctx->count, ctx->entries) == 0)
 	    ret = 0;
+	    errno = 0;
 	}
       else
 	*acls_set = true;
@@ -651,6 +654,7 @@
 	  if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP)
 	      && acl_ace_nontrivial (ctx->ace_count, ctx->ace_entries) == 0)
 	    ret = 0;
+	    errno = 0;
 	}
       else
 	*acls_set = true;

Reply via email to