bug-coreutils
[Top][All Lists]
Advanced

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

Re: Small patch for AIX & HP-UX


From: Jim Meyering
Subject: Re: Small patch for AIX & HP-UX
Date: Thu, 26 Jun 2008 21:10:21 +0200

"Peter O'Gorman" <address@hidden> wrote:
> When building coreutils-6.12 with some patches from git, we noticed that
> the mkdir/selinux test fails. AIX-5.3 output:
>
> failed to set default file creation context to `invalid-selinux-context': 
> Unsupported attribute value
>
> The misc/shred-exact test failed on hp-ux because fdatasync failed with
> EISDIR for '.' multiple times.

Thanks for the reports and patches.
I've applied those with minor changes.

When submitting patches in the future, please
look at the relatively new guidelines in HACKING.
The goal is that you'd format each patches you send
with something like this:

  git format-patch --stdout -1 > DIFF

And then, I can apply (preserving authorship and file permissions,
additions and removals) with a simple "git am DIFF".

>From 27311c9e8544b6b11e7e86dfa1b8597ff1d9eb75 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 26 Jun 2008 10:02:32 +0200
Subject: [PATCH] shred: also ignore EISDIR upon failed fsync/fdatasync on HP-UX

* src/shred.c (ignorable_sync_errno): New function.
(dosync): Use it.
Based on a patch from Peter O'Gorman.
---
 src/shred.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/shred.c b/src/shred.c
index bfafa96..765e1b5 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -277,6 +277,17 @@ passname (unsigned char const *data, char 
name[PASS_NAME_SIZE])
     memcpy (name, "random", PASS_NAME_SIZE);
 }

+/* Return true when it's ok to ignore an fsync or fdatasync
+   failure that set errno to ERRNO_VAL.  */
+static bool
+ignorable_sync_errno (int errno_val)
+{
+  return (errno_val == EINVAL
+         || errno_val == EBADF
+         /* HP-UX does this */
+         || errno_val == EISDIR);
+}
+
 /* Request that all data for FD be transferred to the corresponding
    storage device.  QNAME is the file name (quoted for colons).
    Report any errors found.  Return 0 on success, -1
@@ -292,7 +303,7 @@ dosync (int fd, char const *qname)
   if (fdatasync (fd) == 0)
     return 0;
   err = errno;
-  if (err != EINVAL && err != EBADF)
+  if ( ! ignorable_sync_errno (err))
     {
       error (0, err, _("%s: fdatasync failed"), qname);
       errno = err;
@@ -303,7 +314,7 @@ dosync (int fd, char const *qname)
   if (fsync (fd) == 0)
     return 0;
   err = errno;
-  if (err != EINVAL && err != EBADF)
+  if ( ! ignorable_sync_errno (err))
     {
       error (0, err, _("%s: fsync failed"), qname);
       errno = err;
--
1.5.6.66.g30faa


>From 58b2e1204a000fdcbdac42e427c5556dddf40aea Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <address@hidden>
Date: Thu, 26 Jun 2008 20:57:11 +0200
Subject: [PATCH] tests: accommodate difference in an AIX 5.3 diagnostic

* tests/mkdir/selinux: Handle different strerror (ENOTSUP) spelling.
---
 tests/mkdir/selinux |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tests/mkdir/selinux b/tests/mkdir/selinux
index 291d62d..4a01a43 100755
--- a/tests/mkdir/selinux
+++ b/tests/mkdir/selinux
@@ -43,12 +43,14 @@ for cmd_w_arg in 'mkdir dir' 'mknod b p' 'mkfifo f'; do

   # Some systems fail with ENOTSUP, EINVAL, ENOENT, or even
   # "Unknown system error", or "Function not implemented".
+  # For AIX 5.3: "Unsupported attribute value"
   sed                                  \
     -e 's/ Not supported$//'           \
     -e 's/ Invalid argument$//'                \
     -e 's/ Unknown system error$//'    \
     -e 's/ Operation not supported$//' \
     -e 's/ Function not implemented$//'        \
+    -e 's/ Unsupported attribute value$//'     \
     -e 's/ No such file or directory$//' out > k || fail=1
   mv k out || fail=1
   compare out exp || fail=1
--
1.5.6.66.g30faa




reply via email to

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