From 7b35b1d07bda640bb331fd1e8345143460f9805f Mon Sep 17 00:00:00 2001 From: Ondrej Vasik Date: Fri, 27 Nov 2009 14:09:58 +0000 Subject: [PATCH] store xattrs for symlinks (#525992) - by Kamil Dudka, update tar(1) manpage (#539787), fix memory leak in xheader (#518079) --- tar-1.19-xattrs.patch | 1095 ++++++++++++++-------------- tar-1.22-store-lnk-selinux.patch | 13 - tar-1.22-xheaderleak.patch | 11 + tar.1 | 1145 ++++++++++++++---------------- tar.spec | 27 +- 5 files changed, 1112 insertions(+), 1179 deletions(-) delete mode 100644 tar-1.22-store-lnk-selinux.patch create mode 100644 tar-1.22-xheaderleak.patch diff --git a/tar-1.19-xattrs.patch b/tar-1.19-xattrs.patch index f235577..b9d7b5c 100644 --- a/tar-1.19-xattrs.patch +++ b/tar-1.19-xattrs.patch @@ -1,6 +1,6 @@ -diff -urp tar-1.22-orig/configure.ac tar-1.22/configure.ac +diff -urNp tar-1.22-orig/configure.ac tar-1.22/configure.ac --- tar-1.22-orig/configure.ac 2009-03-05 08:01:58.000000000 +0100 -+++ tar-1.22/configure.ac 2009-03-05 09:45:42.000000000 +0100 ++++ tar-1.22/configure.ac 2009-11-23 14:48:00.000000000 +0100 @@ -40,7 +40,7 @@ AC_CHECK_HEADERS_ONCE(fcntl.h linux/fd.h sys/param.h sys/device.h sys/filio.h sys/gentape.h \ sys/inet.h sys/io/trioctl.h \ @@ -33,9 +33,9 @@ diff -urp tar-1.22-orig/configure.ac tar-1.22/configure.ac AC_CHECK_TYPE(iconv_t,:, AC_DEFINE(iconv_t, int, [Conversion descriptor type]), -diff -urp tar-1.22-orig/doc/tar.texi tar-1.22/doc/tar.texi +diff -urNp tar-1.22-orig/doc/tar.texi tar-1.22/doc/tar.texi --- tar-1.22-orig/doc/tar.texi 2009-03-05 08:04:13.000000000 +0100 -+++ tar-1.22/doc/tar.texi 2009-03-05 09:45:42.000000000 +0100 ++++ tar-1.22/doc/tar.texi 2009-11-23 14:48:00.000000000 +0100 @@ -2345,6 +2345,10 @@ Normally when creating an archive, @comm @samp{/} from member names. This option disables that behavior. @xref{absolute}. @@ -165,9 +165,9 @@ diff -urp tar-1.22-orig/doc/tar.texi tar-1.22/doc/tar.texi @end table @node Portability -diff -urp tar-1.22-orig/src/common.h tar-1.22/src/common.h +diff -urNp tar-1.22-orig/src/common.h tar-1.22/src/common.h --- tar-1.22-orig/src/common.h 2008-11-30 13:30:29.000000000 +0100 -+++ tar-1.22/src/common.h 2009-03-05 09:45:42.000000000 +0100 ++++ tar-1.22/src/common.h 2009-11-23 14:48:00.000000000 +0100 @@ -248,6 +248,15 @@ GLOBAL int same_owner_option; /* If positive, preserve permissions when extracting. */ GLOBAL int same_permissions_option; @@ -207,9 +207,9 @@ diff -urp tar-1.22-orig/src/common.h tar-1.22/src/common.h /* Module system.c */ -diff -urp tar-1.22-orig/src/create.c tar-1.22/src/create.c +diff -urNp tar-1.22-orig/src/create.c tar-1.22/src/create.c --- tar-1.22-orig/src/create.c 2008-10-30 11:58:04.000000000 +0100 -+++ tar-1.22/src/create.c 2009-03-05 09:45:42.000000000 +0100 ++++ tar-1.22/src/create.c 2009-11-23 14:48:33.000000000 +0100 @@ -24,6 +24,7 @@ #include @@ -260,9 +260,19 @@ diff -urp tar-1.22-orig/src/create.c tar-1.22/src/create.c if (is_dir) { const char *tag_file_name; -diff -urp tar-1.22-orig/src/extract.c tar-1.22/src/extract.c +@@ -1709,6 +1738,9 @@ dump_file0 (struct tar_stat_info *st, co + if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size) + write_long_link (st); + ++ xattrs_selinux_get(st, p, -1); ++ xattrs_xattrs_get(st, p, -1); ++ + block_ordinal = current_block_ordinal (); + st->stat.st_size = 0; /* force 0 size on symlink */ + header = start_header (st); +diff -urNp tar-1.22-orig/src/extract.c tar-1.22/src/extract.c --- tar-1.22-orig/src/extract.c 2008-10-30 15:10:28.000000000 +0100 -+++ tar-1.22/src/extract.c 2009-03-05 09:45:42.000000000 +0100 ++++ tar-1.22/src/extract.c 2009-11-23 14:48:33.000000000 +0100 @@ -69,6 +69,13 @@ struct delayed_set_stat mode_t invert_permissions; enum permstatus permstatus; @@ -365,12 +375,12 @@ diff -urp tar-1.22-orig/src/extract.c tar-1.22/src/extract.c p->sources->next = 0; strcpy (p->sources->string, file_name); + p->cntx_name = NULL; ++ assign_string (&p->cntx_name, current_stat_info.cntx_name); + p->acls_a_ptr = NULL; + p->acls_a_len = 0; + p->acls_d_ptr = NULL; + p->acls_d_len = 0; -+ p->xattr_map = NULL; -+ p->xattr_map_size = 0; ++ xheader_xattr_copy (¤t_stat_info, &p->xattr_map, &p->xattr_map_size); strcpy (p->target, current_stat_info.link_name); h = delayed_set_stat_head; @@ -388,10 +398,20 @@ diff -urp tar-1.22-orig/src/extract.c tar-1.22/src/extract.c set_stat (source, &st1, NULL, 0, 0, SYMTYPE); valid_source = source; } -diff -urp tar-1.22-orig/src/list.c tar-1.22/src/list.c ---- tar-1.22-orig/src/list.c 2009-03-05 09:45:15.000000000 +0100 -+++ tar-1.22/src/list.c 2009-03-05 09:45:42.000000000 +0100 -@@ -567,6 +567,13 @@ decode_header (union block *header, stru +@@ -1301,6 +1372,9 @@ apply_delayed_links (void) + sources = next; + } + ++ xheader_xattr_free (ds->xattr_map, ds->xattr_map_size); ++ free (ds->cntx_name); ++ + { + struct delayed_link *next = ds->next; + free (ds); +diff -urNp tar-1.22-orig/src/list.c tar-1.22/src/list.c +--- tar-1.22-orig/src/list.c 2009-11-23 14:47:03.000000000 +0100 ++++ tar-1.22/src/list.c 2009-11-23 14:48:00.000000000 +0100 +@@ -568,6 +568,13 @@ decode_header (union block *header, stru assign_string (&stat_info->gname, header->header.gname[0] ? header->header.gname : NULL); @@ -405,9 +425,9 @@ diff -urp tar-1.22-orig/src/list.c tar-1.22/src/list.c if (format == OLDGNU_FORMAT && incremental_option) { stat_info->atime.tv_sec = TIME_FROM_HEADER (header->oldgnu_header.atime); -diff -urp tar-1.22-orig/src/Makefile.am tar-1.22/src/Makefile.am +diff -urNp tar-1.22-orig/src/Makefile.am tar-1.22/src/Makefile.am --- tar-1.22-orig/src/Makefile.am 2007-10-29 18:53:06.000000000 +0100 -+++ tar-1.22/src/Makefile.am 2009-03-05 09:45:42.000000000 +0100 ++++ tar-1.22/src/Makefile.am 2009-11-23 14:48:00.000000000 +0100 @@ -20,7 +20,7 @@ bin_PROGRAMS = tar @@ -431,9 +451,9 @@ diff -urp tar-1.22-orig/src/Makefile.am tar-1.22/src/Makefile.am -tar_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) +tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME) -diff -urp tar-1.22-orig/src/tar.c tar-1.22/src/tar.c +diff -urNp tar-1.22-orig/src/tar.c tar-1.22/src/tar.c --- tar-1.22-orig/src/tar.c 2009-03-05 08:04:13.000000000 +0100 -+++ tar-1.22/src/tar.c 2009-03-05 09:45:42.000000000 +0100 ++++ tar-1.22/src/tar.c 2009-11-23 14:48:00.000000000 +0100 @@ -246,7 +246,8 @@ tar_set_quoting_style (char *arg) enum @@ -592,9 +612,9 @@ diff -urp tar-1.22-orig/src/tar.c tar-1.22/src/tar.c free (st->sparse_map); free (st->dumpdir); xheader_destroy (&st->xhdr); -diff -urp tar-1.22-orig/src/tar.h tar-1.22/src/tar.h +diff -urNp tar-1.22-orig/src/tar.h tar-1.22/src/tar.h --- tar-1.22-orig/src/tar.h 2007-06-27 15:30:32.000000000 +0200 -+++ tar-1.22/src/tar.h 2009-03-05 09:45:42.000000000 +0100 ++++ tar-1.22/src/tar.h 2009-11-23 14:48:00.000000000 +0100 @@ -276,6 +276,14 @@ struct xheader uintmax_t string_length; }; @@ -636,9 +656,522 @@ diff -urp tar-1.22-orig/src/tar.h tar-1.22/src/tar.h /* Extended headers */ struct xheader xhdr; -diff -urp tar-1.22-orig/src/xheader.c tar-1.22/src/xheader.c +diff -urNp tar-1.22-orig/src/xattrs.c tar-1.22/src/xattrs.c +--- tar-1.22-orig/src/xattrs.c 1970-01-01 01:00:00.000000000 +0100 ++++ tar-1.22/src/xattrs.c 2009-11-23 14:48:33.000000000 +0100 +@@ -0,0 +1,491 @@ ++/* Create a tar archive. ++ ++ Copyright (C) 2006 Free Software Foundation, Inc. ++ ++ Written by James Antill, on 2006-07-27. ++ ++ 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 2, 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. */ ++ ++#include ++ ++#include ++ ++#include "common.h" ++ ++ ++#ifndef HAVE_SELINUX_SELINUX_H ++# undef HAVE_LIBSELINUX ++#endif ++ ++#ifndef HAVE_ATTR_XATTR_H ++# undef HAVE_XATTRS ++#endif ++ ++#ifndef HAVE_SYS_ACL_H ++# undef HAVE_LIBACL ++#endif ++ ++#ifdef HAVE_SELINUX_SELINUX_H ++# include ++#endif ++ ++#ifdef HAVE_ATTR_XATTR_H ++# include ++#endif ++ ++#ifdef HAVE_SYS_ACL_H ++# include ++#endif ++ ++ ++#if 0 /* unused by xattr's atm. */ ++static void xattrs__fd_get(struct tar_stat_info *st, ++ char const *file_name, int fd, const char *attr, ++ char **ret_ptr, size_t *ret_len) ++{ ++#ifdef HAVE_XATTRS ++ static ssize_t asz = 1024; ++ ssize_t ret = 0; ++ static char *val = NULL; ++ ++ if (!val) val = xmalloc (asz); ++ ++ while (((ret = fgetxattr (fd, attr, val, asz)) == -1) && ++ (errno == ERANGE)) ++ { ++ asz <<= 1; ++ val = xrealloc (val, asz); ++ } ++ ++ if (ret != -1) ++ { ++ *ret_ptr = xmemdup (val, ret + 1); ++ *ret_len = ret; ++ } ++ else if (errno != ENOATTR) ++ call_arg_warn ("fgetxattr", file_name); ++#endif ++} ++#endif ++ ++static void xattrs__acls_get_a(struct tar_stat_info *st, ++ char const *file_name, int fd, ++ char **ret_ptr, size_t *ret_len) ++{ /* "system.posix_acl_access" */ ++#ifdef HAVE_LIBACL ++ char *val = NULL; ++ ssize_t len; ++ acl_t acl; ++ ++ if (fd != -1) ++ { ++ if ((acl = acl_get_fd (fd)) == (acl_t)NULL) ++ { ++ if (errno != ENOTSUP) ++ call_arg_warn ("acl_get_fd", file_name); ++ return; ++ } ++ } ++ else if ((acl = acl_get_file (file_name, ACL_TYPE_ACCESS)) == (acl_t)NULL) ++ { ++ if (errno != ENOTSUP) ++ call_arg_warn ("acl_get_file", file_name); ++ return; ++ } ++ ++ ++ val = acl_to_text(acl, &len); ++ acl_free (acl); ++ ++ if (val == NULL) ++ { ++ call_arg_warn ("acl_to_text", file_name); ++ return; ++ } ++ ++ *ret_ptr = xstrdup (val); ++ *ret_len = len; ++ ++ acl_free (val); ++#endif ++} ++ ++static void xattrs__acls_get_d(struct tar_stat_info *st, ++ char const *file_name, ++ char **ret_ptr, size_t *ret_len) ++{ /* "system.posix_acl_default" */ ++#ifdef HAVE_LIBACL ++ char *val = NULL; ++ ssize_t len; ++ acl_t acl; ++ ++ if ((acl = acl_get_file (file_name, ACL_TYPE_DEFAULT)) == (acl_t)NULL) ++ { ++ if (errno != ENOTSUP) ++ call_arg_warn ("acl_get_file", file_name); ++ return; ++ } ++ ++ val = acl_to_text(acl, &len); ++ acl_free (acl); ++ ++ if (val == NULL) ++ { ++ call_arg_warn ("acl_to_text", file_name); ++ return; ++ } ++ ++ *ret_ptr = xstrdup (val); ++ *ret_len = len; ++ ++ acl_free (val); ++#endif ++} ++ ++void xattrs_acls_get(struct tar_stat_info *st, char const *file_name, int fd, ++ int xisfile) ++{ ++ if (acls_option > 0) ++ { ++#ifndef HAVE_LIBACL ++ static int done = 0; ++ if (!done) ++ WARN ((0, 0, _("ACL support requested, but not available"))); ++ done = 1; ++#endif ++ xattrs__acls_get_a (st, file_name, fd, ++ &st->acls_a_ptr, &st->acls_a_len); ++ if (!xisfile) ++ xattrs__acls_get_d (st, file_name, ++ &st->acls_d_ptr, &st->acls_d_len); ++ } ++} ++ ++void xattrs_selinux_get(struct tar_stat_info *st, char const *file_name, int fd) ++{ ++ if (selinux_context_option > 0) ++ { ++#ifndef HAVE_LIBSELINUX ++ static int done = 0; ++ if (!done) ++ WARN ((0, 0, _("SELinux support requested, but not available"))); ++ done = 1; ++#else ++ if (fd == -1) ++ { ++ if ((lgetfilecon (file_name, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA)) ++ call_arg_warn ("lgetfilecon", file_name); ++ } ++ else if ((fgetfilecon (fd, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA)) ++ call_arg_warn ("fgetfilecon", file_name); ++#endif ++ } ++} ++ ++void xattrs_xattrs_get(struct tar_stat_info *st, char const *file_name, int fd) ++{ ++ if (xattrs_option > 0) ++ { /* get all xattrs ... this include security.* and system.* if ++ available. We filter them here, but we have to filter them ++ in xattrs_xattrs_set() anyway. ++ */ ++ static ssize_t xsz = 1024; ++ static char *xatrs = NULL; ++ ssize_t xret = -1; ++ ++#ifndef HAVE_XATTRS ++ static int done = 0; ++ if ((xattrs_option > 0) && !done) ++ WARN ((0, 0, _("Xattr support requested, but not available"))); ++ done = 1; ++#else ++ ++ if (!xatrs) xatrs = xmalloc (xsz); ++ ++ while (((fd == -1) ? ++ ((xret = llistxattr (file_name, xatrs, xsz)) == -1) : ++ ((xret = flistxattr (fd, xatrs, xsz)) == -1)) && ++ (errno == ERANGE)) ++ { ++ xsz <<= 1; ++ xatrs = xrealloc (xatrs, xsz); ++ } ++ ++ if (xret == -1) ++ call_arg_warn ((fd == -1) ? "llistxattrs" : "flistxattrs", file_name); ++ else ++ { ++ const char *attr = xatrs; ++ static ssize_t asz = 1024; ++ static char *val = NULL; ++ ++ if (!val) val = xmalloc (asz); ++ ++ while (xret > 0) ++ { ++ size_t len = strlen (attr); ++ ssize_t aret = 0; ++ ++ if (strncmp (attr, "user.", strlen("user.")) && ++ strncmp (attr, "trusted.", strlen("trusted."))) ++ goto next_attr; /* only store normal xattrs */ ++ ++ while (((fd == -1) ? ++ ((aret = lgetxattr (file_name, attr, val, asz)) == -1) : ++ ((aret = fgetxattr (fd, attr, val, asz)) == -1)) && ++ (errno == ERANGE)) ++ { ++ asz <<= 1; ++ val = xrealloc (val, asz); ++ } ++ ++ if (aret != -1) ++ xheader_xattr_add (st, attr, val, aret); ++ else if (errno != ENOATTR) ++ call_arg_warn ((fd==-1) ? "lgetxattr" : "fgetxattr", file_name); ++ ++ next_attr: ++ attr += len + 1; ++ xret -= len + 1; ++ } ++ } ++#endif ++ } ++} ++ ++static void xattrs__fd_set(struct tar_stat_info const *st, ++ char const *file_name, char typeflag, ++ const char *attr, ++ const char *ptr, size_t len) ++{ ++#ifdef HAVE_XATTRS ++ if (ptr) ++ { ++ const char *sysname = "setxattr"; ++ int ret = -1; ++ ++ if (typeflag != SYMTYPE) ++ ret = setxattr (file_name, attr, ptr, len, 0); ++ else ++ { ++ sysname = "lsetxattr"; ++ ret = lsetxattr (file_name, attr, ptr, len, 0); ++ } ++ ++ /* do not print warnings when SELinux is disabled */ ++ if ((ret == -1) && (errno != EPERM) && (errno != ENOTSUP)) ++ call_arg_error(sysname, file_name); ++ } ++#endif ++} ++ ++/* convert unix permissions into an ACL ... needed due to "default" ACLs */ ++#ifdef HAVE_LIBACL ++static acl_t perms2acl(int perms) ++{ ++ char val[] = "user::---,group::---,other::---"; ++ /* 0123456789 123456789 123456789 123456789 */ ++ ++ /* user */ ++ if (perms & 0400) val[ 6] = 'r'; ++ if (perms & 0200) val[ 7] = 'w'; ++ if (perms & 0100) val[ 8] = 'x'; ++ ++ /* group */ ++ if (perms & 0040) val[17] = 'r'; ++ if (perms & 0020) val[18] = 'w'; ++ if (perms & 0010) val[19] = 'x'; ++ ++ /* other */ ++ if (perms & 0004) val[28] = 'r'; ++ if (perms & 0002) val[29] = 'w'; ++ if (perms & 0001) val[30] = 'x'; ++ ++ return (acl_from_text (val)); ++} ++#endif ++ ++static char *skip_to_ext_fields(char *ptr) ++{ ++ ptr += strcspn(ptr, ":,\n"); /* skip tag name. Ie. user/group/default/mask */ ++ ++ if (*ptr != ':') ++ return (ptr); /* error? no user/group field */ ++ ++ptr; ++ ++ ptr += strcspn(ptr, ":,\n"); /* skip user/group name */ ++ ++ if (*ptr != ':') ++ return (ptr); /* error? no perms field */ ++ ++ptr; ++ ++ ptr += strcspn(ptr, ":,\n"); /* skip perms */ ++ ++ if (*ptr != ':') ++ return (ptr); /* no extra fields */ ++ ++ return (ptr); ++} ++ ++/* The POSIX draft allows extra fields after the three main ones. Star ++ uses this to add a fourth field for user/group which is the numeric ID. ++ We just skip all extra fields atm. */ ++static const char *fixup_extra_acl_fields(const char *ptr) ++{ ++ char *src = (char *)ptr; ++ char *dst = (char *)ptr; ++ ++ while (*src) ++ { ++ const char *old = src; ++ size_t len = 0; ++ ++ src = skip_to_ext_fields(src); ++ len = src - old; ++ if (old != dst) memmove(dst, old, len); ++ dst += len; ++ ++ if (*src == ':') /* We have extra fields, skip them all */ ++ src += strcspn(src, "\n,"); ++ ++ if ((*src == '\n') || (*src == ',')) ++ *dst++ = *src++; /* also done when dst == src, but that's ok */ ++ } ++ if (src != dst) ++ *dst = 0; ++ ++ return ptr; ++} ++ ++static void xattrs__acls_set(struct tar_stat_info const *st, ++ char const *file_name, int type, ++ const char *ptr, size_t len) ++{ /* "system.posix_acl_access" */ ++#ifdef HAVE_LIBACL ++ acl_t acl; ++ ++ if (ptr) ++ { ++ /* assert (strlen (ptr) == len); */ ++ ptr = fixup_extra_acl_fields(ptr); ++ ++ acl = acl_from_text (ptr); ++ acls_option = 1; ++ } ++ else if (acls_option > 0) ++ acl = perms2acl (st->stat.st_mode); ++ else ++ return; /* don't call acl functions unless we first hit an ACL, or ++ --acls was passed explicitly */ ++ ++ if (acl == (acl_t)NULL) ++ { ++ call_arg_warn ("acl_from_text", file_name); ++ return; ++ } ++ ++ if (acl_set_file (file_name, type, acl) == -1) ++ { ++ if (errno != ENOTSUP) ++ call_arg_warn ("acl_set_file", file_name); ++ } ++ acl_free (acl); ++#endif ++} ++ ++void xattrs_acls_set(struct tar_stat_info const *st, ++ char const *file_name, char typeflag) ++{ ++ if ((acls_option >= 0) && (typeflag != SYMTYPE)) ++ { ++#ifndef HAVE_LIBACL ++ static int done = 0; ++ if (!done) ++ WARN ((0, 0, _("ACL support requested, but not available"))); ++ done = 1; ++#else ++ xattrs__acls_set (st, file_name, ACL_TYPE_ACCESS, ++ st->acls_a_ptr, st->acls_a_len); ++ if ((typeflag == DIRTYPE) || (typeflag == GNUTYPE_DUMPDIR)) ++ xattrs__acls_set (st, file_name, ACL_TYPE_DEFAULT, ++ st->acls_d_ptr, st->acls_d_len); ++#endif ++ } ++} ++ ++void xattrs_selinux_set(struct tar_stat_info const *st, ++ char const *file_name, char typeflag) ++{ ++ if ((selinux_context_option >= 0) && st->cntx_name) ++ { ++ const char *sysname = "setfilecon"; ++ int ret = -1; ++ ++#ifndef HAVE_LIBSELINUX ++ static int done = 0; ++ if (!done) ++ WARN ((0, 0, _("SELinux support requested, but not available"))); ++ done = 1; ++#else ++ if (typeflag != SYMTYPE) ++ ret = setfilecon (file_name, st->cntx_name); ++ else ++ { ++ sysname = "lsetfilecon"; ++ ret = lsetfilecon (file_name, st->cntx_name); ++ } ++ ++ if ((ret == -1) && (errno == EPERM)) ++ call_arg_warn(sysname, file_name); ++ else if ((ret == -1) && (errno != EOPNOTSUPP)) ++ call_arg_error(sysname, file_name); ++#endif ++ } ++} ++ ++void xattrs_xattrs_set(struct tar_stat_info const *st, ++ char const *file_name, char typeflag) ++{ ++ if ((xattrs_option >= 0) && st->xattr_map_size) ++ { ++ size_t scan = 0; ++ ++#ifndef HAVE_XATTRS ++ static int done = 0; ++ if (!done) ++ WARN ((0, 0, _("Xattr support requested, but not available"))); ++ done = 1; ++#else ++ while (scan < st->xattr_map_size) ++ { ++ char *keyword = st->xattr_map[scan].xkey; ++ ++ /* assert (!memcpy (keyword, "SCHILY.xattr.", strlen("SCHILY.xattr."))); */ ++ keyword += strlen("SCHILY.xattr."); ++ ++ if (strncmp (keyword, "user.", strlen("user.")) && ++ strncmp (keyword, "trusted.", strlen("trusted."))) ++ continue; /* don't try and set anything but normal xattrs */ ++ ++ /* should we ignore trusted.* EPERM errors when not root ? */ ++ xattrs__fd_set (st, file_name, typeflag, keyword, ++ st->xattr_map[scan].xval_ptr, ++ st->xattr_map[scan].xval_len); ++ ++ ++scan; ++ } ++#endif ++ } ++} +diff -urNp tar-1.22-orig/src/xattrs.h tar-1.22/src/xattrs.h +--- tar-1.22-orig/src/xattrs.h 1970-01-01 01:00:00.000000000 +0100 ++++ tar-1.22/src/xattrs.h 2009-11-23 14:48:00.000000000 +0100 +@@ -0,0 +1,14 @@ ++ ++extern void xattrs_acls_get(struct tar_stat_info *st, ++ char const *file_name, int fd, int xisfile); ++extern void xattrs_selinux_get(struct tar_stat_info *st, ++ char const *file_name, int fd); ++extern void xattrs_xattrs_get(struct tar_stat_info *st, ++ char const *file_name, int fd); ++ ++extern void xattrs_acls_set(struct tar_stat_info const *st, ++ char const *file_name, char typeflag); ++extern void xattrs_selinux_set(struct tar_stat_info const *st, ++ char const *file_name, char typeflag); ++extern void xattrs_xattrs_set(struct tar_stat_info const *st, ++ char const *file_name, char typeflag); +diff -urNp tar-1.22-orig/src/xheader.c tar-1.22/src/xheader.c --- tar-1.22-orig/src/xheader.c 2008-11-30 13:30:54.000000000 +0100 -+++ tar-1.22/src/xheader.c 2009-03-05 09:45:42.000000000 +0100 ++++ tar-1.22/src/xheader.c 2009-11-23 14:48:00.000000000 +0100 @@ -417,6 +417,74 @@ xheader_write_global (struct xheader *xh free (name); } @@ -938,517 +1471,3 @@ diff -urp tar-1.22-orig/src/xheader.c tar-1.22/src/xheader.c + { NULL, NULL, NULL, false } }; -diff -up /dev/null tar-1.17/src/xattrs.c ---- /dev/null 2007-12-10 11:30:31.504001819 +0100 -+++ tar-1.17/src/xattrs.c 2007-12-10 15:31:54.000000000 +0100 -@@ -0,0 +1,491 @@ -+/* Create a tar archive. -+ -+ Copyright (C) 2006 Free Software Foundation, Inc. -+ -+ Written by James Antill, on 2006-07-27. -+ -+ 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 2, 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. */ -+ -+#include -+ -+#include -+ -+#include "common.h" -+ -+ -+#ifndef HAVE_SELINUX_SELINUX_H -+# undef HAVE_LIBSELINUX -+#endif -+ -+#ifndef HAVE_ATTR_XATTR_H -+# undef HAVE_XATTRS -+#endif -+ -+#ifndef HAVE_SYS_ACL_H -+# undef HAVE_LIBACL -+#endif -+ -+#ifdef HAVE_SELINUX_SELINUX_H -+# include -+#endif -+ -+#ifdef HAVE_ATTR_XATTR_H -+# include -+#endif -+ -+#ifdef HAVE_SYS_ACL_H -+# include -+#endif -+ -+ -+#if 0 /* unused by xattr's atm. */ -+static void xattrs__fd_get(struct tar_stat_info *st, -+ char const *file_name, int fd, const char *attr, -+ char **ret_ptr, size_t *ret_len) -+{ -+#ifdef HAVE_XATTRS -+ static ssize_t asz = 1024; -+ ssize_t ret = 0; -+ static char *val = NULL; -+ -+ if (!val) val = xmalloc (asz); -+ -+ while (((ret = fgetxattr (fd, attr, val, asz)) == -1) && -+ (errno == ERANGE)) -+ { -+ asz <<= 1; -+ val = xrealloc (val, asz); -+ } -+ -+ if (ret != -1) -+ { -+ *ret_ptr = xmemdup (val, ret + 1); -+ *ret_len = ret; -+ } -+ else if (errno != ENOATTR) -+ call_arg_warn ("fgetxattr", file_name); -+#endif -+} -+#endif -+ -+static void xattrs__acls_get_a(struct tar_stat_info *st, -+ char const *file_name, int fd, -+ char **ret_ptr, size_t *ret_len) -+{ /* "system.posix_acl_access" */ -+#ifdef HAVE_LIBACL -+ char *val = NULL; -+ ssize_t len; -+ acl_t acl; -+ -+ if (fd != -1) -+ { -+ if ((acl = acl_get_fd (fd)) == (acl_t)NULL) -+ { -+ if (errno != ENOTSUP) -+ call_arg_warn ("acl_get_fd", file_name); -+ return; -+ } -+ } -+ else if ((acl = acl_get_file (file_name, ACL_TYPE_ACCESS)) == (acl_t)NULL) -+ { -+ if (errno != ENOTSUP) -+ call_arg_warn ("acl_get_file", file_name); -+ return; -+ } -+ -+ -+ val = acl_to_text(acl, &len); -+ acl_free (acl); -+ -+ if (val == NULL) -+ { -+ call_arg_warn ("acl_to_text", file_name); -+ return; -+ } -+ -+ *ret_ptr = xstrdup (val); -+ *ret_len = len; -+ -+ acl_free (val); -+#endif -+} -+ -+static void xattrs__acls_get_d(struct tar_stat_info *st, -+ char const *file_name, -+ char **ret_ptr, size_t *ret_len) -+{ /* "system.posix_acl_default" */ -+#ifdef HAVE_LIBACL -+ char *val = NULL; -+ ssize_t len; -+ acl_t acl; -+ -+ if ((acl = acl_get_file (file_name, ACL_TYPE_DEFAULT)) == (acl_t)NULL) -+ { -+ if (errno != ENOTSUP) -+ call_arg_warn ("acl_get_file", file_name); -+ return; -+ } -+ -+ val = acl_to_text(acl, &len); -+ acl_free (acl); -+ -+ if (val == NULL) -+ { -+ call_arg_warn ("acl_to_text", file_name); -+ return; -+ } -+ -+ *ret_ptr = xstrdup (val); -+ *ret_len = len; -+ -+ acl_free (val); -+#endif -+} -+ -+void xattrs_acls_get(struct tar_stat_info *st, char const *file_name, int fd, -+ int xisfile) -+{ -+ if (acls_option > 0) -+ { -+#ifndef HAVE_LIBACL -+ static int done = 0; -+ if (!done) -+ WARN ((0, 0, _("ACL support requested, but not available"))); -+ done = 1; -+#endif -+ xattrs__acls_get_a (st, file_name, fd, -+ &st->acls_a_ptr, &st->acls_a_len); -+ if (!xisfile) -+ xattrs__acls_get_d (st, file_name, -+ &st->acls_d_ptr, &st->acls_d_len); -+ } -+} -+ -+void xattrs_selinux_get(struct tar_stat_info *st, char const *file_name, int fd) -+{ -+ if (selinux_context_option > 0) -+ { -+#ifndef HAVE_LIBSELINUX -+ static int done = 0; -+ if (!done) -+ WARN ((0, 0, _("SELinux support requested, but not available"))); -+ done = 1; -+#else -+ if (fd == -1) -+ { -+ if ((lgetfilecon (file_name, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA)) -+ call_arg_warn ("lgetfilecon", file_name); -+ } -+ else if ((fgetfilecon (fd, &st->cntx_name) == -1) && (errno != ENOTSUP) && (errno != ENODATA)) -+ call_arg_warn ("fgetfilecon", file_name); -+#endif -+ } -+} -+ -+void xattrs_xattrs_get(struct tar_stat_info *st, char const *file_name, int fd) -+{ -+ if (xattrs_option > 0) -+ { /* get all xattrs ... this include security.* and system.* if -+ available. We filter them here, but we have to filter them -+ in xattrs_xattrs_set() anyway. -+ */ -+ static ssize_t xsz = 1024; -+ static char *xatrs = NULL; -+ ssize_t xret = -1; -+ -+#ifndef HAVE_XATTRS -+ static int done = 0; -+ if ((xattrs_option > 0) && !done) -+ WARN ((0, 0, _("Xattr support requested, but not available"))); -+ done = 1; -+#else -+ -+ if (!xatrs) xatrs = xmalloc (xsz); -+ -+ while (((fd == -1) ? -+ ((xret = listxattr (file_name, xatrs, xsz)) == -1) : -+ ((xret = flistxattr (fd, xatrs, xsz)) == -1)) && -+ (errno == ERANGE)) -+ { -+ xsz <<= 1; -+ xatrs = xrealloc (xatrs, xsz); -+ } -+ -+ if (xret == -1) -+ call_arg_warn ((fd == -1) ? "listxattrs" : "flistxattrs", file_name); -+ else -+ { -+ const char *attr = xatrs; -+ static ssize_t asz = 1024; -+ static char *val = NULL; -+ -+ if (!val) val = xmalloc (asz); -+ -+ while (xret > 0) -+ { -+ size_t len = strlen (attr); -+ ssize_t aret = 0; -+ -+ if (strncmp (attr, "user.", strlen("user.")) && -+ strncmp (attr, "trusted.", strlen("trusted."))) -+ goto next_attr; /* only store normal xattrs */ -+ -+ while (((fd == -1) ? -+ ((aret = getxattr (file_name, attr, val, asz)) == -1) : -+ ((aret = fgetxattr (fd, attr, val, asz)) == -1)) && -+ (errno == ERANGE)) -+ { -+ asz <<= 1; -+ val = xrealloc (val, asz); -+ } -+ -+ if (aret != -1) -+ xheader_xattr_add (st, attr, val, aret); -+ else if (errno != ENOATTR) -+ call_arg_warn ("fgetxattr", file_name); -+ -+ next_attr: -+ attr += len + 1; -+ xret -= len + 1; -+ } -+ } -+#endif -+ } -+} -+ -+static void xattrs__fd_set(struct tar_stat_info const *st, -+ char const *file_name, char typeflag, -+ const char *attr, -+ const char *ptr, size_t len) -+{ -+#ifdef HAVE_XATTRS -+ if (ptr) -+ { -+ const char *sysname = "setxattr"; -+ int ret = -1; -+ -+ if (typeflag != SYMTYPE) -+ ret = setxattr (file_name, attr, ptr, len, 0); -+ else -+ { -+ sysname = "lsetxattr"; -+ ret = lsetxattr (file_name, attr, ptr, len, 0); -+ } -+ -+ /* do not print warnings when SELinux is disabled */ -+ if ((ret == -1) && (errno != EPERM) && (errno != ENOTSUP)) -+ call_arg_error(sysname, file_name); -+ } -+#endif -+} -+ -+/* convert unix permissions into an ACL ... needed due to "default" ACLs */ -+#ifdef HAVE_LIBACL -+static acl_t perms2acl(int perms) -+{ -+ char val[] = "user::---,group::---,other::---"; -+ /* 0123456789 123456789 123456789 123456789 */ -+ -+ /* user */ -+ if (perms & 0400) val[ 6] = 'r'; -+ if (perms & 0200) val[ 7] = 'w'; -+ if (perms & 0100) val[ 8] = 'x'; -+ -+ /* group */ -+ if (perms & 0040) val[17] = 'r'; -+ if (perms & 0020) val[18] = 'w'; -+ if (perms & 0010) val[19] = 'x'; -+ -+ /* other */ -+ if (perms & 0004) val[28] = 'r'; -+ if (perms & 0002) val[29] = 'w'; -+ if (perms & 0001) val[30] = 'x'; -+ -+ return (acl_from_text (val)); -+} -+#endif -+ -+static char *skip_to_ext_fields(char *ptr) -+{ -+ ptr += strcspn(ptr, ":,\n"); /* skip tag name. Ie. user/group/default/mask */ -+ -+ if (*ptr != ':') -+ return (ptr); /* error? no user/group field */ -+ ++ptr; -+ -+ ptr += strcspn(ptr, ":,\n"); /* skip user/group name */ -+ -+ if (*ptr != ':') -+ return (ptr); /* error? no perms field */ -+ ++ptr; -+ -+ ptr += strcspn(ptr, ":,\n"); /* skip perms */ -+ -+ if (*ptr != ':') -+ return (ptr); /* no extra fields */ -+ -+ return (ptr); -+} -+ -+/* The POSIX draft allows extra fields after the three main ones. Star -+ uses this to add a fourth field for user/group which is the numeric ID. -+ We just skip all extra fields atm. */ -+static const char *fixup_extra_acl_fields(const char *ptr) -+{ -+ char *src = (char *)ptr; -+ char *dst = (char *)ptr; -+ -+ while (*src) -+ { -+ const char *old = src; -+ size_t len = 0; -+ -+ src = skip_to_ext_fields(src); -+ len = src - old; -+ if (old != dst) memmove(dst, old, len); -+ dst += len; -+ -+ if (*src == ':') /* We have extra fields, skip them all */ -+ src += strcspn(src, "\n,"); -+ -+ if ((*src == '\n') || (*src == ',')) -+ *dst++ = *src++; /* also done when dst == src, but that's ok */ -+ } -+ if (src != dst) -+ *dst = 0; -+ -+ return ptr; -+} -+ -+static void xattrs__acls_set(struct tar_stat_info const *st, -+ char const *file_name, int type, -+ const char *ptr, size_t len) -+{ /* "system.posix_acl_access" */ -+#ifdef HAVE_LIBACL -+ acl_t acl; -+ -+ if (ptr) -+ { -+ /* assert (strlen (ptr) == len); */ -+ ptr = fixup_extra_acl_fields(ptr); -+ -+ acl = acl_from_text (ptr); -+ acls_option = 1; -+ } -+ else if (acls_option > 0) -+ acl = perms2acl (st->stat.st_mode); -+ else -+ return; /* don't call acl functions unless we first hit an ACL, or -+ --acls was passed explicitly */ -+ -+ if (acl == (acl_t)NULL) -+ { -+ call_arg_warn ("acl_from_text", file_name); -+ return; -+ } -+ -+ if (acl_set_file (file_name, type, acl) == -1) -+ { -+ if (errno != ENOTSUP) -+ call_arg_warn ("acl_set_file", file_name); -+ } -+ acl_free (acl); -+#endif -+} -+ -+void xattrs_acls_set(struct tar_stat_info const *st, -+ char const *file_name, char typeflag) -+{ -+ if ((acls_option >= 0) && (typeflag != SYMTYPE)) -+ { -+#ifndef HAVE_LIBACL -+ static int done = 0; -+ if (!done) -+ WARN ((0, 0, _("ACL support requested, but not available"))); -+ done = 1; -+#else -+ xattrs__acls_set (st, file_name, ACL_TYPE_ACCESS, -+ st->acls_a_ptr, st->acls_a_len); -+ if ((typeflag == DIRTYPE) || (typeflag == GNUTYPE_DUMPDIR)) -+ xattrs__acls_set (st, file_name, ACL_TYPE_DEFAULT, -+ st->acls_d_ptr, st->acls_d_len); -+#endif -+ } -+} -+ -+void xattrs_selinux_set(struct tar_stat_info const *st, -+ char const *file_name, char typeflag) -+{ -+ if ((selinux_context_option >= 0) && st->cntx_name) -+ { -+ const char *sysname = "setfilecon"; -+ int ret = -1; -+ -+#ifndef HAVE_LIBSELINUX -+ static int done = 0; -+ if (!done) -+ WARN ((0, 0, _("SELinux support requested, but not available"))); -+ done = 1; -+#else -+ if (typeflag != SYMTYPE) -+ ret = setfilecon (file_name, st->cntx_name); -+ else -+ { -+ sysname = "lsetfilecon"; -+ ret = lsetfilecon (file_name, st->cntx_name); -+ } -+ -+ if ((ret == -1) && (errno == EPERM)) -+ call_arg_warn(sysname, file_name); -+ else if ((ret == -1) && (errno != EOPNOTSUPP)) -+ call_arg_error(sysname, file_name); -+#endif -+ } -+} -+ -+void xattrs_xattrs_set(struct tar_stat_info const *st, -+ char const *file_name, char typeflag) -+{ -+ if ((xattrs_option >= 0) && st->xattr_map_size) -+ { -+ size_t scan = 0; -+ -+#ifndef HAVE_XATTRS -+ static int done = 0; -+ if (!done) -+ WARN ((0, 0, _("Xattr support requested, but not available"))); -+ done = 1; -+#else -+ while (scan < st->xattr_map_size) -+ { -+ char *keyword = st->xattr_map[scan].xkey; -+ -+ /* assert (!memcpy (keyword, "SCHILY.xattr.", strlen("SCHILY.xattr."))); */ -+ keyword += strlen("SCHILY.xattr."); -+ -+ if (strncmp (keyword, "user.", strlen("user.")) && -+ strncmp (keyword, "trusted.", strlen("trusted."))) -+ continue; /* don't try and set anything but normal xattrs */ -+ -+ /* should we ignore trusted.* EPERM errors when not root ? */ -+ xattrs__fd_set (st, file_name, typeflag, keyword, -+ st->xattr_map[scan].xval_ptr, -+ st->xattr_map[scan].xval_len); -+ -+ ++scan; -+ } -+#endif -+ } -+} -+ -diff -up /dev/null tar-1.17/src/xattrs.h ---- /dev/null 2007-12-10 11:30:31.504001819 +0100 -+++ tar-1.17/src/xattrs.h 2007-12-10 15:31:54.000000000 +0100 -@@ -0,0 +1,14 @@ -+ -+extern void xattrs_acls_get(struct tar_stat_info *st, -+ char const *file_name, int fd, int xisfile); -+extern void xattrs_selinux_get(struct tar_stat_info *st, -+ char const *file_name, int fd); -+extern void xattrs_xattrs_get(struct tar_stat_info *st, -+ char const *file_name, int fd); -+ -+extern void xattrs_acls_set(struct tar_stat_info const *st, -+ char const *file_name, char typeflag); -+extern void xattrs_selinux_set(struct tar_stat_info const *st, -+ char const *file_name, char typeflag); -+extern void xattrs_xattrs_set(struct tar_stat_info const *st, -+ char const *file_name, char typeflag); diff --git a/tar-1.22-store-lnk-selinux.patch b/tar-1.22-store-lnk-selinux.patch deleted file mode 100644 index 9b44d58..0000000 --- a/tar-1.22-store-lnk-selinux.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/create.c b/src/create.c -index c7cf64c..f807a3d 100644 ---- a/src/create.c -+++ b/src/create.c -@@ -1746,6 +1746,8 @@ dump_file0 (struct tar_stat_info *st, const char *p, - if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size) - write_long_link (st); - -+ xattrs_selinux_get(st, p, -1); -+ - block_ordinal = current_block_ordinal (); - st->stat.st_size = 0; /* force 0 size on symlink */ - header = start_header (st); diff --git a/tar-1.22-xheaderleak.patch b/tar-1.22-xheaderleak.patch new file mode 100644 index 0000000..22e1615 --- /dev/null +++ b/tar-1.22-xheaderleak.patch @@ -0,0 +1,11 @@ +diff -urNp tar-1.22-orig/src/xheader.c tar-1.22/src/xheader.c +--- tar-1.22-orig/src/xheader.c 2009-11-23 15:29:22.000000000 +0100 ++++ tar-1.22/src/xheader.c 2009-11-23 15:30:55.000000000 +0100 +@@ -722,7 +722,6 @@ xheader_read (struct xheader *xhdr, unio + { + size_t j = 0; + +- xheader_init (xhdr); + size += BLOCKSIZE; + xhdr->size = size; + xhdr->buffer = xmalloc (size + 1); diff --git a/tar.1 b/tar.1 index ee890bf..4f3efb6 100644 --- a/tar.1 +++ b/tar.1 @@ -1,675 +1,591 @@ -.TH TAR 1 "Oct 2004" "GNU" "tar" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35. +.TH TAR "1" "November 2009" "tar 1.22" "User Commands" .SH NAME -tar \- The GNU version of the tar archiving utility +tar \- manual page for tar 1.22 .SH SYNOPSIS .B tar -.I [options] - -.I Operations: -.nf -.B [-]A --catenate --concatenate -.B [-]c --create -.B [-]d --diff --compare -.B [-]r --append -.B [-]t --list -.B [-]u --update -.B [-]x --extract --get -.B --delete -.fi - -.I Common Options: -.nf -.B -C, --directory DIR -.B -f, --file F -.B -j, --bzip2 -.B -p, --preserve-permissions -.B -v, --verbose -.B -z, --gzip -.fi - -.I All Options: -.br -[ -.B --atime-preserve -] -[ -.B -b, --blocking-factor N -] -[ -.B -B, --read-full-records -] -[ -.B --backup BACKUP-TYPE -] -[ -.B --block-compress -] -[ -.B -C, --directory DIR -] -[ -.B -l, --check-links -] -[ -.B --checkpoint -] -[ -.B -f, --file [HOSTNAME:]F -] -[ -.B -F, --info-script F --new-volume-script F -] -[ -.B --force-local -] -[ -.B --format FORMAT -] -[ -.B -g, --listed-incremental F -] -[ -.B -G, --incremental -] -[ -.B --group GROUP -] -[ -.B -h, --dereference -] -[ -.B --help -] -[ -.B -i, --ignore-zeros -] -[ -.B --ignore-case -] -[ -.B --ignore-failed-read -] -[ -.B --index-file FILE -] -[ -.B -j, --bzip2 -] -[ -.B -k, --keep-old-files -] -[ -.B -K, --starting-file F -] -[ -.B --keep-newer-files -] -[ -.B --one-file-system -] -[ -.B -L, --tape-length N -] -[ -.B -m, --touch, --modification-time -] -[ -.B -M, --multi-volume -] -[ -.B --mode PERMISSIONS -] -[ -.B -N, --after-date DATE, --newer DATE -] -[ -.B --newer-mtime DATE -] -[ -.B --no-anchored -] -[ -.B --no-ignore-case -] -[ -.B --no-recursion -] -[ -.B --no-same-permissions -] -[ -.B --no-wildcards -] -[ -.B --no-wildcards-match-slash -] -[ -.B --null -] -[ -.B --numeric-owner -] -[ -.B -o, --old-archive, --portability, --no-same-owner -] -[ -.B -O, --to-stdout -] -[ -.B --occurrence[=NUM] -] -[ -.B --overwrite -] -[ -.B --overwrite-dir -] -[ -.B --owner USER -] -[ -.B -p, --same-permissions, --preserve-permissions -] -[ -.B -P, --absolute-names -] -[ -.B --pax-option KEYWORD-LIST -] -[ -.B --posix -] -[ -.B --preserve -] -[ -.B --acls -] -[ -.B --selinux -] -[ -.B --xattrs -] -[ -.B --no-acls -] -[ -.B --no-selinux -] -[ -.B --no-xattrs -] -[ -.B -R, --block-number -] -[ -.B --record-size SIZE -] -[ -.B --recursion -] -[ -.B --recursive-unlink -] -[ -.B --remove-files -] -[ -.B --rmt-command CMD -] -[ -.B --rsh-command CMD -] -[ -.B -s, --same-order, --preserve-order -] -[ -.B -S, --sparse -] -[ -.B --same-owner -] -[ -.B --show-defaults -] -[ -.B --show-omitted-dirs -] -[ -.B --strip-components NUMBER, --strip-path NUMBER (1) -] -[ -.B --suffix SUFFIX -] -[ -.B -T, --files-from F -] -[ -.B --totals -] -[ -.B -U, --unlink-first -] -[ -.B --use-compress-program PROG -] -[ -.B --utc -] -[ -.B -v, --verbose -] -[ -.B -V, --label NAME -] -[ -.B --version -] -[ -.B --volno-file F -] -[ -.B -w, --interactive, --confirmation -] -[ -.B -W, --verify -] -[ -.B --wildcards -] -[ -.B --wildcards-match-slash -] -[ -.B --exclude PATTERN -] -[ -.B -X, --exclude-from FILE -] -[ -.B -Z, --compress, --uncompress -] -[ -.B -z, --gzip, --gunzip, --ungzip -] -[ -.B -[0-7][lmh] -] - -(1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-components +[\fIOPTION\fR...] [\fIFILE\fR]... .SH DESCRIPTION -This manual page documents the GNU version of \fBtar\fR, an archiving -program designed to store and extract files from an archive file known -as a \fItarfile\fR. A \fItarfile\fR may be made on a tape drive, -however, it is also common to write a \fItarfile\fR to a normal file. -The first argument to \fBtar\fR must be one of the options \fBAcdrtux\fR, -followed by any optional functions. The final arguments to \fBtar\fR -are the names of the files or directories which should be archived. The -use of a directory name always implies that the subdirectories below -should be included in the archive. +GNU `tar' saves many files together into a single tape or disk archive, and can +restore individual files from the archive. .SH EXAMPLES .TP -.B tar -xvf foo.tar -verbosely extract foo.tar +tar \fB\-cf\fR archive.tar foo bar +# Create archive.tar from files foo and bar. .TP -.B tar -xzf foo.tar.gz -extract gzipped foo.tar.gz +tar \fB\-tvf\fR archive.tar +# List all files in archive.tar verbosely. .TP -.B tar -cjf foo.tar.bz2 bar/ -create bzipped tar archive of the directory bar called foo.tar.bz2 +tar \fB\-xf\fR archive.tar +# Extract all files from archive.tar. +.IP +.SH OPTIONS +.SH Main operation mode: .TP -.B tar -xjf foo.tar.bz2 -C bar/ -extract bzipped foo.tar.bz2 after changing directory to bar -.TP -.B tar -xzf foo.tar.gz blah.txt -extract the file blah.txt from foo.tar.gz -.SH "FUNCTION LETTERS" -.TP -.B One of the following options must be used: -.TP -.B -A, --catenate, --concatenate +\fB\-A\fR, \fB\-\-catenate\fR, \fB\-\-concatenate\fR append tar files to an archive .TP -.B -c, --create +\fB\-c\fR, \fB\-\-create\fR create a new archive .TP -.B -d, --diff, --compare +\fB\-d\fR, \fB\-\-diff\fR, \fB\-\-compare\fR find differences between archive and file system .TP -.B -r, --append +\fB\-\-delete\fR +delete from the archive (not on mag tapes!) +.TP +\fB\-r\fR, \fB\-\-append\fR append files to the end of an archive .TP -.B -t, --list +\fB\-t\fR, \fB\-\-list\fR list the contents of an archive .TP -.B -u, --update -only append files that are newer than the existing in archive +\fB\-\-test\-label\fR +test the archive volume label and exit .TP -.B -x, --extract, --get +\fB\-u\fR, \fB\-\-update\fR +only append files newer than copy in archive +.TP +\fB\-x\fR, \fB\-\-extract\fR, \fB\-\-get\fR extract files from an archive +.IP + +.SH\fBCommon Options:\fR .TP -.B --delete -delete from the archive (not for use on mag tapes!) -.SH "COMMON OPTIONS" -.TP -.B -C, --directory DIR +\fB-C\fR, \fB--directory=DIR\fR change to directory DIR .TP -.B -f, --file [HOSTNAME:]F -Use archive file or device F (default "-", meaning stdin/stdout). -Note that "/dev/stdout" is not equivalent to "-". Using "/dev/stdout" -explicitly can lead to corrupted archive, especially when coupled with "-v". +\fB-f\fR, \fB--file=ARCHIVE\fR +use archive file or device ARCHIVE .TP -.B -j, --bzip2 -filter archive through bzip2, use to decompress .bz2 files +\fB-j\fR, \fB--bzip2\fR +filter the archive through bzip2 .TP -.B -p, --preserve-permissions -extract all protection information +\fB -J\fR, \fB--xz\fR +filter the archive through xz .TP -.B -v, --verbose +\fB-p\fR, \fB--preserve-permissions\fR +extract information about file permissions (default for superuser) +.TP +\fB-v\fR, \fB--verbose\fR verbosely list files processed .TP -.B -z, --gzip, --ungzip +\fB-z\fR, \fB--gzip\fR filter the archive through gzip -.SH "ALL OPTIONS" + +.SH Operation modifiers: .TP -.B --atime-preserve -don't change access times on dumped files +\fB\-\-check\-device\fR +check device numbers when creating incremental +archives (default) .TP -.B -b, --blocking-factor N -block size of Nx512 bytes (default N=20) +\fB\-g\fR, \fB\-\-listed\-incremental\fR=\fIFILE\fR +handle new GNU\-format incremental backup .TP -.B -B, --read-full-blocks -reblock as we read (for reading 4.2BSD pipes) +\fB\-G\fR, \fB\-\-incremental\fR +handle old GNU\-format incremental backup .TP -.B --backup BACKUP-TYPE -backup files instead of deleting them using BACKUP-TYPE simple or -numbered +\fB\-\-ignore\-failed\-read\fR +do not exit with nonzero on unreadable files .TP -.B --block-compress -block the output of compression program for tapes +\fB\-n\fR, \fB\-\-seek\fR +archive is seekable .TP -.B -C, --directory DIR -change to directory DIR +\fB\-\-no\-check\-device\fR +do not check device numbers when creating +incremental archives .TP -.B -l, --check-links -warn if number of hard links to the file on the filesystem mismatch the -number of links recorded in the archive +\fB\-\-occurrence\fR[=\fINUMBER\fR] +process only the NUMBERth occurrence of each file +in the archive; this option is valid only in +conjunction with one of the subcommands \fB\-\-delete\fR, +\fB\-\-diff\fR, \fB\-\-extract\fR or \fB\-\-list\fR and when a list of +files is given either on the command line or via +the \fB\-T\fR option; NUMBER defaults to 1 .TP -.B --checkpoint -print directory names while reading the archive +\fB\-\-sparse\-version\fR=\fIMAJOR[\fR.MINOR] +set version of the sparse format to use (implies +\fB\-\-sparse\fR) .TP -.B -f, --file [HOSTNAME:]F -Use archive file or device F (default "-", meaning stdin/stdout). -Note that "/dev/stdout" is not equivalent to "-". Using "/dev/stdout" -explicitly can lead to corrupted archive, especially when coupled with "-v". +\fB\-S\fR, \fB\-\-sparse\fR +handle sparse files efficiently +.IP +.SH Overwrite control: .TP -.B -F, --info-script F --new-volume-script F -run script at end of each tape (implies \fI--multi-volume\fR) +\fB\-k\fR, \fB\-\-keep\-old\-files\fR +don't replace existing files when extracting .TP -.B --force-local -archive file is local even if has a colon +\fB\-\-keep\-newer\-files\fR +don't replace existing files that are newer than +their archive copies .TP -.B --format FORMAT -selects output archive format -.nf -\fIv7\fR - Unix V7 -\fIoldgnu\fR - GNU tar <=1.12 -\fIgnu\fR - GNU tar 1.13 -\fIustar\fR - POSIX.1-1988 -\fIposix\fR - POSIX.1-2001 -.fi +\fB\-\-no\-overwrite\-dir\fR +preserve metadata of existing directories .TP -.B -g, --listed-incremental F -create/list/extract new GNU-format incremental backup +\fB\-\-overwrite\fR +overwrite existing files when extracting .TP -.B -G, --incremental -create/list/extract old GNU-format incremental backup +\fB\-\-overwrite\-dir\fR +overwrite metadata of existing directories when +extracting (default) .TP -.B -h, --dereference -don't dump symlinks; dump the files they point to +\fB\-\-recursive\-unlink\fR +empty hierarchies prior to extracting directory .TP -.B --help -like this manpage, but not as cool -.TP -.B -i, --ignore-zeros -ignore blocks of zeros in archive (normally mean EOF) -.TP -.B --ignore-case -ignore case when excluding files -.TP -.B --ignore-failed-read -don't exit with non-zero status on unreadable files -.TP -.B --index-file FILE -send verbose output to FILE instead of stdout -.TP -.B -j, --bzip2 -filter archive through bzip2, use to decompress .bz2 files -.TP -.B -k, --keep-old-files -keep existing files; don't overwrite them from archive -.TP -.B -K, --starting-file F -begin at file F in the archive -.TP -.B --keep-newer-files -do not overwrite files which are newer than the archive -.TP -.B --one-file-system -stay in local file system when creating an archive -.TP -.B -L, --tape-length N -change tapes after writing N*1024 bytes -.TP -.B -m, --touch, --modification-time -don't extract file modified time -.TP -.B -M, --multi-volume -create/list/extract multi-volume archive -.TP -.B --mode PERMISSIONS -apply PERMISSIONS while adding files (see \fBchmod\fR(1)) -.TP -.B -N, --after-date DATE, --newer DATE -only store files newer than DATE -.TP -.B --newer-mtime DATE -like \fI--newer\fR, but with a DATE -.TP -.B --no-anchored -match any subsequenceof the name's components with \fI--exclude\fR -.TP -.B --no-ignore-case -use case-sensitive matching with \fI--exclude\fR -.TP -.B --no-recursion -don't recurse into directories -.TP -.B --no-same-permissions -apply user's umask when extracting files instead of recorded permissions -.TP -.B --no-wildcards -don't use wildcards with \fI--exclude\fR -.TP -.B --no-wildcards-match-slash -wildcards do not match slashes (/) with \fI--exclude\fR -.TP -.B --null -\fI--files-from\fR reads null-terminated names, disable \fI--directory\fR -.TP -.B --numeric-owner -always use numbers for user/group names -.TP -.B -o, --old-archive, --portability -like \fI--format=v7\fR; \fI-o\fR exhibits this behavior when creating an -archive (deprecated behavior) -.TP -.B -o, --no-same-owner -do not attempt to restore ownership when extracting; \fI-o\fR exhibits -this behavior when extracting an archive -.TP -.B -O, --to-stdout -extract files to standard output -.TP -.B --occurrence[=NUM] -process only the NUMth occurrence of each named file; used with -\fI--delete\fR, \fI--diff\fR, \fI--extract\fR, or \fI--list\fR. -NUM defaults to 1. -.TP -.B --overwrite -overwrite existing files and directory metadata when extracting -.TP -.B --overwrite-dir -overwrite directory metadata when extracting -.TP -.B --owner USER -change owner of extraced files to USER -.TP -.B -p, --same-permissions, --preserve-permissions -extract all protection information -.TP -.B -P, --absolute-names -don't strip leading `/'s from file names -.TP -.B --pax-option KEYWORD-LIST -used only with POSIX.1-2001 archives to modify the way \fBtar\fR handles -extended header keywords -.TP -.B --posix -like \fI--format=posix\fR -.TP -.B --preserve -like \fI--preserve-permissions\fR \fI--same-order\fR -.TP -.B --acls -this option causes \fBtar\fR to store each file's ACLs in the archive. -.TP -.B --selinux -this option causes \fBtar\fR to store each file's SELinux security context information in the archive. -.TP -.B --xattrs -this option causes \fBtar\fR to store each file's extended attributes in the archive. This option also enables \fI--acls\fR and\fI--selinux\fR if they haven't been set already, due to the fact that the data for those are stored in special xattrs. -.TP -.B --no-acls -This option causes \fBtar\fR not to store each file's ACLs in the archive and not to extract any ACL information in an archive. -.TP -.B --no-selinux -this option causes \fBtar\fR not to store each file's SELinux security context information in the archive and not to extract any SELinux information in an archive. -.TP -.B --no-xattrs -this option causes \fBtar\fR not to store each file's extended attributes in the archive and not to extract any extended attributes in an archive. This option also enables \fI--no-acls\fR and \fI--no-selinux\fR if they haven't been set already. -.TP -.B -R, --record-number -show record number within archive with each message -.TP -.B --record-size SIZE -use SIZE bytes per record when accessing archives -.TP -.B --recursion -recurse into directories -.TP -.B --recursive-unlink -remove existing directories before extracting directories of the same name -.TP -.B --remove-files +\fB\-\-remove\-files\fR remove files after adding them to the archive .TP -.B --rmt-command CMD -use CMD instead of the default /usr/sbin/rmt +\fB\-U\fR, \fB\-\-unlink\-first\fR +remove each file prior to extracting over it .TP -.B --rsh-command CMD -use remote CMD instead of \fBrsh\fR(1) -.TP -.B -s, --same-order, --preserve-order -list of names to extract is sorted to match archive -.TP -.B -S, --sparse -handle sparse files efficiently -.TP -.B --same-owner -create extracted files with the same ownership -.TP -.B --show-defaults -display the default options used by \fBtar\fR -.TP -.B --show-omitted-dirs -print directories \fBtar\fR skips while operating on an archive -.TP -.B --strip-components NUMBER, --strip-path NUMBER -strip NUMBER of leading components from file names before extraction - -(1) tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-components -.TP -.B --suffix SUFFIX -use SUFFIX instead of default '~' when backing up files -.TP -.B -T, --files-from F -get names to extract or create from file F -.TP -.B --totals -print total bytes written with --create -.TP -.B -U, --unlink-first -remove existing files before extracting files of the same name -.TP -.B --use-compress-program PROG -access the archive through PROG which is generally a compression program -.TP -.B --utc -display file modification dates in UTC -.TP -.B -v, --verbose -verbosely list files processed -.TP -.B -V, --label NAME -create archive with volume name NAME -.TP -.B --version -print \fBtar\fR program version number -.TP -.B --volno-file F -keep track of which volume of a multi-volume archive its working in -FILE; used with \fI--multi-volume\fR -.TP -.B -w, --interactive, --confirmation -ask for confirmation for every action -.TP -.B -W, --verify +\fB\-W\fR, \fB\-\-verify\fR attempt to verify the archive after writing it +.IP +.SH Select output stream: +.HP +\fB\-\-ignore\-command\-error\fR ignore exit codes of children .TP -.B --wildcards -use wildcards with \fI--exclude\fR +\fB\-\-no\-ignore\-command\-error\fR +treat non\-zero exit codes of children as +error .TP -.B --wildcards-match-slash -wildcards match slashes (/) with \fI--exclude\fR +\fB\-O\fR, \fB\-\-to\-stdout\fR +extract files to standard output .TP -.B --exclude PATTERN -exclude files based upon PATTERN +\fB\-\-to\-command\fR=\fICOMMAND\fR +pipe extracted files to another program +.IP +Handling of file attributes: .TP -.B -X, --exclude-from FILE -exclude files listed in FILE +\fB\-\-acls\fR +Save the ACLs to the archive .TP -.B -Z, --compress, --uncompress -filter the archive through compress +\fB\-\-atime\-preserve\fR[=\fIMETHOD\fR] +preserve access times on dumped files, either +by restoring the times after reading +(METHOD='replace'; default) or by not setting the +times in the first place (METHOD='system') .TP -.B -z, --gzip, --gunzip, --ungzip +\fB\-\-delay\-directory\-restore\fR +delay setting modification times and +permissions of extracted directories until the end +of extraction +.TP +\fB\-\-group\fR=\fINAME\fR +force NAME as group for added files +.TP +\fB\-\-mode\fR=\fICHANGES\fR +force (symbolic) mode CHANGES for added files +.TP +\fB\-\-mtime\fR=\fIDATE\-OR\-FILE\fR +set mtime for added files from DATE\-OR\-FILE +.TP +\fB\-m\fR, \fB\-\-touch\fR +don't extract file modified time +.TP +\fB\-\-no\-acls\fR +Don't extract the ACLs from the archive +.TP +\fB\-\-no\-delay\-directory\-restore\fR +cancel the effect of \fB\-\-delay\-directory\-restore\fR +option +.TP +\fB\-\-no\-same\-owner\fR +extract files as yourself +.TP +\fB\-\-no\-same\-permissions\fR +apply the user's umask when extracting permissions +from the archive (default for ordinary users) +.TP +\fB\-\-no\-selinux\fR +Don't extract the SELinux context from the archive +.TP +\fB\-\-no\-xattrs\fR +Don't extract the user/root xattrs from the +archive +.TP +\fB\-\-numeric\-owner\fR +always use numbers for user/group names +.TP +\fB\-\-owner\fR=\fINAME\fR +force NAME as owner for added files +.TP +\fB\-p\fR, \fB\-\-preserve\-permissions\fR, \fB\-\-same\-permissions\fR +extract information about file permissions +(default for superuser) +.TP +\fB\-\-preserve\fR +same as both \fB\-p\fR and \fB\-s\fR +.TP +\fB\-\-same\-owner\fR +try extracting files with the same ownership +.TP +\fB\-s\fR, \fB\-\-preserve\-order\fR, \fB\-\-same\-order\fR +sort names to extract to match archive +.TP +\fB\-\-selinux\fR +Save the SELinux context to the archive +.TP +\fB\-\-xattrs\fR +Save the user/root xattrs to the archive +.IP +.SH Device selection and switching: +.TP +\fB\-f\fR, \fB\-\-file\fR=\fIARCHIVE\fR +use archive file or device ARCHIVE +.TP +\fB\-\-force\-local\fR +archive file is local even if it has a colon +.TP +\fB\-F\fR, \fB\-\-info\-script\fR=\fINAME\fR, \fB\-\-new\-volume\-script\fR=\fINAME\fR +run script at end of each tape (implies \fB\-M\fR) +.TP +\fB\-L\fR, \fB\-\-tape\-length\fR=\fINUMBER\fR +change tape after writing NUMBER x 1024 bytes +.TP +\fB\-M\fR, \fB\-\-multi\-volume\fR +create/list/extract multi\-volume archive +.TP +\fB\-\-rmt\-command\fR=\fICOMMAND\fR +use given rmt COMMAND instead of rmt +.TP +\fB\-\-rsh\-command\fR=\fICOMMAND\fR +use remote COMMAND instead of rsh +.TP +\fB\-\-volno\-file\fR=\fIFILE\fR +use/update the volume number in FILE +.IP +.SH Device blocking: +.TP +\fB\-b\fR, \fB\-\-blocking\-factor\fR=\fIBLOCKS\fR +BLOCKS x 512 bytes per record +.TP +\fB\-B\fR, \fB\-\-read\-full\-records\fR +reblock as we read (for 4.2BSD pipes) +.TP +\fB\-i\fR, \fB\-\-ignore\-zeros\fR +ignore zeroed blocks in archive (means EOF) +.TP +\fB\-\-record\-size\fR=\fINUMBER\fR +NUMBER of bytes per record, multiple of 512 +.IP +.SH Archive format selection: +.TP +\fB\-H\fR, \fB\-\-format\fR=\fIFORMAT\fR +create archive of the given format +.IP +FORMAT is one of the following: +.TP +gnu +GNU tar 1.13.x format +.TP +oldgnu +GNU format as per tar <= 1.12 +.TP +pax +POSIX 1003.1\-2001 (pax) format +.TP +posix +same as pax +.TP +ustar +POSIX 1003.1\-1988 (ustar) format +.TP +v7 +old V7 tar format +.TP +\fB\-\-old\-archive\fR, \fB\-\-portability\fR +same as \fB\-\-format\fR=\fIv7\fR +.TP +\fB\-\-pax\-option\fR=\fIkeyword[[\fR:]=value][,keyword[[:]=value]]... +control pax keywords +.TP +\fB\-\-posix\fR +same as \fB\-\-format\fR=\fIposix\fR +.TP +\fB\-V\fR, \fB\-\-label\fR=\fITEXT\fR +create archive with volume name TEXT; at +list/extract time, use TEXT as a globbing pattern +for volume name +.IP +\fBCompression options:\fR +.TP +\fB\-a\fR, \fB\-\-auto\-compress\fR +use archive suffix to determine the compression +program +.TP +\fB\-I\fR, \fB\-\-use\-compress\-program\fR=\fIPROG\fR +filter through PROG (must accept \fB\-d\fR) +.TP +\fB\-j\fR, \fB\-\-bzip2\fR +filter the archive through bzip2 +.TP +\fB\-\-lzma\fR +filter the archive through lzma +.TP +\fB\-\-no\-auto\-compress\fR +do not use archive suffix to determine the +compression program +.TP +\fB\-z\fR, \fB\-\-gzip\fR, \fB\-\-gunzip\fR, \fB\-\-ungzip\fR filter the archive through gzip .TP -.B --use-compress-program PROG -filter the archive through PROG (which must accept -d) +\fB\-Z\fR, \fB\-\-compress\fR, \fB\-\-uncompress\fR +filter the archive through compress .TP -.B -[0-7][lmh] -specify drive and density -.SH BUGS -The GNU folks, in general, abhor man pages, and create info documents instead. -The maintainer of \fBtar\fR falls into this category. Thus this man page may -not be complete, nor current, and was included in the Red Hat CVS tree -because man is a great tool :). This man page was first taken from Debian -Linux and has since been loving updated here. +\fB\-J\fR, \fB\-\-xz\fR +filter the archive through xz +.TP +\fB\-\-lzop\fR +filter the archive through lzop +.IP +.SH Local file selection: +.TP +\fB\-\-add\-file\fR=\fIFILE\fR +add given FILE to the archive (useful if its name +starts with a dash) +.TP +\fB\-\-backup\fR[=\fICONTROL\fR] +backup before removal, choose version CONTROL +.TP +\fB\-C\fR, \fB\-\-directory\fR=\fIDIR\fR +change to directory DIR +.TP +\fB\-\-exclude\fR=\fIPATTERN\fR +exclude files, given as a PATTERN +.TP +\fB\-\-exclude\-caches\fR +exclude contents of directories containing +CACHEDIR.TAG, except for the tag file itself +.TP +\fB\-\-exclude\-caches\-all\fR +exclude directories containing CACHEDIR.TAG +.TP +\fB\-\-exclude\-caches\-under\fR exclude everything under directories containing +CACHEDIR.TAG +.TP +\fB\-\-exclude\-tag\fR=\fIFILE\fR +exclude contents of directories containing FILE, +except for FILE itself +.HP +\fB\-\-exclude\-tag\-all\fR=\fIFILE\fR exclude directories containing FILE +.TP +\fB\-\-exclude\-tag\-under\fR=\fIFILE\fR +exclude everything under directories +containing FILE +.TP +\fB\-\-exclude\-vcs\fR +exclude version control system directories +.TP +\fB\-h\fR, \fB\-\-dereference\fR +follow symlinks; archive and dump the files they +point to +.TP +\fB\-\-hard\-dereference\fR +follow hard links; archive and dump the files they +refer to +.TP +\fB\-K\fR, \fB\-\-starting\-file\fR=\fIMEMBER\-NAME\fR +begin at member MEMBER\-NAME in the archive +.TP +\fB\-\-newer\-mtime\fR=\fIDATE\fR +compare date and time when data changed only +.TP +\fB\-\-no\-null\fR +disable the effect of the previous \fB\-\-null\fR option +.TP +\fB\-\-no\-recursion\fR +avoid descending automatically in directories +.TP +\fB\-\-no\-unquote\fR +do not unquote filenames read with \fB\-T\fR +.HP +\fB\-\-null\fR \fB\-T\fR reads null\-terminated names, disable \fB\-C\fR +.TP +\fB\-N\fR, \fB\-\-newer\fR=\fIDATE\-OR\-FILE\fR, \fB\-\-after\-date\fR=\fIDATE\-OR\-FILE\fR +only store files newer than DATE\-OR\-FILE +.TP +\fB\-\-one\-file\-system\fR +stay in local file system when creating archive +.TP +\fB\-P\fR, \fB\-\-absolute\-names\fR +don't strip leading `/'s from file names +.TP +\fB\-\-recursion\fR +recurse into directories (default) +.TP +\fB\-\-suffix\fR=\fISTRING\fR +backup before removal, override usual suffix ('~' +unless overridden by environment variable +SIMPLE_BACKUP_SUFFIX) +.TP +\fB\-T\fR, \fB\-\-files\-from\fR=\fIFILE\fR +get names to extract or create from FILE +.TP +\fB\-\-unquote\fR +unquote filenames read with \fB\-T\fR (default) +.TP +\fB\-X\fR, \fB\-\-exclude\-from\fR=\fIFILE\fR +exclude patterns listed in FILE +.IP +.SH File name transformations: +.TP +\fB\-\-strip\-components\fR=\fINUMBER\fR +strip NUMBER leading components from file +names on extraction +.TP +\fB\-\-transform\fR=\fIEXPRESSION\fR, \fB\-\-xform\fR=\fIEXPRESSION\fR +use sed replace EXPRESSION to transform file +names +.IP +File name matching options (affect both exclude and include patterns): +.TP +\fB\-\-anchored\fR +patterns match file name start +.TP +\fB\-\-ignore\-case\fR +ignore case +.TP +\fB\-\-no\-anchored\fR +patterns match after any `/' (default for +exclusion) +.TP +\fB\-\-no\-ignore\-case\fR +case sensitive matching (default) +.TP +\fB\-\-no\-wildcards\fR +verbatim string matching +.TP +\fB\-\-no\-wildcards\-match\-slash\fR +wildcards do not match `/' +.TP +\fB\-\-wildcards\fR +use wildcards (default) +.TP +\fB\-\-wildcards\-match\-slash\fR +wildcards match `/' (default for exclusion) +.IP +Informative output: +.TP +\fB\-\-checkpoint\fR[=\fINUMBER\fR] +display progress messages every NUMBERth record +(default 10) +.TP +\fB\-\-checkpoint\-action\fR=\fIACTION\fR +execute ACTION on each checkpoint +.TP +\fB\-\-index\-file\fR=\fIFILE\fR +send verbose output to FILE +.TP +\fB\-l\fR, \fB\-\-check\-links\fR +print a message if not all links are dumped +.TP +\fB\-\-no\-quote\-chars\fR=\fISTRING\fR +disable quoting for characters from STRING +.TP +\fB\-\-quote\-chars\fR=\fISTRING\fR +additionally quote characters from STRING +.TP +\fB\-\-quoting\-style\fR=\fISTYLE\fR +set name quoting style; see below for valid STYLE +values +.TP +\fB\-R\fR, \fB\-\-block\-number\fR +show block number within archive with each +message +.TP +\fB\-\-show\-defaults\fR +show tar defaults +.TP +\fB\-\-show\-omitted\-dirs\fR +when listing or extracting, list each directory +that does not match search criteria +.TP +\fB\-\-show\-transformed\-names\fR, \fB\-\-show\-stored\-names\fR +show file or archive names after transformation +.TP +\fB\-\-totals\fR[=\fISIGNAL\fR] +print total bytes after processing the archive; +with an argument \- print total bytes when this +SIGNAL is delivered; Allowed signals are: SIGHUP, +SIGQUIT, SIGINT, SIGUSR1 and SIGUSR2; the names +without SIG prefix are also accepted +.TP +\fB\-\-utc\fR +print file modification dates in UTC +.TP +\fB\-v\fR, \fB\-\-verbose\fR +verbosely list files processed +.TP +\fB\-w\fR, \fB\-\-interactive\fR, \fB\-\-confirmation\fR +ask for confirmation for every action +.IP + +.SH Compatibility options: +.TP +\fB\-o\fR +when creating, same as \fB\-\-old\-archive\fR; when +extracting, same as \fB\-\-no\-same\-owner\fR +.IP + +.SH Other options: +.TP +\-?, \fB\-\-help\fR +give this help list +.TP +\fB\-\-restrict\fR +disable use of some potentially harmful options +.TP +\fB\-\-usage\fR +give a short usage message +.TP +\fB\-\-version\fR +print program version +.PP +.PP +Mandatory or optional arguments to long options are also mandatory or optional +for any corresponding short options. +.PP +The backup suffix is `~', unless set with \fB\-\-suffix\fR or SIMPLE_BACKUP_SUFFIX. +The version control may be set with \fB\-\-backup\fR or VERSION_CONTROL, values are: +.TP +none, off +never make backups +.TP +t, numbered +make numbered backups +.TP +nil, existing +numbered if numbered backups exist, simple otherwise +.TP +never, simple +always make simple backups +.PP +Valid arguments for \fB\-\-quoting\-style\fR options are: +.IP +literal +shell +shell\-always +c +c\-maybe +escape +locale +clocale +.PP +.SH DEFAULTS +*This* tar defaults to: +\fB\-\-format\fR=\fIgnu\fR \fB\-f\-\fR \fB\-b20\fR \fB\-\-quoting\-style\fR=\fIescape\fR \fB\-\-rmt\-command=\fR/sbin/rmt +\fB\-\-rsh\-command=\fR/usr/bin/rsh +.SH AUTHOR +Written by John Gilmore and Jay Fenlason. .SH "REPORTING BUGS" -Please report bugs via https://bugzilla.redhat.com +Report bugs to . +.SH COPYRIGHT +Copyright \(co 2009 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later . +.br +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. .SH "SEE ALSO" The full documentation for .B tar @@ -682,8 +598,3 @@ programs are properly installed at your site, the command .B info tar .PP should give you access to the complete manual. -.SH "AUTHORS" -.nf -Debian Linux http://www.debian.org/ -Mike Frysinger -.fi diff --git a/tar.spec b/tar.spec index 200c470..9bafa1c 100644 --- a/tar.spec +++ b/tar.spec @@ -2,7 +2,7 @@ Summary: A GNU file archiving program Name: tar Epoch: 2 Version: 1.22 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv3+ Group: Applications/Archiving URL: http://www.gnu.org/software/tar/ @@ -12,11 +12,11 @@ Source2: tar.1 Patch1: tar-1.14-loneZeroWarning.patch Patch2: tar-1.15.1-vfatTruncate.patch Patch3: tar-1.19-xattrs.patch -Patch4: tar-1.22-store-lnk-selinux.patch -Patch5: tar-1.17-wildcards.patch -Patch6: tar-1.22-atime-rofs.patch -Patch7: tar-1.22-shortreadbuffer.patch -Patch8: tar-1.22-fortifysourcessigabrt.patch +Patch4: tar-1.17-wildcards.patch +Patch5: tar-1.22-atime-rofs.patch +Patch6: tar-1.22-shortreadbuffer.patch +Patch7: tar-1.22-fortifysourcessigabrt.patch +Patch8: tar-1.22-xheaderleak.patch Prereq: info BuildRequires: autoconf automake gzip texinfo gettext libacl-devel libselinux-devel gawk rsh Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -40,11 +40,11 @@ the rmt package. %patch1 -p1 -b .loneZeroWarning %patch2 -p1 -b .vfatTruncate %patch3 -p1 -b .xattrs -%patch4 -p1 -b .store-lnk-selinux -%patch5 -p1 -b .wildcards -%patch6 -p1 -b .rofs -%patch7 -p1 -b .shortread -%patch8 -p1 -b .headerblackmagic +%patch4 -p1 -b .wildcards +%patch5 -p1 -b .rofs +%patch6 -p1 -b .shortread +%patch7 -p1 -b .headerblackmagic +%patch8 -p1 -b .xheaderleak %build autoreconf @@ -102,6 +102,11 @@ fi %{_infodir}/tar.info* %changelog +* Fri Nov 27 2009 Ondrej Vasik 2:1.22-10 +- store xattrs for symlinks (#525992) - by Kamil Dudka +- update tar(1) manpage (#539787) +- fix memory leak in xheader (#518079) + * Wed Nov 18 2009 Kamil Dudka 2:1.22-9 - store SELinux context for symlinks (#525992)