diff options
Diffstat (limited to 'usr.bin/tar')
-rw-r--r-- | usr.bin/tar/Makefile | 2 | ||||
-rw-r--r-- | usr.bin/tar/bsdtar.c | 107 | ||||
-rw-r--r-- | usr.bin/tar/bsdtar.h | 1 | ||||
-rw-r--r-- | usr.bin/tar/bsdtar_platform.h | 64 | ||||
-rw-r--r-- | usr.bin/tar/config_freebsd.h | 105 | ||||
-rw-r--r-- | usr.bin/tar/getdate.y | 1 | ||||
-rw-r--r-- | usr.bin/tar/matching.c | 6 | ||||
-rw-r--r-- | usr.bin/tar/read.c | 161 | ||||
-rwxr-xr-x | usr.bin/tar/test/config.sh | 61 | ||||
-rwxr-xr-x | usr.bin/tar/test/test-acl.sh | 76 | ||||
-rwxr-xr-x | usr.bin/tar/test/test-basic.sh | 411 | ||||
-rwxr-xr-x | usr.bin/tar/test/test-deep-dir.sh | 60 | ||||
-rwxr-xr-x | usr.bin/tar/test/test-flags.sh | 74 | ||||
-rwxr-xr-x | usr.bin/tar/test/test-nodump.sh | 52 | ||||
-rwxr-xr-x | usr.bin/tar/test/test-overwrite.sh | 51 | ||||
-rwxr-xr-x | usr.bin/tar/test/test-utf8.sh | 40 | ||||
-rw-r--r-- | usr.bin/tar/tree.c | 14 | ||||
-rw-r--r-- | usr.bin/tar/util.c | 34 | ||||
-rw-r--r-- | usr.bin/tar/write.c | 47 |
19 files changed, 1139 insertions, 228 deletions
diff --git a/usr.bin/tar/Makefile b/usr.bin/tar/Makefile index 77ace02..a829eea 100644 --- a/usr.bin/tar/Makefile +++ b/usr.bin/tar/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= bsdtar -VERSION= 1.2.53 +VERSION= 2.0.23 SRCS= bsdtar.c getdate.y matching.c read.c tree.c util.c write.c WARNS?= 5 DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ} diff --git a/usr.bin/tar/bsdtar.c b/usr.bin/tar/bsdtar.c index b9d5547..01fab02 100644 --- a/usr.bin/tar/bsdtar.c +++ b/usr.bin/tar/bsdtar.c @@ -26,10 +26,18 @@ #include "bsdtar_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> +#endif +#ifdef HAVE_SYS_STAT_H #include <sys/stat.h> +#endif +#ifdef HAVE_ERRNO_H #include <errno.h> +#endif +#ifdef HAVE_FCNTL_H #include <fcntl.h> +#endif #ifdef HAVE_GETOPT_LONG #include <getopt.h> #else @@ -45,21 +53,35 @@ struct option { #ifdef HAVE_LANGINFO_H #include <langinfo.h> #endif +#ifdef HAVE_LOCALE_H #include <locale.h> +#endif #ifdef HAVE_PATHS_H #include <paths.h> #endif #include <stdio.h> +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_TIME_H #include <time.h> +#endif +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #if HAVE_ZLIB_H #include <zlib.h> #endif #include "bsdtar.h" +/* + * Per POSIX.1-1988, tar defaults to reading/writing archives to/from + * the default tape device for the system. Pick something reasonable here. + */ #ifdef __linux #define _PATH_DEFTAPE "/dev/st0" #endif @@ -117,6 +139,7 @@ enum { OPTION_NEWER_MTIME, OPTION_NEWER_MTIME_THAN, OPTION_NODUMP, + OPTION_NO_SAME_OWNER, OPTION_NO_SAME_PERMISSIONS, OPTION_NULL, OPTION_ONE_FILE_SYSTEM, @@ -166,7 +189,7 @@ static const struct option tar_longopts[] = { { "nodump", no_argument, NULL, OPTION_NODUMP }, { "norecurse", no_argument, NULL, 'n' }, { "no-recursion", no_argument, NULL, 'n' }, - { "no-same-owner", no_argument, NULL, 'o' }, + { "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 }, { "one-file-system", no_argument, NULL, OPTION_ONE_FILE_SYSTEM }, @@ -184,6 +207,11 @@ static const struct option tar_longopts[] = { { NULL, 0, NULL, 0 } }; +/* A basic set of security flags to request from libarchive. */ +#define SECURITY \ + (ARCHIVE_EXTRACT_SECURE_SYMLINKS \ + | ARCHIVE_EXTRACT_SECURE_NODOTDOT) + int main(int argc, char **argv) { @@ -232,9 +260,19 @@ main(int argc, char **argv) /* Default: preserve mod time on extract */ bsdtar->extract_flags = ARCHIVE_EXTRACT_TIME; - /* Default for root user: preserve ownership on extract. */ - if (bsdtar->user_uid == 0) + /* Default: Perform basic security checks. */ + bsdtar->extract_flags |= SECURITY; + + /* Defaults for root user: */ + if (bsdtar->user_uid == 0) { + /* --same-owner */ bsdtar->extract_flags |= ARCHIVE_EXTRACT_OWNER; + /* -p */ + bsdtar->extract_flags |= ARCHIVE_EXTRACT_PERM; + bsdtar->extract_flags |= ARCHIVE_EXTRACT_ACL; + bsdtar->extract_flags |= ARCHIVE_EXTRACT_XATTR; + bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS; + } /* Rewrite traditional-style tar arguments, if used. */ argv = rewrite_argv(bsdtar, &argc, argv, tar_opts); @@ -243,6 +281,12 @@ main(int argc, char **argv) bsdtar->argc = argc; /* Process all remaining arguments now. */ + /* + * Comments following each option indicate where that option + * originated: SUSv2, POSIX, GNU tar, star, etc. If there's + * no such comment, then I don't know of anyone else who + * implements that option. + */ while ((opt = bsdtar_getopt(bsdtar, tar_opts, &option)) != -1) { switch (opt) { case 'B': /* GNU tar */ @@ -269,7 +313,7 @@ main(int argc, char **argv) bsdtar_errc(bsdtar, 1, 0, "Couldn't exclude %s\n", optarg); break; - case OPTION_FORMAT: + case OPTION_FORMAT: /* GNU tar, others */ bsdtar->create_format = optarg; break; case 'f': /* SUSv2 */ @@ -288,14 +332,29 @@ main(int argc, char **argv) /* Hack: -h by itself is the "help" command. */ possible_help_request = 1; break; - case OPTION_HELP: + case OPTION_HELP: /* GNU tar, others */ long_help(bsdtar); exit(0); break; case 'I': /* GNU tar */ + /* + * TODO: Allow 'names' to come from an archive, + * not just a text file. Design a good UI for + * allowing names and mode/owner to be read + * from an archive, with contents coming from + * disk. This can be used to "refresh" an + * archive or to design archives with special + * permissions without having to create those + * permissions on disk. + */ bsdtar->names_from_file = optarg; break; case OPTION_INCLUDE: + /* + * Noone else has the @archive extension, so + * noone else needs this to filter entries + * when transforming archives. + */ if (include(bsdtar, optarg)) bsdtar_errc(bsdtar, 1, 0, "Failed to add %s to inclusion list", @@ -339,6 +398,13 @@ main(int argc, char **argv) case 'n': /* GNU tar */ bsdtar->option_no_subdirs = 1; break; + /* + * Selecting files by time: + * --newer-?time='date' Only files newer than 'date' + * --newer-?time-than='file' Only files newer than time + * on specified file (useful for incremental backups) + * TODO: Add corresponding "older" options to reverse these. + */ case OPTION_NEWER_CTIME: /* GNU tar */ bsdtar->newer_ctime_sec = get_date(optarg); break; @@ -370,13 +436,14 @@ main(int argc, char **argv) case OPTION_NODUMP: /* star */ bsdtar->option_honor_nodump = 1; break; + case OPTION_NO_SAME_OWNER: /* GNU tar */ + bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_OWNER; + break; case OPTION_NO_SAME_PERMISSIONS: /* GNU tar */ - /* - * This is always the default in FreeBSD's - * version of GNU tar; it's also the default - * behavior for bsdtar, so treat the - * command-line option as a no-op. - */ + bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_PERM; + bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_ACL; + bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_XATTR; + bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_FFLAGS; break; case OPTION_NULL: /* GNU tar */ bsdtar->option_null++; @@ -384,10 +451,10 @@ main(int argc, char **argv) case 'O': /* GNU tar */ bsdtar->option_stdout = 1; break; - case 'o': /* SUSv2 and GNU conflict here */ + case 'o': /* SUSv2 and GNU conflict here, but not fatally */ option_o = 1; /* Record it and resolve it later. */ break; - case OPTION_ONE_FILE_SYSTEM: /* -l in GNU tar */ + case OPTION_ONE_FILE_SYSTEM: /* GNU tar */ bsdtar->option_dont_traverse_mounts = 1; break; #if 0 @@ -402,6 +469,7 @@ main(int argc, char **argv) break; #endif case 'P': /* GNU tar */ + bsdtar->extract_flags &= ~SECURITY; bsdtar->option_absolute_paths = 1; break; case 'p': /* GNU tar, star */ @@ -436,9 +504,17 @@ main(int argc, char **argv) case 'v': /* SUSv2 */ bsdtar->verbose++; break; - case OPTION_VERSION: + case OPTION_VERSION: /* GNU convention */ version(); break; +#if 0 + /* + * The -W longopt feature is handled inside of + * bsdtar_getop(), so -W is not available here. + */ + case 'W': /* Obscure, but useful GNU convention. */ + break; +#endif case 'w': /* SUSv2 */ bsdtar->option_interactive = 1; break; @@ -490,11 +566,14 @@ main(int argc, char **argv) /* * Sanity-check options. */ + + /* If no "real" mode was specified, treat -h as --help. */ if ((bsdtar->mode == '\0') && possible_help_request) { long_help(bsdtar); exit(0); } + /* Otherwise, a mode is required. */ if (bsdtar->mode == '\0') bsdtar_errc(bsdtar, 1, 0, "Must specify one of -c, -r, -t, -u, -x"); diff --git a/usr.bin/tar/bsdtar.h b/usr.bin/tar/bsdtar.h index 5962ea9..6b51080 100644 --- a/usr.bin/tar/bsdtar.h +++ b/usr.bin/tar/bsdtar.h @@ -108,6 +108,7 @@ int exclude_from_file(struct bsdtar *, const char *pathname); int excluded(struct bsdtar *, const char *pathname); int include(struct bsdtar *, const char *pattern); int include_from_file(struct bsdtar *, const char *pathname); +int pathcmp(const char *a, const char *b); int process_lines(struct bsdtar *bsdtar, const char *pathname, int (*process)(struct bsdtar *, const char *)); void safe_fprintf(FILE *, const char *fmt, ...); diff --git a/usr.bin/tar/bsdtar_platform.h b/usr.bin/tar/bsdtar_platform.h index 2ad1750..5ec96f3 100644 --- a/usr.bin/tar/bsdtar_platform.h +++ b/usr.bin/tar/bsdtar_platform.h @@ -39,65 +39,7 @@ #else #ifdef __FreeBSD__ -#include <sys/param.h> /* __FreeBSD_version */ -/* A default configuration for FreeBSD, used if there is no config.h. */ -#define PACKAGE_NAME "bsdtar" - -#if __FreeBSD__ > 4 -#define HAVE_ACL_GET_PERM 0 -#define HAVE_ACL_GET_PERM_NP 1 -#define HAVE_ACL_PERMSET_T 1 -#define HAVE_ACL_USER 1 -#endif -#define HAVE_BZLIB_H 1 -#define HAVE_CHFLAGS 1 -#define HAVE_DIRENT_D_NAMLEN 1 -#define HAVE_DIRENT_H 1 -#define HAVE_D_MD_ORDER 1 -#define HAVE_FCHDIR 1 -#define HAVE_FCNTL_H 1 -#define HAVE_FNMATCH 1 -#define HAVE_FNM_LEADING_DIR 1 -#define HAVE_FTRUNCATE 1 -#define HAVE_GETOPT_LONG 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LANGINFO_H 1 -#define HAVE_LIBARCHIVE 1 -#define HAVE_LIBBZ2 1 -#define HAVE_LIBZ 1 -#define HAVE_LIMITS_H 1 -#define HAVE_LOCALE_H 1 -#define HAVE_MALLOC 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMORY_H 1 -#define HAVE_MEMSET 1 -#if __FreeBSD_version >= 450002 /* nl_langinfo introduced */ -#define HAVE_NL_LANGINFO 1 -#endif -#define HAVE_PATHS_H 1 -#define HAVE_SETLOCALE 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRCHR 1 -#define HAVE_STRDUP 1 -#define HAVE_STRERROR 1 -#define HAVE_STRFTIME 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 -#define HAVE_STRUCT_STAT_ST_RDEV 1 -#define HAVE_SYS_ACL_H 1 -#define HAVE_SYS_IOCTL_H 1 -#define HAVE_SYS_PARAM_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_UINTMAX_T 1 -#define HAVE_UNISTD_H 1 -#define HAVE_VPRINTF 1 -#define HAVE_ZLIB_H 1 -#define STDC_HEADERS 1 - +#include "config_freebsd.h" #else /* !__FreeBSD__ */ /* Warn if bsdtar hasn't been (automatically or manually) configured. */ #error Oops: No config.h and no built-in configuration in bsdtar_platform.h. @@ -138,10 +80,10 @@ #endif #if HAVE_ACL_GET_PERM -#define ACL_GET_PERM acl_get_perm +#define ACL_GET_PERM acl_get_perm #else #if HAVE_ACL_GET_PERM_NP -#define ACL_GET_PERM acl_get_perm_np +#define ACL_GET_PERM acl_get_perm_np #endif #endif diff --git a/usr.bin/tar/config_freebsd.h b/usr.bin/tar/config_freebsd.h new file mode 100644 index 0000000..164ce52 --- /dev/null +++ b/usr.bin/tar/config_freebsd.h @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* A default configuration for FreeBSD, used if there is no config.h. */ + +#include <sys/param.h> /* __FreeBSD_version */ +#define PACKAGE_NAME "bsdtar" + +#if __FreeBSD__ > 4 +#define HAVE_ACL_GET_PERM 0 +#define HAVE_ACL_GET_PERM_NP 1 +#define HAVE_ACL_PERMSET_T 1 +#define HAVE_ACL_USER 1 +#endif +#undef HAVE_ATTR_XATTR_H +#define HAVE_BZLIB_H 1 +#define HAVE_CHFLAGS 1 +#define HAVE_DIRENT_D_NAMLEN 1 +#define HAVE_DIRENT_H 1 +#define HAVE_D_MD_ORDER 1 +#define HAVE_ERRNO_H 1 +#undef HAVE_EXT2FS_EXT2_FS_H +#define HAVE_FCHDIR 1 +#define HAVE_FCNTL_H 1 +#define HAVE_FNMATCH 1 +#define HAVE_FNMATCH_H 1 +#define HAVE_FNM_LEADING_DIR 1 +#define HAVE_FTRUNCATE 1 +#define HAVE_GETOPT_LONG 1 +#undef HAVE_GETXATTR +#define HAVE_GRP_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LANGINFO_H 1 +#undef HAVE_LGETXATTR +#undef HAVE_LIBACL +#define HAVE_LIBARCHIVE 1 +#define HAVE_LIBBZ2 1 +#define HAVE_LIBZ 1 +#define HAVE_LIMITS_H 1 +#undef HAVE_LINUX_EXT2_FS_H +#undef HAVE_LINUX_FS_H +#undef HAVE_LISTXATTR +#undef HAVE_LLISTXATTR +#define HAVE_LOCALE_H 1 +#define HAVE_MALLOC 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMORY_H 1 +#define HAVE_MEMSET 1 +#if __FreeBSD_version >= 450002 /* nl_langinfo introduced */ +#define HAVE_NL_LANGINFO 1 +#endif +#define HAVE_PATHS_H 1 +#define HAVE_PWD_H 1 +#define HAVE_SETLOCALE 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRCHR 1 +#define HAVE_STRDUP 1 +#define HAVE_STRERROR 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRRCHR 1 +#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC +#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 +#define HAVE_STRUCT_STAT_ST_RDEV 1 +#define HAVE_SYS_ACL_H 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UINTMAX_T 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNSIGNED_LONG_LONG +#define HAVE_VPRINTF 1 +#define HAVE_ZLIB_H 1 +#undef MAJOR_IN_MKDEV +#define STDC_HEADERS 1 + diff --git a/usr.bin/tar/getdate.y b/usr.bin/tar/getdate.y index c18e2d3..641afb0 100644 --- a/usr.bin/tar/getdate.y +++ b/usr.bin/tar/getdate.y @@ -8,6 +8,7 @@ * (eliminate some state variables and post-processing). Among other * things, these changes eliminated two shift/reduce conflicts. (Went * from 10 to 8.) + * All of Tim Kientzle's changes to this file are public domain. */ /* diff --git a/usr.bin/tar/matching.c b/usr.bin/tar/matching.c index 3997b54..c3ff802 100644 --- a/usr.bin/tar/matching.c +++ b/usr.bin/tar/matching.c @@ -26,9 +26,15 @@ #include "bsdtar_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_ERRNO_H #include <errno.h> +#endif +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif #include "bsdtar.h" diff --git a/usr.bin/tar/read.c b/usr.bin/tar/read.c index 661d2c2..1fec9ea 100644 --- a/usr.bin/tar/read.c +++ b/usr.bin/tar/read.c @@ -26,30 +26,50 @@ #include "bsdtar_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif #ifdef MAJOR_IN_MKDEV #include <sys/mkdev.h> #endif +#ifdef HAVE_SYS_PARAM_H #include <sys/param.h> +#endif +#ifdef HAVE_SYS_STAT_H #include <sys/stat.h> -#include <sys/types.h> +#endif +#ifdef HAVE_ERRNO_H #include <errno.h> +#endif +#ifdef HAVE_GRP_H #include <grp.h> +#endif +#ifdef HAVE_LIMITS_H #include <limits.h> +#endif +#ifdef HAVE_PWD_H #include <pwd.h> +#endif #include <stdio.h> +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_TIME_H #include <time.h> +#endif +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include "bsdtar.h" -static void cleanup_security(struct bsdtar *); static void list_item_verbose(struct bsdtar *, FILE *, struct archive_entry *); static void read_archive(struct bsdtar *bsdtar, char mode); -static int security_problem(struct bsdtar *, struct archive_entry *); void tar_mode_t(struct bsdtar *bsdtar) @@ -190,15 +210,6 @@ read_archive(struct bsdtar *bsdtar, char mode) } fprintf(out, "\n"); } else { - /* - * Skip security problems before prompting. - * Otherwise, the user may be confused that a - * file they wanted to extract was - * subsequently skipped. - */ - if (security_problem(bsdtar, entry)) - continue; - if (bsdtar->option_interactive && !yes("extract '%s'", archive_entry_pathname(entry))) continue; @@ -240,7 +251,6 @@ read_archive(struct bsdtar *bsdtar, char mode) archive_format_name(a), archive_compression_name(a)); archive_read_finish(a); - cleanup_security(bsdtar); } @@ -342,128 +352,3 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry) else if (S_ISLNK(st->st_mode)) /* Symbolic link */ safe_fprintf(out, " -> %s", archive_entry_symlink(entry)); } - -/* - * Structure for storing path of last successful security check. - */ -struct security { - char *path; - size_t path_size; -}; - -/* - * Check for a variety of security issues. Fix what we can here, - * generate warnings as appropriate, return non-zero to prevent - * this entry from being extracted. - */ -static int -security_problem(struct bsdtar *bsdtar, struct archive_entry *entry) -{ - struct stat st; - const char *name, *pn; - char *p; - int r; - - /* -P option forces us to just accept all pathnames as-is. */ - if (bsdtar->option_absolute_paths) - return (0); - - name = archive_entry_pathname(entry); - - /* Reject any archive entry with '..' as a path element. */ - pn = name; - while (pn != NULL && pn[0] != '\0') { - if (pn[0] == '.' && pn[1] == '.' && - (pn[2] == '\0' || pn[2] == '/')) { - bsdtar_warnc(bsdtar, 0, - "Skipping pathname containing .."); - bsdtar->return_value = 1; - return (1); - } - pn = strchr(pn, '/'); - if (pn != NULL) - pn++; - } - - /* - * Gaurd against symlink tricks. Reject any archive entry whose - * destination would be altered by a symlink. - */ - /* XXX TODO: Make this faster by comparing current path to - * prefix of last successful check to avoid duplicate lstat() - * calls. XXX */ - pn = name; - if (bsdtar->security == NULL) { - bsdtar->security = malloc(sizeof(*bsdtar->security)); - if (bsdtar->security == NULL) - bsdtar_errc(bsdtar, 1, errno, "No Memory"); - bsdtar->security->path_size = MAXPATHLEN + 1; - bsdtar->security->path = malloc(bsdtar->security->path_size); - if (bsdtar->security->path == NULL) - bsdtar_errc(bsdtar, 1, errno, "No Memory"); - } - if (strlen(name) >= bsdtar->security->path_size) { - free(bsdtar->security->path); - while (strlen(name) >= bsdtar->security->path_size) - bsdtar->security->path_size *= 2; - bsdtar->security->path = malloc(bsdtar->security->path_size); - if (bsdtar->security->path == NULL) - bsdtar_errc(bsdtar, 1, errno, "No Memory"); - } - p = bsdtar->security->path; - while (pn != NULL && pn[0] != '\0') { - *p++ = *pn++; - while (*pn != '\0' && *pn != '/') - *p++ = *pn++; - p[0] = '\0'; - r = lstat(bsdtar->security->path, &st); - if (r != 0) { - if (errno == ENOENT) - break; - } else if (S_ISLNK(st.st_mode)) { - if (pn[0] == '\0') { - /* - * Last element is symlink; remove it - * so we can overwrite it with the - * item being extracted. - */ - if (!S_ISLNK(archive_entry_mode(entry))) { - /* - * Warn only if the symlink is being - * replaced with a non-symlink. - */ - bsdtar_warnc(bsdtar, 0, - "Removing symlink %s", - bsdtar->security->path); - } - if (unlink(bsdtar->security->path)) - bsdtar_errc(bsdtar, 1, errno, - "Unlink failed"); - /* Symlink gone. No more problem! */ - return (0); - } else if (bsdtar->option_unlink_first) { - /* User asked us to remove problems. */ - if (unlink(bsdtar->security->path)) - bsdtar_errc(bsdtar, 1, errno, - "Unlink failed"); - } else { - bsdtar_warnc(bsdtar, 0, - "Cannot extract %s through symlink %s", - name, bsdtar->security->path); - bsdtar->return_value = 1; - return (1); - } - } - } - - return (0); -} - -static void -cleanup_security(struct bsdtar *bsdtar) -{ - if (bsdtar->security != NULL) { - free(bsdtar->security->path); - free(bsdtar->security); - } -} diff --git a/usr.bin/tar/test/config.sh b/usr.bin/tar/test/config.sh new file mode 100755 index 0000000..ba87c9b --- /dev/null +++ b/usr.bin/tar/test/config.sh @@ -0,0 +1,61 @@ +# +# Copyright (c) 2007 Tim Kientzle +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +THISDIR=`cd \`dirname $0\`;/bin/pwd` + +# TESTDIR defaults to /tmp/bsdtar- + the name of the script +if [ -z "$TESTDIR" ]; then + TESTDIR=/tmp/bsdtar-`echo $0 | sed -e 's|.*/||' -e 's|\.sh||' -e 's/[^a-z0-9_-]/_/g'` +fi +# Use bsdtar we just built by default +if [ -z "$BSDTAR" ]; then + BSDTAR=$THISDIR/../../bsdtar +fi +# Try 'gtar', then 'tar', then '/usr/local/bin/gtar' to find GNU tar +if [ -z "$GTAR" ]; then + if ( /bin/sh -c 'gtar --version' | grep 'GNU tar' ) > /dev/null 2>&1; then + GTAR=gtar + fi +fi +if [ -z "$GTAR" ]; then + if ( /bin/sh -c 'tar --version' | grep 'GNU tar' ) > /dev/null 2>&1; then + GTAR=tar + fi +fi +if [ -z "$GTAR" ]; then + if ( /bin/sh -c '/usr/local/bin/gtar --version' | grep 'GNU tar' ) > /dev/null 2>&1; then + GTAR=/usr/local/bin/gtar + fi +fi +if [ -z "$CPIO" ]; then + CPIO=cpio +fi + +# Remove and recreate the directory we'll use for these tests +rm -rf $TESTDIR +mkdir -p $TESTDIR || exit 1 +cd $TESTDIR || exit 1 + diff --git a/usr.bin/tar/test/test-acl.sh b/usr.bin/tar/test/test-acl.sh new file mode 100755 index 0000000..0d0bbeb --- /dev/null +++ b/usr.bin/tar/test/test-acl.sh @@ -0,0 +1,76 @@ +#!/bin/sh +# Copyright (c) 2007 Tim Kientzle +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +# Exercise copying of ACLs +echo "ACL handling" +# Basic test configuration +TESTDIR=/mnt/da0/acl-test +. `dirname $0`/config.sh + +# Create some files with ACLs +mkdir original +cd original +touch a +chmod 664 a +setfacl -m user:bin:rw- -m group:78:r-x a \ + || echo XXX failed to set access ACL on a XXX +mkdir d +chmod 775 d +setfacl -m user:daemon:rw- -m group:78:r-x d \ + || echo XXX failed to set access ACL on d XXX +setfacl -d -m user::rw- -m group::rw- -m other::rw- -m group:79:r-- d \ + || echo XXX failed to set default ACL on d XXX +cd .. + +# Copy the dir with -p +echo " -p preserves ACLs" +mkdir copy +(cd original && ${BSDTAR} -cf - .) | (cd copy; ${BSDTAR} -xpf -) + +# Verify the ACLs +cd copy +if [ "user::rw- user:bin:rw- group::rw- group:78:r-x mask::rwx other::r--" \ + = "`echo \`getfacl -q a\``" ]; then + # It matches!! +else + echo XXX a has wrong ACL XXX `getfacl -q a` +fi + +if [ "user::rwx user:daemon:rw- group::rwx group:78:r-x mask::rwx other::r-x" \ + = "`echo \`getfacl -q d\``" ]; then + # It matches!! +else + echo XXX d has wrong ACL XXX `getfacl -q d` +fi + + +if [ "user::rw- group::rw- group:79:r-- mask::rw- other::rw-" \ + = "`echo \`getfacl -q -d d\``" ]; then + # It matches!! +else + echo XXX d has wrong ACL XXX `getfacl -q -d d` +fi + diff --git a/usr.bin/tar/test/test-basic.sh b/usr.bin/tar/test/test-basic.sh new file mode 100755 index 0000000..6e7555d --- /dev/null +++ b/usr.bin/tar/test/test-basic.sh @@ -0,0 +1,411 @@ +#!/bin/sh +# Copyright (c) 2007 Tim Kientzle +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +# Generate a dir tree with various data and copy it using +# a variety of tools and flags. This mostly checks that +# we can read archives we write and those written by gtar +# and cpio. + +echo "Basic archiving/copy tests" +# Basic configuration +. `dirname $0`/config.sh + +# We need some files to archive; generate some random files and files +# with very long names and other special attributes +mkdir -p original +cd original +# Create some long files with random text data +for f in f0 f1 f2 f3 f4 f5 f6 f7 f8 f9; do + dd if=/dev/urandom bs=1k count=100 2>/dev/null | od > $f +done +# A sparse file +dd if=/dev/zero of=sparse bs=1 count=1 oseek=100000 2>/dev/null +# Files with long names +touch a +touch ab +touch abc +touch abcd +touch abcde +touch abcdef +touch abcdefg +touch abcdefgh +touch abcdefghi +touch abcdefghij +touch abcdefghijk +touch abcdefghijkl +touch abcdefghijklm +touch abcdefghijklmn +touch abcdefghijklmno +touch abcdefghijklmnop +touch abcdefghijklmnopq +touch abcdefghijklmnopqr +touch abcdefghijklmnopqrs +touch abcdefghijklmnopqrst +touch abcdefghijklmnopqrstu +touch abcdefghijklmnopqrstuv +touch abcdefghijklmnopqrstuvw +touch abcdefghijklmnopqrstuvwx +touch abcdefghijklmnopqrstuvwxy +touch abcdefghijklmnopqrstuvwxyz + +touch abcdefghijklmnopqrstuvwxyza +touch abcdefghijklmnopqrstuvwxyzab +touch abcdefghijklmnopqrstuvwxyzabc +touch abcdefghijklmnopqrstuvwxyzabcd +touch abcdefghijklmnopqrstuvwxyzabcde +touch abcdefghijklmnopqrstuvwxyzabcdef +touch abcdefghijklmnopqrstuvwxyzabcdefg +touch abcdefghijklmnopqrstuvwxyzabcdefgh +touch abcdefghijklmnopqrstuvwxyzabcdefghi +touch abcdefghijklmnopqrstuvwxyzabcdefghij +touch abcdefghijklmnopqrstuvwxyzabcdefghijk +touch abcdefghijklmnopqrstuvwxyzabcdefghijkl +touch abcdefghijklmnopqrstuvwxyzabcdefghijklm +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmn +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmno +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnop +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopq +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcde +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefg +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghi +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmno +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopq +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvw +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxy +touch abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz + +# A file with a long pathname +mkdir -p 1abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz +cd .. + +# Basic test of archiving/dearchiving +echo " tar -c | tar -x" +mkdir copy-default +(cd original && ${BSDTAR} -cf - .) | (cd copy-default; ${BSDTAR} -xf -) +diff -r original copy-default || echo XXX FAILED XXX + +# Exercise gzip compression (test compressed output with gunzip -t +echo " tar -cz | gunzip -t" +(cd original && ${BSDTAR} -czf - .) | gunzip -tq + +# Ensure our compression works with gunzip program +echo " tar -cz | gunzip | tar -x" +mkdir copy-gzip2 +(cd original && ${BSDTAR} -czf - .) | gunzip -q | (cd copy-gzip2; ${BSDTAR} -xf -) +diff -r original copy-gzip2 || echo XXX FAILED XXX + +# Ensure our decompression works with gzip program +echo " tar -c | gzip | tar -x" +mkdir copy-gunzip +(cd original && ${BSDTAR} -cf - .) | gzip | (cd copy-gunzip; ${BSDTAR} -xf -) +diff -r original copy-gunzip || echo XXX FAILED XXX + +# Ensure our gzip compression/decompression work with each other +echo " tar -cz | tar -x" +mkdir copy-gzip-gunzip +(cd original && ${BSDTAR} -czf - .) | (cd copy-gzip-gunzip; ${BSDTAR} -xf -) +diff -r original copy-gzip-gunzip || echo XXX FAILED XXX + +# Ensure our decompression works with bzip2 program +echo " tar -c | bzip2 | tar -x" +mkdir copy-bunzip +(cd original && ${BSDTAR} -cf - .) | bzip2 | (cd copy-bunzip; ${BSDTAR} -xf -) +diff -r original copy-bunzip || echo XXX FAILED XXX + +# Ensure our compression works with bunzip2 program +echo " tar -cy | bunzip2 | tar -x" +mkdir copy-bzip2 +(cd original && ${BSDTAR} -cyf - .) | bunzip2 -q | (cd copy-bzip2; ${BSDTAR} -xf -) +diff -r original copy-bzip2 || echo XXX FAILED XXX + +# Ensure our bzip2 compression/decompression work with each other +echo " tar -cy | tar -x" +mkdir copy-bzip2-bunzip2 +(cd original && ${BSDTAR} -cyf - .) | (cd copy-bzip2-bunzip2; ${BSDTAR} -xf -) +diff -r original copy-bzip2-bunzip2 || echo XXX FAILED XXX + +# Filtering exercises different areas of the library. +echo " Basic filter test: 'tar->tar'" +mkdir filter-tar-tar +(cd original && ${BSDTAR} -cf - .) | ${BSDTAR} -cf - @- | (cd filter-tar-tar; ${BSDTAR} -xf -) +diff -r original filter-tar-tar || echo XXX FAILED XXX + +# Filtering as format conversion +echo " Basic filter test: 'tar->cpio'" +mkdir filter-tar-cpio +(cd original && ${BSDTAR} -cf - .) | ${BSDTAR} -cf - --format=cpio @- | (cd filter-tar-cpio; ${BSDTAR} -xf -) +diff -r original filter-tar-cpio || echo XXX FAILED XXX + +# Test basic --include selection logic +echo " Filter selection" +mkdir filter-tar-selected +(cd original && ${BSDTAR} -cf - .) | ${BSDTAR} -cf - --format=cpio --include=./f3 @- | (cd filter-tar-selected; ${BSDTAR} -xf -) +diff -r original/f3 filter-tar-selected/f3 || echo XXX FAILED XXX +# Should be no files in copy except for 'f3' +(cd filter-tar-selected ; ls | grep -v f3 | grep .) && echo XXX FAILED XXX + +# Test --include with wildcards +echo " Wildcard filter selection" +mkdir filter-tar-selected2 +(cd original && ${BSDTAR} -cf - .) | ${BSDTAR} -cf - --format=cpio --include='./f*' @- | (cd filter-tar-selected2; ${BSDTAR} -xf -) +for f in f1 f2 f3 f4 f5 f6 f7 f8 f9; do + diff -r original/$f filter-tar-selected2/$f || echo XXX FAILED XXX +done +# Should be no files in copy except for 'f[0-9]' +(cd filter-tar-selected2 ; ls | grep -v 'f[0-9]' | grep .) && echo XXX FAILED XXX + +# Check read/write of basic odc cpio format +echo " tar -c --format=cpio | tar -x" +mkdir copy-cpio +(cd original && ${BSDTAR} -cf - --format cpio .) | (cd copy-cpio; ${BSDTAR} -xf -) +diff -r original copy-cpio || echo XXX FAILED XXX + +# Ensure we can read gtar archives +echo " gtar -c | tar -x" +mkdir copy-gtar +(cd original && ${GTAR} -cf - .) | (cd copy-gtar; ${BSDTAR} -xf -) +diff -r original copy-gtar || echo XXX FAILED XXX + +# Ensure we can read svr4crc cpio archives +echo " cpio -H crc | bsdtar" +mkdir copy-svr4crc +(cd original && find . | ${CPIO} -o -H crc 2>/dev/null) | (cd copy-svr4crc; ${BSDTAR} -xf -) +diff -r original copy-svr4crc || echo XXX FAILED XXX + +# Ensure we generate proper shar output +echo " bsdtar -c --format=shar | /bin/sh" +mkdir copy-shar +(cd original && ${BSDTAR} -cf - --format=shar --exclude=sparse .) | (cd copy-shar; /bin/sh >/dev/null) +diff -r --exclude=sparse original copy-shar || echo XXX FAILED XXX + +# Check that -u (update) picks up no new files +echo " -u doesn't pick up unchanged files" +(cd original && ${BSDTAR} -cf ../test-u.tar -b 1 .) +cp test-u.tar test-u1.tar +(cd original && ${BSDTAR} -uf ../test-u1.tar .) +diff test-u.tar test-u1.tar || echo XXX FAILED XXX + +# Check that -u (update) does pick up actual changed files +echo " -u does pick up changed files" +(cd original && echo hello >>f0) +cp test-u.tar test-u2.tar +(cd original && ${BSDTAR} -uf ../test-u2.tar .) +# All this really tests is that the archive did change. +cmp -s test-u.tar test-u2.tar && echo XXX FAILED XXX +# Now, unpack the archive and verify the contents (including the change to f0) +mkdir copy-u-test2 +(cd copy-u-test2 && ${BSDTAR} -xf ../test-u2.tar) +diff -r original copy-u-test2 || echo XXX FAILED XXX diff --git a/usr.bin/tar/test/test-deep-dir.sh b/usr.bin/tar/test/test-deep-dir.sh new file mode 100755 index 0000000..f16e7c4 --- /dev/null +++ b/usr.bin/tar/test/test-deep-dir.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# Copyright (c) 2007 Tim Kientzle +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +# Stress the deep directory logic; the actual depth here seems to +# be limited by the shell. This should be restructured to get around +# that limit (possibly by using perl to build the deep tree?) +echo Deep directory tests + +# Basic test configuration +. `dirname $0`/config.sh + +# Create a deep dir (shell seems to be limited by PATH_MAX) +mkdir original +cd original +I=0 +while [ $I -lt 200 ] +do + mkdir a$I + cd a$I + I=$(($I + 1)) +done +while [ $I -gt 0 ] ; do cd ..; I=$(($I - 1)); done +cd .. + +# Copy this using bsdtar +echo " tar -c | tar -x" +mkdir copy +(cd original; ${BSDTAR} -cf - .) | (cd copy; ${BSDTAR} -xf -) +diff -r original copy || echo XXX FAILURE XXX + +# Copy gtar->bsdtar +echo " gtar -c | tar -x" +mkdir copy-gtar +(cd original; ${GTAR} -cf - .) | (cd copy-gtar; ${BSDTAR} -xf -) +diff -r original copy-gtar || echo XXX FAILURE XXX +cd .. + diff --git a/usr.bin/tar/test/test-flags.sh b/usr.bin/tar/test/test-flags.sh new file mode 100755 index 0000000..3d8c322 --- /dev/null +++ b/usr.bin/tar/test/test-flags.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# Copyright (c) 2007 Tim Kientzle +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +# Exercise copying of file flags +echo "File Flag handling" +# Basic test configuration +. `dirname $0`/config.sh + +# Create some files with various flags set +mkdir original +FLAGS='uchg opaque nodump uappnd' +for f in $FLAGS; do + touch original/test.$f + chflags $f original/test.$f +done +#ls -ol ${TESTDIR}/original + +# Copy the dir with -p +echo " -p preserves flags" +mkdir copy +(cd original && ${BSDTAR} -cf - .) | (cd copy; ${BSDTAR} -xpf -) +# Verify that the flags are set +for f in $FLAGS; do + [ "$f" = `ls -ol copy/test.$f | awk '{print $5}'` ] \ + || echo XXX FAIL: $f not preserved with -p XXX +done +#ls -ol ${TESTDIR}/copy + +# Copy the dir without -p +echo " flags omitted without -p" +mkdir copy2 +(cd original && ${BSDTAR} -cf - .) | (cd copy2; ${BSDTAR} -xf -) +# Verify that the flags are not set +for f in $FLAGS; do + [ "$f" = `ls -ol copy2/test.$f | awk '{print $5}'` ] \ + && echo XXX FAIL: $f copied without -p XXX +done +#ls -ol ${TESTDIR}/copy2 + +# Strip off the flags so we can clean this directory on the next test +for f in $FLAGS; do + if [ $f = 'nodump' ]; then + chflags dump original/test.$f + chflags dump copy/test.$f + else + chflags no$f original/test.$f + chflags no$f copy/test.$f + fi +done +cd .. + diff --git a/usr.bin/tar/test/test-nodump.sh b/usr.bin/tar/test/test-nodump.sh new file mode 100755 index 0000000..131fc08 --- /dev/null +++ b/usr.bin/tar/test/test-nodump.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# Copyright (c) 2007 Tim Kientzle +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +# Test that archiving obeys the 'nodump' flag +echo "Verify 'nodump'" +# Basic test configuration +. `dirname $0`/config.sh + +# Create some sample files, 'b' is marked nodump +mkdir original +cd original +touch a +touch b +touch c +# 'chflags' on FreeBSD, 'chattr' on Linux +( chflags nodump b || chattr +d b ) >/dev/null 2>&1 || echo XXX NO chflags/chattr command XXX + +# Copy files with --nodump +cd .. +mkdir copy +(cd original && ${BSDTAR} -cf - --nodump .) | (cd copy; ${BSDTAR} -xf -) + +# Verify that 'b' wasn't copied +echo " File marked nodump wasn't copied" +if [ -e copy/b ] ; then echo XXX Copied nodump file XXX; fi +echo " File not marked nodump was copied" +if [ \! -e copy/a ] ; then echo XXX Failed to copy non-nodump file a XXX; fi +diff -r --exclude=b original copy || echo XXX FAILURE XXX +cd .. diff --git a/usr.bin/tar/test/test-overwrite.sh b/usr.bin/tar/test/test-overwrite.sh new file mode 100755 index 0000000..03bfc96 --- /dev/null +++ b/usr.bin/tar/test/test-overwrite.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# Copyright (c) 2007 Tim Kientzle +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +echo "Test overwrite avoidance" +. `dirname $0`/config.sh + +# Create a file with some data. +# This ensures that test.tar actually has some data in it +# by the time tar tries to add it to itself. +dd if=/dev/urandom of=a bs=1k count=100 >/dev/null 2>&1 + +# Now try to implicitly add archive to itself +${BSDTAR} -cf test.tar . || echo XXX FAILED XXX + +# Create another file +dd if=/dev/urandom of=b bs=1k count=100 >/dev/null 2>&1 + +# Try again. +${BSDTAR} -cf test.tar . || echo XXX FAILED XXX + +# Extract the archive and check that the two files got archived, despite the warning +mkdir compare +cd compare +${BSDTAR} -xf ../test.tar +cmp a ../a || echo XXX a didn't archive correctly XXX +cmp b ../b || echo XXX b didn't archive correctly XXX + +# TODO: Test overwrite avoidance on extract diff --git a/usr.bin/tar/test/test-utf8.sh b/usr.bin/tar/test/test-utf8.sh new file mode 100755 index 0000000..16438ea --- /dev/null +++ b/usr.bin/tar/test/test-utf8.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# Copyright (c) 2007 Tim Kientzle +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ + +echo "Test UTF8 filenames" +. `dirname $0`/config.sh + +# Create some files with names in UTF8 +export LC_ALL=en_US.UTF-8 +touch "Greek: Γειά σας" +touch "Hebrew: שלום" +touch "Russian: Здравствуйте!" +touch "Japanese: �����, コンニチハ" +touch "Chinese: ��" + +tar -cf test.tar . + +# TODO: Verify the resulting archive
\ No newline at end of file diff --git a/usr.bin/tar/tree.c b/usr.bin/tar/tree.c index 246352e..4c9a4bd 100644 --- a/usr.bin/tar/tree.c +++ b/usr.bin/tar/tree.c @@ -45,13 +45,27 @@ #include "bsdtar_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_SYS_STAT_H #include <sys/stat.h> +#endif +#ifdef HAVE_DIRENT_H #include <dirent.h> +#endif +#ifdef HAVE_ERRNO_H #include <errno.h> +#endif +#ifdef HAVE_FCNTL_H #include <fcntl.h> +#endif +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include "tree.h" diff --git a/usr.bin/tar/util.c b/usr.bin/tar/util.c index a3bbb4f..9cc19d7 100644 --- a/usr.bin/tar/util.c +++ b/usr.bin/tar/util.c @@ -26,14 +26,26 @@ #include "bsdtar_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_SYS_STAT_H #include <sys/stat.h> +#endif +#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> /* Linux doesn't define mode_t, etc. in sys/stat.h. */ +#endif #include <ctype.h> +#ifdef HAVE_ERRNO_H #include <errno.h> +#endif +#ifdef HAVE_STDARG_H #include <stdarg.h> +#endif #include <stdio.h> +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif #include "bsdtar.h" @@ -382,6 +394,8 @@ do_chdir(struct bsdtar *bsdtar) /* * Handle --strip-components and any future path-rewriting options. * Returns non-zero if the pathname should not be extracted. + * + * TODO: Support pax-style regex path rewrites. */ int edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry) @@ -406,10 +420,6 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry) } } - /* Strip redundant "./" from start of filename. */ - if (name[0] == '.' && name[1] == '/' && name[2] != '\0') - name += 2; - /* Strip redundant leading '/' characters. */ while (name[0] == '/' && name[1] == '/') name++; @@ -436,3 +446,19 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry) } return (0); } + +/* + * Like strcmp(), but try to be a little more aware of the fact that + * we're comparing two paths. + * + * TODO: Make this better, so that "./a//b/./c" == "a/b/c" + */ +int +pathcmp(const char *a, const char *b) +{ + if (a[0] == '.' && a[1] == '/' && a[2] != '\0') + a += 2; + if (b[0] == '.' && b[1] == '/' && b[2] != '\0') + b += 2; + return (strcmp(a, b)); +} diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c index 255074c..d83dcc1 100644 --- a/usr.bin/tar/write.c +++ b/usr.bin/tar/write.c @@ -26,27 +26,57 @@ #include "bsdtar_platform.h" __FBSDID("$FreeBSD$"); -#include <sys/stat.h> +#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> -#ifdef HAVE_POSIX_ACL +#endif +#ifdef HAVE_SYS_ACL_H #include <sys/acl.h> #endif +#ifdef HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#endif +#ifdef HAVE_SYS_STAT_H +#include <sys/stat.h> +#endif #ifdef HAVE_ATTR_XATTR_H #include <attr/xattr.h> #endif +#ifdef HAVE_ERRNO_H #include <errno.h> +#endif +#ifdef HAVE_EXT2FS_EXT2_FS_H +#include <ext2fs/ext2_fs.h> +#endif +#ifdef HAVE_FCNTL_H #include <fcntl.h> +#endif +#ifdef HAVE_FNMATCH_H #include <fnmatch.h> +#endif +#ifdef HAVE_GRP_H #include <grp.h> +#endif +#ifdef HAVE_LIMITS_H #include <limits.h> +#endif +#ifdef HAVE_LINUX_FS_H +#include <linux/fs.h> /* for Linux file flags */ +#endif +#ifdef HAVE_LINUX_EXT2_FS_H +#include <linux/ext2_fs.h> /* for Linux file flags */ +#endif +#ifdef HAVE_PWD_H #include <pwd.h> +#endif #include <stdio.h> +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_UNISTD_H #include <unistd.h> -#ifdef __linux -#include <ext2fs/ext2_fs.h> -#include <sys/ioctl.h> #endif #include "bsdtar.h" @@ -820,7 +850,7 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, const struct stat *st, * to inform us that the archive body won't get stored. In * that case, just skip the write. */ - if (fd >= 0 && archive_entry_size(entry) > 0) + if (e >= ARCHIVE_WARN && fd >= 0 && archive_entry_size(entry) > 0) if (write_file_data(bsdtar, a, fd)) exit(1); @@ -1395,7 +1425,7 @@ new_enough(struct bsdtar *bsdtar, const char *path, const struct stat *st) if (bsdtar->archive_dir != NULL && bsdtar->archive_dir->head != NULL) { for (p = bsdtar->archive_dir->head; p != NULL; p = p->next) { - if (strcmp(path, p->name)==0) + if (pathcmp(path, p->name)==0) return (p->mtime_sec < st->st_mtime || (p->mtime_sec == st->st_mtime && p->mtime_nsec @@ -1418,9 +1448,6 @@ add_dir_list(struct bsdtar *bsdtar, const char *path, { struct archive_dir_entry *p; - if (path[0] == '.' && path[1] == '/' && path[2] != '\0') - path += 2; - /* * Search entire list to see if this file has appeared before. * If it has, override the timestamp data. |