1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
3 # Test suite for GNU tar.
4 # Copyright 2011-2023 Free Software Foundation, Inc.
6 # This file is part of GNU tar.
8 # GNU tar is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # GNU tar is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 # Test that --keep-old-files doesn't change xattrs of already existing file.
24 # https://lists.gnu.org/archive/html/bug-tar/2016-10/msg00001.html
26 AT_SETUP([xattrs: xattrs and --skip-old-files])
27 AT_KEYWORDS([xattrs xattr07])
32 genfile --file dir/file
33 genfile --file dir/file2
35 setfattr -n user.test -v OurDirValue dir
36 setfattr -n user.test -v OurFileValue dir/file
37 setfattr -n user.test -v OurFileValue dir/file2
39 tar --xattrs --no-recursion -cf archive.tar dir dir/file dir/file2
41 setfattr -n user.test -v OurDirValue2 dir
42 setfattr -n user.test -v OurFileValue2 dir/file
43 setfattr -n user.test -v OurFileValue2 dir/file2
45 # Check that tar continues to file2 too!
46 tar --xattrs -xvf archive.tar --skip-old-files
47 tar --xattrs -xvf archive.tar --keep-old-files
49 getfattr -h -d dir | grep -v -e '^#' -e ^$
50 getfattr -h -d dir/file | grep -v -e '^#' -e ^$
51 getfattr -h -d dir/file2 | grep -v -e '^#' -e ^$
60 user.test="OurDirValue2"
61 user.test="OurFileValue2"
62 user.test="OurFileValue2"
63 ], [tar: dir: skipping existing file
64 tar: dir/file: skipping existing file
65 tar: dir/file2: skipping existing file
66 tar: dir/file: Cannot open: File exists
67 tar: dir/file2: Cannot open: File exists
68 tar: Exiting with failure status due to previous errors