bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#6053: cp, ls, and mv bug: unknown error (252)


From: Bruno Haible
Subject: Re: bug#6053: cp, ls, and mv bug: unknown error (252)
Date: Mon, 13 Jun 2011 01:18:02 +0200
User-agent: KMail/1.9.9

Pádraig Brady wrote on 2010-06-10, and Eric committed the patch on 2010-08-10:
> I left the solaris and cygwin code doing the explicit errno checks,
> but suggest they also change to the more general check too.
> 
>  diff ../gnulib/lib/copy-acl.c gnulib/lib/copy-acl.c
> --- ../gnulib/lib/copy-acl.c    2010-03-03 11:23:22.000000000 +0000
> +++ gnulib/lib/copy-acl.c       2010-06-10 14:10:19.000000000 +0000
> @@ -420,7 +420,7 @@
> 
>        if (count < 0)
>          {
> -          if (errno == ENOSYS || errno == EOPNOTSUPP)
> +          if (ACL_NOT_WELL_SUPPORTED (errno))
>              {
>                count = 0;
>                break;
> @@ -455,7 +455,7 @@
>      {
>        int saved_errno = errno;
> 
> -      if (errno == ENOSYS || errno == EOPNOTSUPP)
> +      if (ACL_NOT_WELL_SUPPORTED (errno))
>          {
>            struct stat source_statbuf;

Sorry for not having reviewed this patch earlier. If getacl() can return
errno = ENOTSUP, there are 4 files which need to be updated, not just one.
And one of them is tests/test-sameacls.c, which is not supposed to include
"acl-internal.h". So in order to treat all 4 files consistently, it's
better to not use ACL_NOT_WELL_SUPPORTED. I'm applying this followup to your
fix:


2011-06-12  Bruno Haible  <address@hidden>

        acl: Complete the 2010-08-10 fix.
        * lib/file-has-acl.c (file_has_acl) [HP-UX]: Also test against ENOTSUP.
        * lib/set-mode-acl.c (qset_acl) [HP-UX]: Likewise.
        * lib/copy-acl.c (qcopy_acl) [HP-UX]: Test for the errno values
        explicitly.
        * tests/test-sameacls.c (main) [HP-UX]: Also test against ENOTSUP.
        Reported in <http://debbugs.gnu.org/db/60/6053.html>.

--- lib/copy-acl.c.orig Mon Jun 13 01:02:37 2011
+++ lib/copy-acl.c      Mon Jun 13 01:00:19 2011
@@ -420,7 +420,7 @@
 
       if (count < 0)
         {
-          if (ACL_NOT_WELL_SUPPORTED (errno))
+          if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
             {
               count = 0;
               break;
@@ -455,7 +455,7 @@
     {
       int saved_errno = errno;
 
-      if (ACL_NOT_WELL_SUPPORTED (errno))
+      if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
         {
           struct stat source_statbuf;
 
--- lib/file-has-acl.c.orig     Mon Jun 13 01:02:37 2011
+++ lib/file-has-acl.c  Mon Jun 13 01:02:19 2011
@@ -527,7 +527,15 @@
           count = getacl (name, 0, NULL);
 
           if (count < 0)
-            return (errno == ENOSYS || errno == EOPNOTSUPP ? 0 : -1);
+            {
+              /* ENOSYS is seen on newer HP-UX versions.
+                 EOPNOTSUPP is typically seen on NFS mounts.
+                 ENOTSUP was seen on Quantum StorNext file systems (cvfs).  */
+              if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+                return 0;
+              else
+                return -1;
+            }
 
           if (count == 0)
             return 0;
--- lib/set-mode-acl.c.orig     Mon Jun 13 01:02:37 2011
+++ lib/set-mode-acl.c  Mon Jun 13 01:00:19 2011
@@ -432,7 +432,7 @@
     ret = setacl (name, sizeof (entries) / sizeof (struct acl_entry), entries);
   if (ret < 0)
     {
-      if (errno == ENOSYS || errno == EOPNOTSUPP)
+      if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
         return chmod_or_fchmod (name, desc, mode);
       return -1;
     }
--- tests/test-sameacls.c.orig  Mon Jun 13 01:02:37 2011
+++ tests/test-sameacls.c       Mon Jun 13 01:00:19 2011
@@ -360,10 +360,12 @@
   int count2;
 
   count1 = getacl (file1, 0, NULL);
-  if (count1 < 0 && (errno == ENOSYS || errno == EOPNOTSUPP))
+  if (count1 < 0
+      && (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP))
     count1 = 0;
   count2 = getacl (file2, 0, NULL);
-  if (count2 < 0 && (errno == ENOSYS || errno == EOPNOTSUPP))
+  if (count2 < 0
+      && (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP))
     count2 = 0;
 
   if (count1 < 0)

-- 
In memoriam Medgar Evers <http://en.wikipedia.org/wiki/Medgar_Evers>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]