summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-02-26 19:59:01 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-02-26 20:10:47 +0000
commit3ca1b80226ab3a45e9173e15ff3b84e8cb855e9c (patch)
treee932eedef80099908af90bab35288ff1c2cc0e60
parentfd520b97b23fa444aa97e028b64fce70cd75023c (diff)
downloadpackages-3ca1b80226ab3a45e9173e15ff3b84e8cb855e9c.tar.gz
packages-3ca1b80226ab3a45e9173e15ff3b84e8cb855e9c.tar.bz2
packages-3ca1b80226ab3a45e9173e15ff3b84e8cb855e9c.tar.xz
packages-3ca1b80226ab3a45e9173e15ff3b84e8cb855e9c.zip
user/fastjar: new package
-rw-r--r--user/fastjar/APKBUILD51
-rw-r--r--user/fastjar/efficiency.patch104
-rw-r--r--user/fastjar/null-terminate.patch14
-rw-r--r--user/fastjar/write-return.patch15
4 files changed, 184 insertions, 0 deletions
diff --git a/user/fastjar/APKBUILD b/user/fastjar/APKBUILD
new file mode 100644
index 000000000..b821b2419
--- /dev/null
+++ b/user/fastjar/APKBUILD
@@ -0,0 +1,51 @@
+# Contributor: A. Wilcox <awilfox@adelielinux.org>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=fastjar
+pkgver=0.98
+pkgrel=0
+pkgdesc="Java archiver tool, tuned for performance"
+url="https://savannah.nongnu.org/projects/fastjar/"
+arch="all"
+license="GPL-2.0+ AND LGPL-2.0+"
+depends=""
+makedepends="zlib-dev"
+subpackages="$pkgname-doc"
+source="https://download.savannah.nongnu.org/releases/fastjar/fastjar-$pkgver.tar.gz
+ null-terminate.patch
+ write-return.patch
+ efficiency.patch
+ "
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+ update_config_sub
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+ rm -f "$pkgdir"/usr/lib/charset.alias
+}
+
+sha512sums="c0f9fca7b58d6acd00b90a5184dbde9ba3ffc5bf4d69512743e450649a272baf1f6af98b15d79d2b53990eaf84ef402c986035e6b615a19e35ed424348143903 fastjar-0.98.tar.gz
+073c4fcc780588f146f2970f8718dbd70597ce46be8429b86d989056811bd331e209edf90e49d9ed8507e518fd7d7f57a76749f36eb308c12f9a74c7ab10beca null-terminate.patch
+061c9ca0a13136b5eacef453822f71b8dc27f7501e2bbf5243785c147800f5793cffa6d1998dce0c12ce12fd892f3f0f03c06350e50621b5782dfb9a16c375ae write-return.patch
+16584ebe2bc104c2489ee8ff0f0aca471dc0d95c79b199fc463d6bdd6fe99425d583948ebb7e9aab775dffbffdea3babbd824df5debdbd445f559e1334815583 efficiency.patch"
diff --git a/user/fastjar/efficiency.patch b/user/fastjar/efficiency.patch
new file mode 100644
index 000000000..54c471e25
--- /dev/null
+++ b/user/fastjar/efficiency.patch
@@ -0,0 +1,104 @@
+From: Jakub Jelinek <jakub@redhat.com>
+Date: Thu, 10 Jun 2010 11:32:48 +0000
+Subject: [PATCH] jartool.c (extract_jar)
+
+Fix up checks for traversal to parent directories, disallow absolute
+paths, make the code slightly more efficient.
+
+Author: Dan Rosenberg <dan.j.rosenberg@gmail.com>
+
+--- a/jartool.c 2010/06/10 08:46:10 1.61
++++ b/jartool.c 2010/06/10 11:32:48 1.62
+@@ -1731,7 +1731,17 @@
+ struct stat sbuf;
+ int depth = 0;
+
+- tmp_buff = malloc(sizeof(char) * strlen((const char *)filename));
++ if(*filename == '/'){
++ fprintf(stderr, "Absolute path names are not allowed.\n");
++ exit(EXIT_FAILURE);
++ }
++
++ tmp_buff = malloc(strlen((const char *)filename));
++
++ if(tmp_buff == NULL) {
++ fprintf(stderr, "Out of memory.\n");
++ exit(EXIT_FAILURE);
++ }
+
+ for(;;){
+ const ub1 *idx = (const unsigned char *)strchr((const char *)start, '/');
+@@ -1739,25 +1749,28 @@
+ if(idx == NULL)
+ break;
+ else if(idx == start){
++ tmp_buff[idx - filename] = '/';
+ start++;
+ continue;
+ }
+- start = idx + 1;
+
+- strncpy(tmp_buff, (const char *)filename, (idx - filename));
+- tmp_buff[(idx - filename)] = '\0';
++ memcpy(tmp_buff + (start - filename), (const char *)start, (idx - start));
++ tmp_buff[idx - filename] = '\0';
+
+ #ifdef DEBUG
+ printf("checking the existance of %s\n", tmp_buff);
+ #endif
+- if(strcmp(tmp_buff, "..") == 0){
++ if(idx - start == 2 && memcmp(start, "..", 2) == 0){
+ --depth;
+ if (depth < 0){
+ fprintf(stderr, "Traversal to parent directories during unpacking!\n");
+ exit(EXIT_FAILURE);
+ }
+- } else if (strcmp(tmp_buff, ".") != 0)
++ } else if (idx - start != 1 || *start != '.')
+ ++depth;
++
++ start = idx + 1;
++
+ if(stat(tmp_buff, &sbuf) < 0){
+ if(errno != ENOENT)
+ exit_on_error("stat");
+@@ -1766,6 +1779,7 @@
+ #ifdef DEBUG
+ printf("Directory exists\n");
+ #endif
++ tmp_buff[idx - filename] = '/';
+ continue;
+ }else {
+ fprintf(stderr, "Hmmm.. %s exists but isn't a directory!\n",
+@@ -1782,10 +1796,11 @@
+ if(verbose && handle)
+ printf("%10s: %s/\n", "created", tmp_buff);
+
++ tmp_buff[idx - filename] = '/';
+ }
+
+ /* only a directory */
+- if(strlen((const char *)start) == 0)
++ if(*start == '\0')
+ dir = TRUE;
+
+ #ifdef DEBUG
+@@ -1793,7 +1808,7 @@
+ #endif
+
+ /* If the entry was just a directory, don't write to file, etc */
+- if(strlen((const char *)start) == 0)
++ if(*start == '\0')
+ f_fd = -1;
+
+ free(tmp_buff);
+@@ -1877,7 +1892,8 @@
+ exit(EXIT_FAILURE);
+ }
+
+- close(f_fd);
++ if (f_fd != -1)
++ close(f_fd);
+
+ if(verbose && dir == FALSE && handle)
+ printf("%10s: %s\n",
diff --git a/user/fastjar/null-terminate.patch b/user/fastjar/null-terminate.patch
new file mode 100644
index 000000000..d9aad6ca2
--- /dev/null
+++ b/user/fastjar/null-terminate.patch
@@ -0,0 +1,14 @@
+From: Richard Guenther <rguenther@suse.de>
+Date: Mon, 01 Mar 2010 15:38:43 +0000
+Subject: [PATCH] jartool.c (read_entries): Properly zero-terminate filename.
+
+--- a/jartool.c 2009/09/06 22:16:00 1.59
++++ b/jartool.c 2010/03/01 15:38:43 1.60
+@@ -790,6 +790,7 @@
+ progname, jarfile);
+ return 1;
+ }
++ ze->filename[len] = '\0';
+ len = UNPACK_UB4(header, CEN_EFLEN);
+ len += UNPACK_UB4(header, CEN_COMLEN);
+ if (lseek (fd, len, SEEK_CUR) == -1)
diff --git a/user/fastjar/write-return.patch b/user/fastjar/write-return.patch
new file mode 100644
index 000000000..795179fcd
--- /dev/null
+++ b/user/fastjar/write-return.patch
@@ -0,0 +1,15 @@
+From: Chris Ball <cjb@laptop.org>
+Date: Thu, 10 Jun 2010 08:46:10 +0000
+Subject: [PATCH] jartool.c (add_file_to_jar): Fix write return value check.
+
+--- a/jartool.c 2010/03/01 15:38:43 1.60
++++ b/jartool.c 2010/06/10 08:46:10 1.61
+@@ -1258,7 +1258,7 @@
+ exit_on_error("write");
+
+ /* write the file name to the zip file */
+- if (1 == write(jfd, fname, file_name_length))
++ if (-1 == write(jfd, fname, file_name_length))
+ exit_on_error("write");
+
+ if(verbose){