diff options
author | Carlo Landmeter <clandmeter@gmail.com> | 2015-04-02 11:08:44 +0000 |
---|---|---|
committer | Carlo Landmeter <clandmeter@gmail.com> | 2015-04-02 11:08:44 +0000 |
commit | adebfedd0063d445a70e247428a5f0bccbcbb352 (patch) | |
tree | 8a3e5976023e1c9b327c7fb1281ecc7ffc69e4a6 /testing | |
parent | c0ee05da32fb7e71253d5777be543c71ccaf1986 (diff) | |
download | aports-adebfedd0063d445a70e247428a5f0bccbcbb352.tar.bz2 aports-adebfedd0063d445a70e247428a5f0bccbcbb352.tar.xz |
testing/libtar: new aport
Diffstat (limited to 'testing')
-rw-r--r-- | testing/libtar/APKBUILD | 74 | ||||
-rw-r--r-- | testing/libtar/libtar-1.2.11-bz729009.patch | 25 | ||||
-rw-r--r-- | testing/libtar/libtar-1.2.11-mem-deref.patch | 24 | ||||
-rw-r--r-- | testing/libtar/libtar-1.2.11-missing-protos.patch | 34 | ||||
-rw-r--r-- | testing/libtar/libtar-1.2.20-fix-resource-leaks.patch | 241 | ||||
-rw-r--r-- | testing/libtar/libtar-1.2.20-no-static-buffer.patch | 148 |
6 files changed, 546 insertions, 0 deletions
diff --git a/testing/libtar/APKBUILD b/testing/libtar/APKBUILD new file mode 100644 index 0000000000..e92869b212 --- /dev/null +++ b/testing/libtar/APKBUILD @@ -0,0 +1,74 @@ +# Contributor: Carlo Landmeter <clandmeter@gmail.com> +# Maintainer: +pkgname=libtar +pkgver=1.2.20 +pkgrel=0 +pkgdesc="C library for manipulating POSIX tar files" +url="http://repo.or.cz/w/libtar.git" +arch="all" +license="BSD" +depends="" +depends_dev="zlib-dev" +makedepends="$depends_dev automake autoconf libtool" +install="" +subpackages="$pkgname-dev $pkgname-doc" +source="$pkgname-$pkgver.tar.gz::http://repo.or.cz/w/libtar.git/snapshot/0907a9034eaf2a57e8e4a9439f793f3f05d446cd.tar.gz + libtar-1.2.11-mem-deref.patch + libtar-1.2.20-fix-resource-leaks.patch + libtar-1.2.11-bz729009.patch + libtar-1.2.11-missing-protos.patch + libtar-1.2.20-no-static-buffer.patch" + +_builddir="$srcdir"/libtar +prepare() { + local i + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done +} + +build() { + cd "$_builddir" + autoreconf -ivf + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --disable-static \ + --disable-encap \ + --disable-epkg-install \ + || return 1 + make || return 1 +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" install || return 1 + rm -f "$pkgdir"/usr/lib/*.la +} + +md5sums="863a457f6e19763c6c8f5108b85d24cc libtar-1.2.20.tar.gz +46b80e57e35ac14b0122ed0608e76c0e libtar-1.2.11-mem-deref.patch +784bee46d827e39435eadbdba4165a9d libtar-1.2.20-fix-resource-leaks.patch +15b6aea663be015569331aaa1c198b42 libtar-1.2.11-bz729009.patch +8d3e423b2db39f044c87f662bbbf12ab libtar-1.2.11-missing-protos.patch +01249bb7ea03a15c40547cafbb6afe47 libtar-1.2.20-no-static-buffer.patch" +sha256sums="d1b2660d0af735fed2d2a0c3369dda7bea7445a4b1ef2f2742b352b1e1eec5f8 libtar-1.2.20.tar.gz +1420e4ca7b54f19f6c1665fa768919671378ecdae5f085756031243ac939d984 libtar-1.2.11-mem-deref.patch +664cd4476890a5969c61c7cb47f2399c3b43fab2b449d3049651187ca558c932 libtar-1.2.20-fix-resource-leaks.patch +b202918e6842ce8c80e6ead70a3af6dd6f1be37d2623048bb82b6ad7ccc5fa17 libtar-1.2.11-bz729009.patch +83838ef1e49690f446c3732a8ac89cd72b47c65155a819b29dfddfd4f5ce8fc1 libtar-1.2.11-missing-protos.patch +c1d330b6663015211605bef1efc193cfe59075de6a55f9efd2a52842f0ad0d27 libtar-1.2.20-no-static-buffer.patch" +sha512sums="675011b996848ac730d2f3663550e5389fed2ffcb0f2a8ca7078caa3a29d24e7ecae41e59d257585828101a3b37fe9c83e64eb7b086f0e7275c18bb2fdca4621 libtar-1.2.20.tar.gz +e7179581b523dc209965244f384f80f7b6b2a37595c6363347e4ff1270f918c4e729341670994c1e7f9578403f18445a569c165ee62ce5f87e30dec983cadb08 libtar-1.2.11-mem-deref.patch +06f6df6b681dc49a2249be57e9507db33ad90f6797c9f35b9f38c9eafcc31164245b40d4eaf696f295fff477daaacd51833976132710c902c78d6fe84472667f libtar-1.2.20-fix-resource-leaks.patch +12470f357e0df579cd8ef9bd09121e2d742754d56517c1d153036e1436155324268bc86145e504c56761571ac9df1be6d13448d7349a3a51a30e82c4c65e162f libtar-1.2.11-bz729009.patch +8ac4eea5ed2aa7f3893b44468b33fc668f2b026bd55282179c0920ae18fbc197a850523eb12624524e599ae4b0380c7322b296d4952c5d263e8971459dace021 libtar-1.2.11-missing-protos.patch +f6db3c9dfb537fb583ef87f3a10105378d20d7950184c67e4af2f4a4edc7a38ed9229dc389300bc5554e1fc1cce8adbd947c2c56cea2a1a4a00a23fb92e18244 libtar-1.2.20-no-static-buffer.patch" diff --git a/testing/libtar/libtar-1.2.11-bz729009.patch b/testing/libtar/libtar-1.2.11-bz729009.patch new file mode 100644 index 0000000000..2adfce313f --- /dev/null +++ b/testing/libtar/libtar-1.2.11-bz729009.patch @@ -0,0 +1,25 @@ +From 1f2ec801cf4ac954f84c81e7587ce11998f78911 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka <kdudka@redhat.com> +Date: Tue, 9 Aug 2011 12:02:26 +0200 +Subject: [PATCH] libtar - rhbz #729009 + +--- + libtar/Makefile.in | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/libtar/Makefile.in b/libtar/Makefile.in +index 4e7bca4..94bd198 100644 +--- a/libtar/Makefile.in ++++ b/libtar/Makefile.in +@@ -20,7 +20,7 @@ SHELL = @SHELL@ + + ### Installation programs and flags + INSTALL = @INSTALL@ +-INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_DATA = @INSTALL_DATA@ + LN_S = @LN_S@ + MKDIR = @MKDIR@ +-- +1.7.4.4 + diff --git a/testing/libtar/libtar-1.2.11-mem-deref.patch b/testing/libtar/libtar-1.2.11-mem-deref.patch new file mode 100644 index 0000000000..8a618a0a22 --- /dev/null +++ b/testing/libtar/libtar-1.2.11-mem-deref.patch @@ -0,0 +1,24 @@ +--- libtar-1.2.11/lib/libtar.h.deref 2009-12-30 16:37:03.790121122 +0100 ++++ libtar-1.2.11/lib/libtar.h 2009-12-30 16:37:35.521246633 +0100 +@@ -172,6 +172,7 @@ int th_write(TAR *t); + #define TH_ISDIR(t) ((t)->th_buf.typeflag == DIRTYPE \ + || S_ISDIR((mode_t)oct_to_int((t)->th_buf.mode)) \ + || ((t)->th_buf.typeflag == AREGTYPE \ ++ && strlen((t)->th_buf.name) \ + && ((t)->th_buf.name[strlen((t)->th_buf.name) - 1] == '/'))) + #define TH_ISFIFO(t) ((t)->th_buf.typeflag == FIFOTYPE \ + || S_ISFIFO((mode_t)oct_to_int((t)->th_buf.mode))) +--- libtar-1.2.11/lib/util.c.deref 2003-01-07 02:41:00.000000000 +0100 ++++ libtar-1.2.11/lib/util.c 2009-12-30 17:35:51.860121660 +0100 +@@ -148,9 +148,7 @@ oct_to_int(char *oct) + { + int i; + +- sscanf(oct, "%o", &i); +- +- return i; ++ return sscanf(oct, "%o", &i) == 1 ? i : 0; + } + + + diff --git a/testing/libtar/libtar-1.2.11-missing-protos.patch b/testing/libtar/libtar-1.2.11-missing-protos.patch new file mode 100644 index 0000000000..8a65c2a628 --- /dev/null +++ b/testing/libtar/libtar-1.2.11-missing-protos.patch @@ -0,0 +1,34 @@ +diff -up libtar-1.2.11/lib/append.c.foo libtar-1.2.11/lib/append.c +--- libtar-1.2.11/lib/append.c.foo 2003-01-07 02:40:59.000000000 +0100 ++++ libtar-1.2.11/lib/append.c 2008-04-03 15:08:07.000000000 +0200 +@@ -13,6 +13,8 @@ + #include <internal.h> + + #include <stdio.h> ++#include <stdlib.h> ++#include <string.h> + #include <errno.h> + #include <fcntl.h> + #include <sys/param.h> +diff -up libtar-1.2.11/lib/output.c~ libtar-1.2.11/lib/output.c +--- libtar-1.2.11/lib/output.c~ 2008-04-03 15:11:07.000000000 +0200 ++++ libtar-1.2.11/lib/output.c 2008-04-03 15:11:07.000000000 +0200 +@@ -13,6 +13,7 @@ + #include <internal.h> + + #include <stdio.h> ++#include <stdlib.h> + #include <pwd.h> + #include <grp.h> + #include <time.h> +diff -up libtar-1.2.11/lib/wrapper.c~ libtar-1.2.11/lib/wrapper.c +--- libtar-1.2.11/lib/wrapper.c~ 2008-04-03 15:11:28.000000000 +0200 ++++ libtar-1.2.11/lib/wrapper.c 2008-04-03 15:11:28.000000000 +0200 +@@ -13,6 +13,7 @@ + #include <internal.h> + + #include <stdio.h> ++#include <stdlib.h> + #include <sys/param.h> + #include <dirent.h> + #include <errno.h> diff --git a/testing/libtar/libtar-1.2.20-fix-resource-leaks.patch b/testing/libtar/libtar-1.2.20-fix-resource-leaks.patch new file mode 100644 index 0000000000..bdca92ebcd --- /dev/null +++ b/testing/libtar/libtar-1.2.20-fix-resource-leaks.patch @@ -0,0 +1,241 @@ +From abd0274e6b2f708e9eaa29414b07b3f542cec694 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka <kdudka@redhat.com> +Date: Tue, 15 Oct 2013 19:48:41 -0400 +Subject: [PATCH 1/3] fix file descriptor leaks reported by cppcheck + +Bug: https://bugzilla.redhat.com/785760 +--- + lib/append.c | 14 +++++++++----- + lib/extract.c | 4 ++++ + libtar/libtar.c | 3 +++ + 3 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/lib/append.c b/lib/append.c +index e8bd89d..ff58532 100644 +--- a/lib/append.c ++++ b/lib/append.c +@@ -216,6 +216,7 @@ tar_append_regfile(TAR *t, const char *realname) + int filefd; + int i, j; + size_t size; ++ int rv = -1; + + filefd = open(realname, O_RDONLY); + if (filefd == -1) +@@ -234,25 +235,28 @@ tar_append_regfile(TAR *t, const char *realname) + { + if (j != -1) + errno = EINVAL; +- return -1; ++ goto fail; + } + if (tar_block_write(t, &block) == -1) +- return -1; ++ goto fail; + } + + if (i > 0) + { + j = read(filefd, &block, i); + if (j == -1) +- return -1; ++ goto fail; + memset(&(block[i]), 0, T_BLOCKSIZE - i); + if (tar_block_write(t, &block) == -1) +- return -1; ++ goto fail; + } + ++ /* success! */ ++ rv = 0; ++fail: + close(filefd); + +- return 0; ++ return rv; + } + + +diff --git a/lib/extract.c b/lib/extract.c +index 36357e7..9fc6ad5 100644 +--- a/lib/extract.c ++++ b/lib/extract.c +@@ -228,13 +228,17 @@ tar_extract_regfile(TAR *t, char *realname) + { + if (k != -1) + errno = EINVAL; ++ close(fdout); + return -1; + } + + /* write block to output file */ + if (write(fdout, buf, + ((i > T_BLOCKSIZE) ? T_BLOCKSIZE : i)) == -1) ++ { ++ close(fdout); + return -1; ++ } + } + + /* close output file */ +diff --git a/libtar/libtar.c b/libtar/libtar.c +index 9fa92b2..bb5644c 100644 +--- a/libtar/libtar.c ++++ b/libtar/libtar.c +@@ -83,7 +83,10 @@ gzopen_frontend(char *pathname, int oflags, int mode) + return -1; + + if ((oflags & O_CREAT) && fchmod(fd, mode)) ++ { ++ close(fd); + return -1; ++ } + + gzf = gzdopen(fd, gzoflags); + if (!gzf) +-- +1.7.1 + + +From 36629a41208375f5105427e98078127551692028 Mon Sep 17 00:00:00 2001 +From: Huzaifa Sidhpurwala <huzaifas@fedoraproject.org> +Date: Tue, 15 Oct 2013 20:02:58 -0400 +Subject: [PATCH 2/3] fix memleak on tar_open() failure + +--- + lib/handle.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/lib/handle.c b/lib/handle.c +index 33a262c..002d23c 100644 +--- a/lib/handle.c ++++ b/lib/handle.c +@@ -82,6 +82,7 @@ tar_open(TAR **t, const char *pathname, tartype_t *type, + (*t)->fd = (*((*t)->type->openfunc))(pathname, oflags, mode); + if ((*t)->fd == -1) + { ++ libtar_hash_free((*t)->h, NULL); + free(*t); + return -1; + } +-- +1.7.1 + + +From f3c711cf3054ff366a1a3500cdc8c64ecc2d2da6 Mon Sep 17 00:00:00 2001 +From: Huzaifa Sidhpurwala <huzaifas@fedoraproject.org> +Date: Tue, 15 Oct 2013 20:05:04 -0400 +Subject: [PATCH 3/3] fix memleaks in libtar sample program + +--- + libtar/libtar.c | 29 ++++++++++++++++++----------- + 1 files changed, 18 insertions(+), 11 deletions(-) + +diff --git a/libtar/libtar.c b/libtar/libtar.c +index bb5644c..23f8741 100644 +--- a/libtar/libtar.c ++++ b/libtar/libtar.c +@@ -253,6 +253,7 @@ extract(char *tarfile, char *rootdir) + if (tar_extract_all(t, rootdir) != 0) + { + fprintf(stderr, "tar_extract_all(): %s\n", strerror(errno)); ++ tar_close(t); + return -1; + } + +@@ -270,12 +271,13 @@ extract(char *tarfile, char *rootdir) + + + void +-usage() ++usage(void *rootdir) + { + printf("Usage: %s [-C rootdir] [-g] [-z] -x|-t filename.tar\n", + progname); + printf(" %s [-C rootdir] [-g] [-z] -c filename.tar ...\n", + progname); ++ free(rootdir); + exit(-1); + } + +@@ -292,6 +294,7 @@ main(int argc, char *argv[]) + int c; + int mode = 0; + libtar_list_t *l; ++ int return_code = -2; + + progname = basename(argv[0]); + +@@ -313,17 +316,17 @@ main(int argc, char *argv[]) + break; + case 'c': + if (mode) +- usage(); ++ usage(rootdir); + mode = MODE_CREATE; + break; + case 'x': + if (mode) +- usage(); ++ usage(rootdir); + mode = MODE_EXTRACT; + break; + case 't': + if (mode) +- usage(); ++ usage(rootdir); + mode = MODE_LIST; + break; + #ifdef HAVE_LIBZ +@@ -332,7 +335,7 @@ main(int argc, char *argv[]) + break; + #endif /* HAVE_LIBZ */ + default: +- usage(); ++ usage(rootdir); + } + + if (!mode || ((argc - optind) < (mode == MODE_CREATE ? 2 : 1))) +@@ -341,7 +344,7 @@ main(int argc, char *argv[]) + printf("argc - optind == %d\tmode == %d\n", argc - optind, + mode); + #endif +- usage(); ++ usage(rootdir); + } + + #ifdef DEBUG +@@ -351,21 +354,25 @@ main(int argc, char *argv[]) + switch (mode) + { + case MODE_EXTRACT: +- return extract(argv[optind], rootdir); ++ return_code = extract(argv[optind], rootdir); ++ break; + case MODE_CREATE: + tarfile = argv[optind]; + l = libtar_list_new(LIST_QUEUE, NULL); + for (c = optind + 1; c < argc; c++) + libtar_list_add(l, argv[c]); +- return create(tarfile, rootdir, l); ++ return_code = create(tarfile, rootdir, l); ++ libtar_list_free(l, NULL); ++ break; + case MODE_LIST: +- return list(argv[optind]); ++ return_code = list(argv[optind]); ++ break; + default: + break; + } + +- /* NOTREACHED */ +- return -2; ++ free(rootdir); ++ return return_code; + } + + +-- +1.7.1 + diff --git a/testing/libtar/libtar-1.2.20-no-static-buffer.patch b/testing/libtar/libtar-1.2.20-no-static-buffer.patch new file mode 100644 index 0000000000..a30baca88a --- /dev/null +++ b/testing/libtar/libtar-1.2.20-no-static-buffer.patch @@ -0,0 +1,148 @@ +From ba16223652cfaa656d9c0c2d7bc7ab39dbd12467 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka <kdudka@redhat.com> +Date: Wed, 23 Oct 2013 15:04:22 +0200 +Subject: [PATCH 1/3] decode: avoid using a static buffer in th_get_pathname() + +A solution suggested by Chris Frey: +https://lists.feep.net:8080/pipermail/libtar/2013-October/000377.html + +Note this can break programs that expect sizeof(TAR) to be fixed. + +[upstream commit ec613af2e9371d7a3e1f7c7a6822164a4255b4d1] +--- + lib/decode.c | 24 +++++++++++++++++------- + lib/handle.c | 1 + + lib/libtar.h | 3 +++ + 3 files changed, 21 insertions(+), 7 deletions(-) + +diff --git a/lib/decode.c b/lib/decode.c +index c16ea2d..edb2185 100644 +--- a/lib/decode.c ++++ b/lib/decode.c +@@ -26,20 +26,30 @@ + char * + th_get_pathname(TAR *t) + { +- static TLS_THREAD char filename[MAXPATHLEN]; +- + if (t->th_buf.gnu_longname) + return t->th_buf.gnu_longname; + +- if (t->th_buf.prefix[0] != '\0') ++ /* allocate the th_pathname buffer if not already */ ++ if (t->th_pathname == NULL) ++ { ++ t->th_pathname = malloc(MAXPATHLEN * sizeof(char)); ++ if (t->th_pathname == NULL) ++ /* out of memory */ ++ return NULL; ++ } ++ ++ if (t->th_buf.prefix[0] == '\0') ++ { ++ snprintf(t->th_pathname, MAXPATHLEN, "%.100s", t->th_buf.name); ++ } ++ else + { +- snprintf(filename, sizeof(filename), "%.155s/%.100s", ++ snprintf(t->th_pathname, MAXPATHLEN, "%.155s/%.100s", + t->th_buf.prefix, t->th_buf.name); +- return filename; + } + +- snprintf(filename, sizeof(filename), "%.100s", t->th_buf.name); +- return filename; ++ /* will be deallocated in tar_close() */ ++ return t->th_pathname; + } + + +diff --git a/lib/handle.c b/lib/handle.c +index 002d23c..a19c046 100644 +--- a/lib/handle.c ++++ b/lib/handle.c +@@ -122,6 +122,7 @@ tar_close(TAR *t) + libtar_hash_free(t->h, ((t->oflags & O_ACCMODE) == O_RDONLY + ? free + : (libtar_freefunc_t)tar_dev_free)); ++ free(t->th_pathname); + free(t); + + return i; +diff --git a/lib/libtar.h b/lib/libtar.h +index 7fc4d03..08a8e0f 100644 +--- a/lib/libtar.h ++++ b/lib/libtar.h +@@ -85,6 +85,9 @@ typedef struct + int options; + struct tar_header th_buf; + libtar_hash_t *h; ++ ++ /* introduced in libtar 1.2.21 */ ++ char *th_pathname; + } + TAR; + +-- +1.7.1 + + +From 8ef92e48bba35d60208cc09be2bab74f69273d15 Mon Sep 17 00:00:00 2001 +From: Chris Frey <cdfrey@foursquare.net> +Date: Thu, 24 Oct 2013 17:55:12 -0400 +Subject: [PATCH 2/3] Check for NULL before freeing th_pathname + +Thanks to Harald Koch for pointing out that AIX 4 and 5 still need this. + +[upstream commit 495d0c0eabc5648186e7d58ad54b508d14af38f4] + +Signed-off-by: Kamil Dudka <kdudka@redhat.com> +--- + lib/handle.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/lib/handle.c b/lib/handle.c +index a19c046..28a7dc2 100644 +--- a/lib/handle.c ++++ b/lib/handle.c +@@ -122,7 +122,8 @@ tar_close(TAR *t) + libtar_hash_free(t->h, ((t->oflags & O_ACCMODE) == O_RDONLY + ? free + : (libtar_freefunc_t)tar_dev_free)); +- free(t->th_pathname); ++ if (t->th_pathname != NULL) ++ free(t->th_pathname); + free(t); + + return i; +-- +1.7.1 + + +From 71101392dbab09718d38fabd151bb3cf22fc8b80 Mon Sep 17 00:00:00 2001 +From: Chris Frey <cdfrey@foursquare.net> +Date: Thu, 24 Oct 2013 17:58:47 -0400 +Subject: [PATCH 3/3] Added stdlib.h for malloc() in lib/decode.c + +[upstream commit 20aa09bd7775094a2beb0f136c2c7d9e9fd6c7e6] + +Signed-off-by: Kamil Dudka <kdudka@redhat.com> +--- + lib/decode.c | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/lib/decode.c b/lib/decode.c +index edb2185..35312be 100644 +--- a/lib/decode.c ++++ b/lib/decode.c +@@ -13,6 +13,7 @@ + #include <internal.h> + + #include <stdio.h> ++#include <stdlib.h> + #include <sys/param.h> + #include <pwd.h> + #include <grp.h> +-- +1.7.1 + |