tar: bump version.

* fix #235.
This commit is contained in:
Jerome Duval
2015-06-08 12:05:58 +00:00
parent 004a7f4ce3
commit 208a8aa3a0
5 changed files with 51 additions and 323 deletions

View File

@@ -1,108 +0,0 @@
diff -aur tar-1.26/src/common.h tar/src/common.h
--- tar-1.26/src/common.h 2011-02-11 12:56:13.006553600 +0100
+++ tar/src/common.h 2012-10-30 20:04:25.823132160 +0100
@@ -186,6 +186,8 @@
};
GLOBAL enum old_files old_files_option;
+GLOBAL bool simulate_hardlinks_option;
+
/* Specified file name for incremental list. */
GLOBAL const char *listed_incremental_option;
/* Incremental dump level */
diff -aur tar-1.26/src/extract.c tar/src/extract.c
--- tar-1.26/src/extract.c 2010-11-27 11:33:22.008912896 +0100
+++ tar/src/extract.c 2012-10-30 20:26:14.453246976 +0100
@@ -31,6 +31,8 @@
static mode_t newdir_umask; /* umask when creating new directories */
static mode_t current_umask; /* current umask (which is set to 0 if -p) */
+static int extract_symlink (char *, int);
+
#define ALL_MODE_BITS ((mode_t) ~ (mode_t) 0)
#if ! HAVE_FCHMOD && ! defined fchmod
@@ -1113,6 +1115,38 @@
char const *link_name;
int rc;
+ if (simulate_hardlinks_option)
+ {
+ /* symlinks have to be normalized */
+ const char* f = file_name;
+ const char* l = current_stat_info.link_name;
+ int sep_pos = 0;
+ int p_count = 0;
+ char *link_name = (char*) xmalloc(strlen(current_stat_info.link_name) * 2);
+
+ for (; *f && *l; f++, l++)
+ {
+ if (*f != *l)
+ break;
+ if (*f == DIRECTORY_SEPARATOR)
+ sep_pos = f - file_name;
+ }
+
+ for (p_count = 0; *f; f++)
+ if (*f == DIRECTORY_SEPARATOR)
+ p_count++;
+
+ link_name[0] = '\0';
+ while (p_count--)
+ strcat(link_name, "../");
+
+ strcat(link_name, &current_stat_info.link_name[sep_pos + 1]);
+ free(current_stat_info.link_name);
+ current_stat_info.link_name = link_name;
+
+ return extract_symlink(file_name, typeflag);
+ }
+
link_name = current_stat_info.link_name;
if (! absolute_names_option && contains_dot_dot (link_name))
@@ -1201,6 +1235,13 @@
#else
static int warned_once;
+ /* recursion is not welcomed here */
+ if (simulate_hardlinks_option && typeflag == LINKTYPE)
+ {
+ link_error (current_stat_info.link_name, file_name);
+ return -1;
+ }
+
if (!warned_once)
{
warned_once = 1;
diff -aur tar-1.26/src/tar.c tar/src/tar.c
--- tar-1.26/src/tar.c 2010-10-24 20:07:55.005767168 +0200
+++ tar/src/tar.c 2012-10-30 20:21:51.518520832 +0100
@@ -466,6 +466,8 @@
{"overwrite-dir", OVERWRITE_DIR_OPTION, 0, 0,
N_("overwrite metadata of existing directories when extracting (default)"),
GRID+1 },
+ {"replace-hardlinks", 'Q', 0, 0,
+ N_("replace hardlinks with corresponding symlink when extracting"), GRID+1 },
#undef GRID
#define GRID 40
@@ -1815,6 +1817,10 @@
set_archive_format (arg);
break;
+ case 'Q':
+ simulate_hardlinks_option = true;
+ break;
+
case INDEX_FILE_OPTION:
index_file_name = arg;
break;
@@ -2240,6 +2246,7 @@
unquote_option = true;
tar_sparse_major = 1;
tar_sparse_minor = 0;
+ simulate_hardlinks_option = false;
owner_option = -1;
group_option = -1;

View File

@@ -1,147 +0,0 @@
From 25395e3fa0b01a898b6e6ae456c8eef3c66849f1 Mon Sep 17 00:00:00 2001
From: Jonathan Schleifer <js@webkeks.org>
Date: Thu, 20 Mar 2014 14:52:58 +0100
Subject: Patches from tar-1.26
diff --git a/src/common.h b/src/common.h
index 42fd539..633ca19 100644
--- a/src/common.h
+++ b/src/common.h
@@ -192,6 +192,8 @@ GLOBAL enum old_files old_files_option;
GLOBAL bool keep_directory_symlink_option;
+GLOBAL bool simulate_hardlinks_option;
+
/* Specified file name for incremental list. */
GLOBAL const char *listed_incremental_option;
/* Incremental dump level */
diff --git a/src/extract.c b/src/extract.c
index 9b6b7f9..26b027f 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -33,6 +33,8 @@ static bool we_are_root; /* true if our effective uid == 0 */
static mode_t newdir_umask; /* umask when creating new directories */
static mode_t current_umask; /* current umask (which is set to 0 if -p) */
+static int extract_symlink (char *, int);
+
#define ALL_MODE_BITS ((mode_t) ~ (mode_t) 0)
#if ! HAVE_FCHMOD && ! defined fchmod
@@ -1268,6 +1270,38 @@ extract_link (char *file_name, int typeflag)
char const *link_name;
int rc;
+ if (simulate_hardlinks_option)
+ {
+ /* symlinks have to be normalized */
+ const char* f = file_name;
+ const char* l = current_stat_info.link_name;
+ int sep_pos = 0;
+ int p_count = 0;
+ char *link_name = (char*) xmalloc(strlen(current_stat_info.link_name) * 2);
+
+ for (; *f && *l; f++, l++)
+ {
+ if (*f != *l)
+ break;
+ if (*f == DIRECTORY_SEPARATOR)
+ sep_pos = f - file_name;
+ }
+
+ for (p_count = 0; *f; f++)
+ if (*f == DIRECTORY_SEPARATOR)
+ p_count++;
+
+ link_name[0] = '\0';
+ while (p_count--)
+ strcat(link_name, "../");
+
+ strcat(link_name, &current_stat_info.link_name[sep_pos + 1]);
+ free(current_stat_info.link_name);
+ current_stat_info.link_name = link_name;
+
+ return extract_symlink(file_name, typeflag);
+ }
+
link_name = current_stat_info.link_name;
if (! absolute_names_option && contains_dot_dot (link_name))
@@ -1357,6 +1391,13 @@ extract_symlink (char *file_name, int typeflag)
#else
static int warned_once;
+ /* recursion is not welcomed here */
+ if (simulate_hardlinks_option && typeflag == LINKTYPE)
+ {
+ link_error (current_stat_info.link_name, file_name);
+ return -1;
+ }
+
if (!warned_once)
{
warned_once = 1;
diff --git a/src/tar.c b/src/tar.c
index 4f5017d..2dd5200 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -457,6 +457,8 @@ static struct argp_option options[] = {
{"check-device", CHECK_DEVICE_OPTION, NULL, 0,
N_("check device numbers when creating incremental archives (default)"),
GRID+1 },
+ {"replace-hardlinks", 'Q', 0, 0,
+ N_("replace hardlinks with corresponding symlink when extracting"), GRID+1 },
#undef GRID
#define GRID 30
@@ -1756,6 +1758,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
set_archive_format (arg);
break;
+ case 'Q':
+ simulate_hardlinks_option = true;
+ break;
+
case INDEX_FILE_OPTION:
index_file_name = arg;
break;
@@ -2253,6 +2259,7 @@ decode_options (int argc, char **argv)
unquote_option = true;
tar_sparse_major = 1;
tar_sparse_minor = 0;
+ simulate_hardlinks_option = false;
owner_option = -1; owner_name_option = NULL;
group_option = -1; group_name_option = NULL;
--
1.8.3.4
From 6f729d50ba6ca87c6cd33d87462884d90d4504c0 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Fri, 28 Mar 2014 21:44:58 +0100
Subject: gcc2 build fix.
diff --git a/lib/wordsplit.h b/lib/wordsplit.h
index b48e3cd..d286ffb 100644
--- a/lib/wordsplit.h
+++ b/lib/wordsplit.h
@@ -33,10 +33,8 @@ struct wordsplit
const char *ws_comment;
const char *ws_escape;
void (*ws_alloc_die) (struct wordsplit * wsp);
- void (*ws_error) (const char *, ...)
- __attribute__ ((__format__ (__printf__, 1, 2)));
- void (*ws_debug) (const char *, ...)
- __attribute__ ((__format__ (__printf__, 1, 2)));
+ void (*ws_error) (const char *, ...);
+ void (*ws_debug) (const char *, ...);
const char **ws_env;
const char *(*ws_getvar) (const char *, size_t, void *);
--
1.8.3.4

View File

@@ -0,0 +1,43 @@
From 3c509673672dfacba862e92ade239cbce93ec3d9 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 10 Sep 2014 16:24:50 +0000
Subject: gcc2 patch
diff --git a/lib/wordsplit.h b/lib/wordsplit.h
index d64cf2f..c93f53d 100644
--- a/lib/wordsplit.h
+++ b/lib/wordsplit.h
@@ -34,9 +34,9 @@ struct wordsplit
const char *ws_escape;
void (*ws_alloc_die) (struct wordsplit * wsp);
void (*ws_error) (const char *, ...)
- __attribute__ ((__format__ (__printf__, 1, 2)));
+;
void (*ws_debug) (const char *, ...)
- __attribute__ ((__format__ (__printf__, 1, 2)));
+;
const char **ws_env;
const char *(*ws_getvar) (const char *, size_t, void *);
diff --git a/src/tar.c b/src/tar.c
index cd32379..d975e37 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -566,11 +566,10 @@ static struct argp_option options[] = {
N_("cancel the effect of --delay-directory-restore option"), GRID+1 },
{"sort", SORT_OPTION, N_("ORDER"), 0,
#if D_INO_IN_DIRENT
- N_("directory sorting order: none (default), name or inode"
+ N_("directory sorting order: none (default), name or inode"), GRID+1 },
#else
- N_("directory sorting order: none (default) or name"
+ N_("directory sorting order: none (default) or name"), GRID+1 },
#endif
- ), GRID+1 },
#undef GRID
#define GRID 55
--
2.2.2

View File

@@ -1,60 +0,0 @@
SUMMARY="Saves and restores files to/from a tape or disk archive."
DESCRIPTION="
The Tar program provides the ability to create tar archives, as well as \
various other kinds of manipulation. For example, you can use Tar on \
previously created archives to extract files, to store additional files, or to \
update or list files which were already stored.
Initially, tar archives were used to store files conveniently on magnetic \
tape. The name "Tar" comes from this use; it stands for tape archiver. Despite \
the utility's name, Tar can direct its output to available devices, files, or \
other programs (using pipes), it can even access remote devices or files (as \
archives).
"
HOMEPAGE="http://www.gnu.org/software/tar/"
COPYRIGHT="1990-2011 Free Software Foundation, Inc."
LICENSE="GNU GPL v3"
SRC_URI="http://ftp.gnu.org/gnu/tar/tar-1.26.tar.bz2"
CHECKSUM_SHA256="5a5369f464502a598e938029c310d4b3abd51e6bb8dfd045663e61c8ea9f6d41"
REVISION="6"
ARCHITECTURES="x86_gcc2 x86 x86_64"
PATCHES="tar-1.26.patch"
PROVIDES="
tar = $portVersion compat >= 1
cmd:tar = $portVersion compat >= 1
"
REQUIRES="
haiku
"
BUILD_REQUIRES="
"
BUILD_PREREQUIRES="
haiku_devel
cmd:automake
cmd:autoreconf
cmd:gcc
cmd:ld
cmd:make
cmd:sed
"
defineDebugInfoPackage tar \
$binDir/tar
BUILD()
{
runConfigure ./configure \
--disable-nls \
LDFLAGS="-lnetwork" \
FORCE_UNSAFE_CONFIGURE=1
make $jobArgs
}
INSTALL()
{
make install
rm $libDir/charset.alias
}

View File

@@ -1,4 +1,4 @@
SUMMARY="Saves and restores files to/from a tape or disk archive"
SUMMARY="Saves and restores files to/from a tape or disk archive."
DESCRIPTION="
The Tar program provides the ability to create tar archives, as well as \
various other kinds of manipulation. For example, you can use Tar on \
@@ -13,24 +13,24 @@ archives).
HOMEPAGE="http://www.gnu.org/software/tar/"
COPYRIGHT="1990-2011 Free Software Foundation, Inc."
LICENSE="GNU GPL v3"
SRC_URI="http://ftp.gnu.org/gnu/tar/tar-1.27.1.tar.bz2"
CHECKSUM_SHA256="9b0fb3ce8512059337add0da5f8f0f7d7647f2201f5ece24581d620ea60337c6"
REVISION="2"
SRC_URI="http://ftp.gnu.org/gnu/tar/tar-$portVersion.tar.bz2"
CHECKSUM_SHA256="60e4bfe0602fef34cd908d91cf638e17eeb09394d7b98c2487217dc4d3147562"
REVISION="1"
ARCHITECTURES="x86_gcc2 ?x86 x86_64 arm"
PATCHES="tar-1.27.1.patchset"
PATCHES="tar-$portVersion.patchset"
PROVIDES="
tar = $portVersion compat >= 1
cmd:tar = $portVersion compat >= 1
"
REQUIRES="
haiku
haiku >= $haikuVersion
"
BUILD_REQUIRES="
"
BUILD_PREREQUIRES="
haiku_devel
haiku_devel >= $haikuVersion
cmd:automake
cmd:autoreconf
cmd:gcc
@@ -48,7 +48,7 @@ BUILD()
runConfigure ./configure \
--disable-nls \
--disable-gcc-warnings \
LDFLAGS="-lnetwork" \
LDFLAGS="-lnetwork" CFLAGS="-D_BSD_SOURCE" \
FORCE_UNSAFE_CONFIGURE=1
make $jobArgs
}