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

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

tar: change in exclude behaviour from 1.12 to 1.13


From: mark
Subject: tar: change in exclude behaviour from 1.12 to 1.13
Date: Fri, 20 Oct 2000 19:55:00 -0700

GNU tar has changed the way exclude lists are used between 1.12 and
1.13. With 1.13 only the base name of the file is compared with the
exclude list entries. Thus, one cannot do something like /home/mark/mp3/*
to exclude everything below /home/mark/mp3 (but, in this case, include
/home/mark/mp3/).

I readily admit that once can easily achieve this result with find
-prune | tar. Nevertheless, it seems odd to change the behaviour of
exclude lists so dramatically in a .01 increment.  (It also caused me
much head scratching, but that is water under the bridge.)

Attached is a patch that may cause 1.13 to act like 1.12.


-- 
Mark Wagner address@hidden
I'm living in the ice age.

diff -c -r tar-1.13/lib/exclude.c tar-1.13-01/lib/exclude.c
*** tar-1.13/lib/exclude.c      Wed Dec 31 03:01:18 1997
--- tar-1.13-01/lib/exclude.c   Sun Oct  8 23:09:15 2000
***************
*** 61,67 ****
    int i;
  
    for (i = 0;  i < exclude_count;  i++)
!     if (fnmatch (exclude[i], f, 0) == 0)
        return 1;
  
    return 0;
--- 61,67 ----
    int i;
  
    for (i = 0;  i < exclude_count;  i++)
!     if (fnmatch (exclude[i], f, FNM_LEADING_DIR) == 0)
        return 1;
  
    return 0;
diff -c -r tar-1.13/src/create.c tar-1.13-01/src/create.c
*** tar-1.13/src/create.c       Tue Jul  6 22:27:04 1999
--- tar-1.13-01/src/create.c    Sun Oct  8 23:19:47 2000
***************
*** 1480,1487 ****
        {
          /* Skip `.', `..', and excluded file names.  */
  
!         if (is_dot_or_dotdot (entry->d_name)
!             || excluded_filename (excluded, entry->d_name))
            continue;
  
          if ((int) NAMLEN (entry) + len >= buflen)
--- 1480,1486 ----
        {
          /* Skip `.', `..', and excluded file names.  */
  
!         if (is_dot_or_dotdot (entry->d_name))
            continue;
  
          if ((int) NAMLEN (entry) + len >= buflen)
***************
*** 1496,1501 ****
--- 1495,1504 ----
  #endif
            }
          strcpy (namebuf + len, entry->d_name);
+ 
+         if (excluded_filename (excluded, namebuf))
+           continue;
+ 
          dump_file (namebuf, our_device, 0);
        }
  
diff -c -r tar-1.13/src/incremen.c tar-1.13-01/src/incremen.c
*** tar-1.13/src/incremen.c     Tue Jul  6 22:42:53 1999
--- tar-1.13-01/src/incremen.c  Sun Oct  8 23:25:38 2000
***************
*** 213,232 ****
        if (is_dot_or_dotdot (entry->d_name))
          continue;
  
!       if (excluded_filename (excluded, entry->d_name))
          add_to_accumulator (accumulator, "N", 1);
        else
          {
            struct stat stat_data;
- 
-           if (NAMLEN (entry) + name_length >= name_buffer_size)
-             {
-               while (NAMLEN (entry) + name_length >= name_buffer_size)
-                 name_buffer_size += NAME_FIELD_SIZE;
-               name_buffer = (char *)
-                 xrealloc (name_buffer, name_buffer_size + 2);
-             }
-           strcpy (name_buffer + name_length, entry->d_name);
  
            if (dereference_option
  #if STX_HIDDEN && !_LARGE_FILES /* AIX */
--- 213,232 ----
        if (is_dot_or_dotdot (entry->d_name))
          continue;
  
!       if (NAMLEN (entry) + name_length >= name_buffer_size)
!         {
!           while (NAMLEN (entry) + name_length >= name_buffer_size)
!             name_buffer_size += NAME_FIELD_SIZE;
!           name_buffer = (char *)
!             xrealloc (name_buffer, name_buffer_size + 2);
!         }
!       strcpy (name_buffer + name_length, entry->d_name);
! 
!       if (excluded_filename (excluded, name_buffer))
          add_to_accumulator (accumulator, "N", 1);
        else
          {
            struct stat stat_data;
  
            if (dereference_option
  #if STX_HIDDEN && !_LARGE_FILES /* AIX */
diff -c -r tar-1.13/src/list.c tar-1.13-01/src/list.c
*** tar-1.13/src/list.c Tue Jul  6 22:46:52 1999
--- tar-1.13-01/src/list.c      Sun Oct  8 23:26:04 2000
***************
*** 70,76 ****
  
          if (!name_match (current_file_name)
              || current_stat.st_mtime < newer_mtime_option
!             || excluded_filename (excluded, base_name (current_file_name)))
            {
              int isextended = 0;
  
--- 70,76 ----
  
          if (!name_match (current_file_name)
              || current_stat.st_mtime < newer_mtime_option
!             || excluded_filename (excluded, current_file_name))
            {
              int isextended = 0;
  

reply via email to

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