bug-gnu-utils
[Top][All Lists]
Advanced

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

GNU tar patch for 1.13.19 (EPERM bug)


From: Jason Kim
Subject: GNU tar patch for 1.13.19 (EPERM bug)
Date: Mon, 6 May 2002 22:10:34 -0400 (EDT)

No copyrights reserved for this patch. 

Please see ChangeLog for details.

This patch was tested AFTER all patches in the Redhat SRPM was applied to
1.13.19 (tar-1.13.19-6.src.rpm)

Thanks

-jason kim

*** /tmp/tar-1.13.19/configure.in       Sun May  5 18:47:31 2002
--- tar-1.13.19/configure.in    Sun May  5 18:23:07 2002
***************
*** 142,147 ****
--- 142,165 ----
      [Define if struct stat has a char st_fstype[] member.])
  fi
  
+ AC_MSG_CHECKING([for unlink() conforms to POSIX])
+ AC_CACHE_VAL(ac_unlink_dir_posix,
+   [AC_TRY_RUN([#include <unistd.h>
+ #include <sys/stat.h>
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <sys/types.h>
+ int main() { char b[16]="conftest.dir";int 
e;errno=0;mkdir(b,-1);unlink(b);e=errno;rmdir(b);return e!=EPERM;} ],
+    ac_unlink_dir_posix=yes,
+    ac_unlink_dir_posix=no)])
+ AC_MSG_RESULT($ac_unlink_dir_posix)
+ if test $ac_unlink_dir_posix = yes; then
+   AC_DEFINE(UNLINK_DIR_POSIX, 1,
+     [EISDIR is the Linux standard unlink() of a dir, but it should be EPERM])
+ fi
+ 
+ 
+ 
  AC_TYPE_SIGNAL
  AC_TYPE_MODE_T
  AC_TYPE_PID_T
*** /tmp/tar-1.13.19/src/misc.c Sat Jan 13 00:59:29 2001
--- tar-1.13.19/src/misc.c      Sun May  5 17:41:10 2002
***************
*** 21,26 ****
--- 21,32 ----
  #include <quotearg.h>
  #include <save-cwd.h>
  
+ #ifdef UNLINK_DIR_POSIX
+ #define UNLINK_DIR_FAILCODE EPERM
+ #else
+ #define UNLINK_DIR_FAILCODE EISDIR
+ #endif
+ 
  static void call_arg_fatal PARAMS ((char const *, char const *))
       __attribute__ ((noreturn));
  
***************
*** 257,263 ****
      {
        if (unlink (path) == 0)
        return 1;
!       if (errno != EPERM)
        return 0;
      }
  
--- 263,269 ----
      {
        if (unlink (path) == 0)
        return 1;
!       if (errno != UNLINK_DIR_FAILCODE)
        return 0;
      }
  
*** /tmp/tar-1.13.19/ChangeLog  Sat Jan 13 02:59:49 2001
--- tar-1.13.19/ChangeLog       Mon May  6 22:03:45 2002
***************
*** 1,3 ****
--- 1,12 ----
+ 2002-05-06  Jason Kim <address@hidden>
+ 
+       * configure.in, src/misc.c: Version 1.13.19 
+       Patch for POSIX bug under Linux. Added new test for checking
+       whether unlink() properly returns EPERM.  Changes tested under
+       Linux Redhat 7.2 (nonconforming) and SunOS 5.8 (conforming).  This
+       fixes a serious bug during incremental extract that fails because
+       unlink() of a removed directory. 
+ 
  2001-01-12  Paul Eggert  <address@hidden>
  
        * NEWS, configure.in (AC_INIT_AUTOMAKE): Version 1.13.19.

reply via email to

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