On Friday 20 of February 2015 10:32:13 Jan Engelhardt wrote:
> On Thursday 2014-09-18 21:57, Sergey Poznyakoff wrote:
> 
> >> The patch fix the first issue I reported, but not the second.
> >
> >Yes, indeed.  I have installed the following patch instead, which
> >fixes both issues.
> 
> 
> This patch, which was recently backported to openSUSE's tar-1.28[1]
> 
> [1] 
> https://build.opensuse.org/package/view_file/Base:System/tar/tar-recursive--files-from.patch?expand=1
> 
> breaks creation of tar archives when --no-recursive appears after -T:
>   https://bugzilla.opensuse.org/show_bug.cgi?id=918487

I'm not sure whether this was discussed off-list somehow, but I would call
the *new* behavior as expected.  There is inconsistency in behavior - yes,
but does not seem to be regression, rather a new feature..?

The options --{no-,}recursive are kind of "positional" (I'm not sure how
to call that), so those affect only "following" members specified on
commandline.  You may do:

  $ mkdir dir{1,2,3}
  $ touch dir{1,2,3}/{a,b}
  $ tar -cvf a.tar dir1 --no-recursion dir2 --recursion dir3
  dir1/
  dir1/b
  dir1/a
  dir2/
  dir3/
  dir3/b
  dir3/a

The older behavior was "the-last-wins" but the new is more powerful.

There are other options, e.g. "-C, --directory" that allows you to work
with members similar way.  Like 'tar -cf A -C dirA a ../dirB b'.

IMHO, from the long term perspective, it would be fine if other options
like '--owner', '--group', '--xattrs', .. worked the same way.  This is
now possible only by --files-from (and thus the "classic option usage" and
the -T option are not completely consistent):

  $ cat T
  dir1
  --xattrs --owner root --group root
  dir2
  --no-xattrs --owner apache --group apache
  dir3
  $ tar --posix -cf A --files-from T
  $ tar --xattrs-include='*' -tvvf A
  drwxrwxr-x  praiskup/praiskup 0 2015-06-19 13:51 dir1/
  -rw-rw-r--  praiskup/praiskup 0 2015-06-19 13:51 dir1/b
  -rw-rw-r--  praiskup/praiskup 0 2015-06-19 13:51 dir1/a
  drwxrwxr-x* root/root         0 2015-06-19 13:51 dir2/
    x: 36 security.selinux
  -rw-rw-r--* root/root         0 2015-06-19 13:51 dir2/b
    x: 36 security.selinux
  -rw-rw-r--* root/root         0 2015-06-19 13:51 dir2/a
    x: 36 security.selinux
  drwxrwxr-x  apache/apache     0 2015-06-19 13:51 dir3/
  -rw-rw-r--  apache/apache     0 2015-06-19 13:51 dir3/b
  -rw-rw-r--  apache/apache     0 2015-06-19 13:51 dir3/a

Pavel


Reply via email to