summaryrefslogtreecommitdiff
path: root/tests/owner.at
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-08-13 10:19:07 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-08-13 10:20:40 -0700
commit1f9b376c90f50836b1ca2517cda0bfcab75ad8ae (patch)
treea8e5c29f534bb9e2d5f462fe9330e848ee364edc /tests/owner.at
parent9fe65e2520e3017ed7d90706d29dc4fe3aecd37a (diff)
downloadtar-1f9b376c90f50836b1ca2517cda0bfcab75ad8ae.tar.gz
tar: --owner and --group names and numbers
The --owner and --group options now accept operands of the form NAME:NUM, so that you can specify both symbolic name and numeric ID for owner and group. Also, in these options, NAME no longer needs to be present in the current host's user and group databases; this implements Debian enhancement request 136231 <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=136231> reported by Mark W. Eichin, communicated by Thayne Harbaugh to bug-tar in <http://lists.gnu.org/archive/html/bug-tar/2011-08/msg00001.html>. * NEWS, doc/tar.texi (Option Summary, override): Document enhancement. * src/common.h (group_name_option, owner_name_option): New decls. * src/create.c (start_header): Don't assume owner and group names are in current host database. * src/tar.c (parse_owner_group): New function, for parsing NAME:NUM. (parse_opt): Use it. (decode_options): Initialize owner_name_option, group_name_option. * tests/owner.at: New file, to test this enhancement. * tests/Makefile.am (TESTSUITE_AT): Add it. * tests/testsuite.at: Include it.
Diffstat (limited to 'tests/owner.at')
-rw-r--r--tests/owner.at45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/owner.at b/tests/owner.at
new file mode 100644
index 00000000..799bd43d
--- /dev/null
+++ b/tests/owner.at
@@ -0,0 +1,45 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+
+# Test suite for GNU tar.
+# Copyright 2011 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 Free Software Foundation; either version 3, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# Check the --owner and --group options.
+
+AT_SETUP([--owner and --group])
+AT_KEYWORDS([owner])
+
+AT_TAR_CHECK([
+export TZ=UTC0
+
+genfile --file a
+
+tar --owner="Joe the Plumber:1234" \
+ --group="Plumber's Union:5678" \
+ --mtime='@0' \
+ -cf arc a
+
+tar -tvf arc
+tar --numeric-owner -tvf arc
+],
+[0],
+[-rw-r--r-- Joe the Plumber/Plumber's Union 0 1970-01-01 00:00 a
+-rw-r--r-- 1234/5678 0 1970-01-01 00:00 a
+],
+[],[],[],[gnu])
+
+AT_CLEANUP