]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Basic implementation of --numeric-owner.
authorTim Kientzle <kientzle@gmail.com>
Sun, 4 May 2008 20:12:56 +0000 (16:12 -0400)
committerTim Kientzle <kientzle@gmail.com>
Sun, 4 May 2008 20:12:56 +0000 (16:12 -0400)
Submitted by: Jaakko Heinonen

SVN-Revision: 22

tar/bsdtar.1
tar/bsdtar.c
tar/bsdtar.h
tar/read.c

index ca7117593099c5b664764c8805512b84bf5dc2e6..ed8df3481a5907fe18dee0fc1633a7acec9c6421 100644 (file)
@@ -274,6 +274,10 @@ This is often used to read filenames output by the
 .Fl print0
 option to
 .Xr find 1 .
+.It Fl -numeric-owner
+(x mode only)
+Ignore symbolic user and group names when restoring archives to disk,
+only numeric uid and gid values will be obeyed.
 .It Fl O
 (x, t modes only)
 In extract (-x) mode, files will be written to standard out rather than
index b10c428a2ac2ba13e8e5b552535a7f9d7868f446..43881cf3f393242b957caaea6470be635d4093df 100644 (file)
@@ -150,6 +150,7 @@ enum {
        OPTION_NO_SAME_OWNER,
        OPTION_NO_SAME_PERMISSIONS,
        OPTION_NULL,
+       OPTION_NUMERIC_OWNER,
        OPTION_ONE_FILE_SYSTEM,
        OPTION_POSIX,
        OPTION_STRIP_COMPONENTS,
@@ -205,6 +206,7 @@ static const struct option tar_longopts[] = {
        { "no-same-owner",      no_argument,       NULL, OPTION_NO_SAME_OWNER },
        { "no-same-permissions",no_argument,       NULL, OPTION_NO_SAME_PERMISSIONS },
        { "null",               no_argument,       NULL, OPTION_NULL },
+       { "numeric-owner",      no_argument,       NULL, OPTION_NUMERIC_OWNER },
        { "one-file-system",    no_argument,       NULL, OPTION_ONE_FILE_SYSTEM },
        { "posix",              no_argument,       NULL, OPTION_POSIX },
        { "preserve-permissions", no_argument,     NULL, 'p' },
@@ -455,6 +457,9 @@ main(int argc, char **argv)
                case OPTION_NULL: /* GNU tar */
                        bsdtar->option_null++;
                        break;
+               case OPTION_NUMERIC_OWNER: /* GNU tar */
+                       bsdtar->option_numeric_owner++;
+                       break;
                case 'O': /* GNU tar */
                        bsdtar->option_stdout = 1;
                        break;
index 167b55235e907f32ccd3f873fb34f1cff121d6ba..726e29eb90ff623a5dd3e4ef812b16abbf124a61 100644 (file)
@@ -65,6 +65,7 @@ struct bsdtar {
        char              option_no_owner; /* -o */
        char              option_no_subdirs; /* -n */
        char              option_null; /* --null */
+       char              option_numeric_owner; /* --numeric-owner */
        char              option_stdout; /* -O */
        char              option_totals; /* --totals */
        char              option_unlink_first; /* -U */
index 279a10549d7afab0be126c2744ea88b3945d3418..0795c79411665276c71fe52f2a4bed9accc4e729 100644 (file)
@@ -150,6 +150,11 @@ read_archive(struct bsdtar *bsdtar, char mode)
                if (r == ARCHIVE_FATAL)
                        break;
 
+               if (bsdtar->option_numeric_owner) {
+                       archive_entry_set_uname(entry, NULL);
+                       archive_entry_set_gname(entry, NULL);
+               }
+
                /*
                 * Exclude entries that are too old.
                 */