bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] tar changes needed to accommoate recent gnulib updates


From: Paul Eggert
Subject: [Bug-tar] tar changes needed to accommoate recent gnulib updates
Date: Mon, 02 May 2005 00:40:11 -0700

I installed the following changes to tar, to allow it to keep up
with the latest gnulib code:

2005-05-02  Paul Eggert  <address@hidden>

        Adjust to recent gnulib changes.
        * lib/.cvsignore: Add dup-safer.c, fd-safer.c, unistd-safer.h.
        * src/common.h (initial_umask): New var.
        * src/create.c (start_ueader): Use it, and adjust to new modechange
        API.
        * src/tar.c (parse_opt): Set it, and adjust to new modechange API.

Index: lib/.cvsignore
===================================================================
RCS file: /cvsroot/tar/tar/lib/.cvsignore,v
retrieving revision 1.18
diff -p -u -b -w -r1.18 .cvsignore
--- lib/.cvsignore      21 Mar 2005 21:56:03 -0000      1.18
+++ lib/.cvsignore      2 May 2005 07:33:42 -0000
@@ -33,6 +33,7 @@ chown.c
 config.charset
 dirname.c
 dirname.h
+dup-safer.c
 error.c
 error.h
 exclude.c
@@ -41,6 +42,7 @@ exit.h
 exitfail.c
 exitfail.h
 fchown-stub.c
+fd-safer.c
 fileblocks.c
 fnmatch.c
 fnmatch.h
@@ -141,6 +143,7 @@ system.h
 time_r.c
 time_r.h
 timespec.h
+unistd-safer.h
 unlocked-io.h
 unsetenv.c
 utime.c
Index: src/common.h
===================================================================
RCS file: /cvsroot/tar/tar/src/common.h,v
retrieving revision 1.49
diff -p -u -b -w -r1.49 common.h
--- src/common.h        5 Feb 2005 22:00:29 -0000       1.49
+++ src/common.h        2 May 2005 07:33:42 -0000
@@ -1,7 +1,7 @@
 /* Common declarations for the tar program.
 
    Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
-   2003, 2004 Free Software Foundation, Inc.
+   2003, 2004, 2005 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -199,6 +199,9 @@ GLOBAL const char *listed_incremental_op
 /* Specified mode change string.  */
 GLOBAL struct mode_change *mode_option;
 
+/* Initial umask, if needed for mode change string.  */
+GLOBAL mode_t initial_umask;
+
 GLOBAL bool multi_volume_option;
 
 /* The same variable holds the time, whether mtime or ctime.  Just fake a
Index: src/create.c
===================================================================
RCS file: /cvsroot/tar/tar/src/create.c,v
retrieving revision 1.94
diff -p -u -b -w -r1.94 create.c
--- src/create.c        7 Apr 2005 17:27:07 -0000       1.94
+++ src/create.c        2 May 2005 07:33:42 -0000
@@ -1,7 +1,7 @@
 /* Create a tar archive.
 
    Copyright (C) 1985, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
-   2003, 2004 Free Software Foundation, Inc.
+   2003, 2004, 2005 Free Software Foundation, Inc.
 
    Written by John Gilmore, on 1985-08-25.
 
@@ -630,8 +630,9 @@ start_header (struct tar_stat_info *st)
   if (group_option != (gid_t) -1)
     st->stat.st_gid = group_option;
   if (mode_option)
-    st->stat.st_mode = ((st->stat.st_mode & ~MODE_ALL)
-                  | mode_adjust (st->stat.st_mode, mode_option));
+    st->stat.st_mode =
+      ((st->stat.st_mode & ~MODE_ALL)
+       | mode_adjust (st->stat.st_mode, mode_option, initial_umask));
 
   /* Paul Eggert tried the trivial test ($WRITER cf a b; $READER tvf a)
      for a few tars and came up with the following interoperability
Index: src/tar.c
===================================================================
RCS file: /cvsroot/tar/tar/src/tar.c,v
retrieving revision 1.119
diff -p -u -b -w -r1.119 tar.c
--- src/tar.c   7 Apr 2005 17:24:56 -0000       1.119
+++ src/tar.c   2 May 2005 07:33:42 -0000
@@ -1,7 +1,7 @@
 /* A tar (tape archiver) program.
 
    Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
-   2001, 2003, 2004 Free Software Foundation, Inc.
+   2001, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    Written by John Gilmore, starting 1985-08-25.
 
@@ -1135,13 +1135,11 @@ parse_opt (int key, char *arg, struct ar
       break;
       
     case MODE_OPTION:
-      mode_option
-       = mode_compile (arg,
-                       MODE_MASK_EQUALS | MODE_MASK_PLUS | MODE_MASK_MINUS);
-      if (mode_option == MODE_INVALID)
+      mode_option = mode_compile (arg);
+      if (!mode_option)
        FATAL_ERROR ((0, 0, _("Invalid mode given on option")));
-      if (mode_option == MODE_MEMORY_EXHAUSTED)
-       xalloc_die ();
+      initial_umask = umask (0);
+      umask (initial_umask);
       break;
       
     case NO_ANCHORED_OPTION:




reply via email to

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