bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] Different behavior between versions with option --listed-i


From: Nathan Stratton Treadway
Subject: Re: [Bug-tar] Different behavior between versions with option --listed-incremental
Date: Wed, 27 Mar 2013 01:49:58 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

On Wed, Mar 27, 2013 at 01:18:28 -0400, Nathan Stratton Treadway wrote:
> In any case, I see in that commit the following change was made to
> update.c:update_archive()
> 
> -                       dirp = savedir (name->name);
> -                       if (!dirp)
> +                       DIR *stream;
> +                       int fd = openat (chdir_fd, name->name,
> +                                        open_read_flags | O_DIRECTORY);
> +                       if (fd < 0)
> +                         open_error (name->name);
> +                       else if (! ((stream = fdopendir (fd))
> +                                   && (dirp = streamsavedir (stream))))
> 
> Perhaps a similar change would work in try_purge_directory() ?

Looking through the src/*.c files, I noticed there was one other
savedir() call, on misc.c line 635, inside remove_any_file():

       case RECURSIVE_REMOVE_OPTION:
          {
            char *directory = savedir (file_name);

, and it appears this also needs to be modified to properly follow the
-C option:

  $ touch aaa/sss
  $ mkdir ext/aaa/sss
  $ touch ext/aaa/sss/file
  $ tar -G -vxf test.2.tar -C ext/
  aaa/
  tar: Deleting `aaa/sss'
  tar: aaa/sss: Cannot remove: Not a directory
  tar: Exiting with failure status due to previous errors

(Basically, the previously-discussed logic notices that "ext/aaa/sss"
needs to be deleted, but then when remove_any_file() finds that that
refers to a non-empty subdirectory and tries to recursively remove it,
the savedir() call instead attempts to open "aaa/sss" [which is a
regular file], thus generating the "Not a directory" error.

The same sort of thing happens if aaa/sss is a directory, but has
different members that ext/aaa/sss does.)


                                                                Nathan

----------------------------------------------------------------------------
Nathan Stratton Treadway  -  address@hidden  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239



reply via email to

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