bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] Problem with fstatat on AIX 7.1


From: Paul Eggert
Subject: Re: [Bug-tar] Problem with fstatat on AIX 7.1
Date: Fri, 02 Sep 2011 11:25:32 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.21) Gecko/20110831 Thunderbird/3.1.13

On 09/02/11 01:10, Kevin Brott wrote:

> using /bin/ksh ...

Yes, that's fine.

> kopen("archive", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 
> S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) = 3
> fstatx(3, 0x20004640, 128, 010)                 = 0
> kfcntl(1, F_GETFL, 0x1006D360)                  = 67110914
> kfcntl(1, F_GETFL, 0x2FF22FFC)                  = 67110914
> src/tarkwrite(2, " s r c / t a r", 7)                   = 7
> : kwrite(2, " :  ", 2)                          = 2
> file1kwrite(2, " f i l e 1", 5)                 = 5
> : Cannot kwrite(2, " :   C a n n o t  ", 9)             = 9
> statkwrite(2, " s t a t", 4)                    = 4

My guess is that tar is invoking this:

  fstatat (AT_FDCWD, "file1", &st, 0)

and somehow fstatat is rejecting this call.
This could be due to a bug in our fstatat replacement, or in
AIX fstatat.  Can you please try to figure out which, by building
tar 1.26 with the following patch instead of the earlier
one that I sent you, and then re-running he test?  On a
properly-configured host, the command

echo xxxx > file1
TAR_OPTIONS=--numeric-owner truss ./tar chof archive file1

should output something like this:

fstatat (-100, "file1", 0x7fffc37ce430, 0) -> 0; st_size = 5

and should succeed.


--- gnu/fstatat-1.26.c  2011-03-12 01:14:29.000000000 -0800
+++ gnu/fstatat.c       2011-09-02 11:17:28.079414855 -0700
@@ -19,8 +19,40 @@
 
 /* Written by Paul Eggert and Jim Meyering.  */
 
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+   the system's <sys/stat.h> here, so that orig_fstatat doesn't recurse to
+   rpl_fstatat.  */
+#define __need_system_sys_stat_h
 #include <config.h>
 
+/* Get the original definition of fstatat.  It might be defined as a macro.  */
+#include <sys/types.h>
+#include <sys/stat.h>
+#undef __need_system_sys_stat_h
+
+#if HAVE_FSTATAT
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+static inline int
+orig_fstatat (int fd, char const *filename, struct stat *buf, int flags)
+{
+  int r, e;
+  r = fstatat (fd, filename, buf, flags);
+  e = errno;
+  fprintf (stderr, "fstatat (%d, \"%s\", %p, %d) -> %d; ",
+          fd, filename, buf, flags, r);
+  if (r != 0)
+    fprintf (stderr, "errno = %d (%s)\n", e, strerror (e));
+  else
+    fprintf (stderr, "st_size = %ld\n", (long) buf->st_size);
+  errno = e;
+  return r;
+}
+#endif
+
 #include <sys/stat.h>
 
 #include <errno.h>
@@ -40,7 +72,7 @@
 int
 rpl_fstatat (int fd, char const *file, struct stat *st, int flag)
 {
-  int result = fstatat (fd, file, st, flag);
+  int result = orig_fstatat (fd, file, st, flag);
   size_t len;
 
   if (result != 0)




reply via email to

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