forked from Lainports/freebsd-ports
archivers/fastjar: Update to 0.98
* Switch to variant hosted on https://savannah.nongnu.org * Import patches from Debian Changelog: https://cvs.savannah.nongnu.org/viewvc/fastjar/fastjar/NEWS?revision=1.11&view=markup Originally submitted by swills@ References: https://sources.debian.org/data/main/f/fastjar/2%3A0.98-7/debian/patches/fix-update-mode.diff https://sources.debian.org/data/main/f/fastjar/2%3A0.98-7/debian/patches/jartool.diff PR: 254198 Approved by: portmgr (maintainer timeout, 3+ years)
This commit is contained in:
parent
77752714f9
commit
8068f38f91
4 changed files with 163 additions and 23 deletions
|
|
@ -1,27 +1,27 @@
|
||||||
PORTNAME= fastjar
|
PORTNAME= fastjar
|
||||||
PORTVERSION= 0.93.20060808
|
DISTVERSION= 0.98
|
||||||
PORTREVISION= 4
|
|
||||||
CATEGORIES= archivers java
|
CATEGORIES= archivers java
|
||||||
MASTER_SITES= LOCAL/maho/fastjar
|
MASTER_SITES= SAVANNAH
|
||||||
|
|
||||||
MAINTAINER= java@FreeBSD.org
|
MAINTAINER= java@FreeBSD.org
|
||||||
COMMENT= Version of JDK's `jar' command written entirely in C
|
COMMENT= Version of JDK's `jar' command written entirely in C
|
||||||
WWW= https://fastjar.sourceforge.net/
|
WWW= https://savannah.nongnu.org/projects/fastjar/
|
||||||
|
|
||||||
LICENSE= GPLv2+
|
LICENSE= GPLv2+
|
||||||
|
LICENSE_FILE= ${WRKSRC}/COPYING
|
||||||
|
|
||||||
|
USES= gmake makeinfo
|
||||||
|
|
||||||
USES= gmake makeinfo perl5 tar:bzip2
|
|
||||||
USE_PERL5= build
|
|
||||||
GNU_CONFIGURE= yes
|
GNU_CONFIGURE= yes
|
||||||
GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
|
|
||||||
|
|
||||||
WRKSRC= ${WRKDIR}/${PORTNAME}
|
|
||||||
PORTDOCS= CHANGES ChangeLog NEWS README
|
|
||||||
PLIST_FILES= bin/fastjar bin/grepjar \
|
|
||||||
share/man/man1/fastjar.1.gz \
|
|
||||||
share/man/man1/grepjar.1.gz
|
|
||||||
|
|
||||||
INFO= fastjar
|
INFO= fastjar
|
||||||
|
PORTDOCS= CHANGES ChangeLog NEWS README
|
||||||
|
|
||||||
|
PLIST_FILES= bin/fastjar \
|
||||||
|
bin/grepjar \
|
||||||
|
lib/charset.alias \
|
||||||
|
share/man/man1/fastjar.1.gz \
|
||||||
|
share/man/man1/grepjar.1.gz
|
||||||
|
|
||||||
OPTIONS_DEFINE= DOCS
|
OPTIONS_DEFINE= DOCS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
SHA256 (fastjar-0.93.20060808.tar.bz2) = ba13e60bcffd782ac23383e24a1f50a92a30789944615f86a3f5c945abe2fe4e
|
TIMESTAMP = 1739100125
|
||||||
SIZE (fastjar-0.93.20060808.tar.bz2) = 112355
|
SHA256 (fastjar-0.98.tar.gz) = f156abc5de8658f22ee8f08d7a72c88f9409ebd8c7933e9466b0842afeb2f145
|
||||||
|
SIZE (fastjar-0.98.tar.gz) = 717984
|
||||||
|
|
|
||||||
13
archivers/fastjar/files/patch-compress.c
Normal file
13
archivers/fastjar/files/patch-compress.c
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
--- compress.c.orig 2008-10-15 17:25:36 UTC
|
||||||
|
+++ compress.c
|
||||||
|
@@ -86,6 +86,10 @@ write_data (int fd, void *buf, size_t len,
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ else if (!next && here + len >= end_of_entries)
|
||||||
|
+ {
|
||||||
|
+ end_of_entries = here + len;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
return write (fd, buf, len);
|
||||||
|
|
@ -1,11 +1,137 @@
|
||||||
--- jartool.c.orig 2006-08-07 08:06:23 UTC
|
--- jartool.c.orig 2025-02-09 11:28:36 UTC
|
||||||
+++ jartool.c
|
+++ jartool.c
|
||||||
@@ -313,7 +313,7 @@ int number_of_entries; /* number of entr
|
@@ -790,6 +790,7 @@ int read_entries (int fd)
|
||||||
const char *progname;
|
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)
|
||||||
|
@@ -1257,7 +1258,7 @@ int add_file_to_jar(int jfd, int ffd, const char *fnam
|
||||||
|
exit_on_error("write");
|
||||||
|
|
||||||
/* The offset of the end of the last zip entry. */
|
/* write the file name to the zip file */
|
||||||
-ub4 end_of_entries;
|
- if (1 == write(jfd, fname, file_name_length))
|
||||||
+off_t end_of_entries;
|
+ if (-1 == write(jfd, fname, file_name_length))
|
||||||
|
exit_on_error("write");
|
||||||
|
|
||||||
/* This is used to mark options with no short value. */
|
if(verbose){
|
||||||
#define LONG_OPT(Num) ((Num) + 128)
|
@@ -1273,15 +1274,18 @@ int add_file_to_jar(int jfd, int ffd, const char *fnam
|
||||||
|
compress_file(ffd, jfd, ze, existing);
|
||||||
|
} else {
|
||||||
|
/* If we are not writing the last entry, make space for it. */
|
||||||
|
- if (existing && existing->next_entry)
|
||||||
|
+ if (existing)
|
||||||
|
{
|
||||||
|
- if (ze->usize > existing->usize)
|
||||||
|
+ if (existing->next_entry)
|
||||||
|
{
|
||||||
|
- if (shift_down (jfd, existing->next_entry->offset,
|
||||||
|
- ze->usize - existing->usize, existing->next_entry))
|
||||||
|
+ if (ze->usize > existing->usize)
|
||||||
|
{
|
||||||
|
- fprintf (stderr, "%s: %s\n", progname, strerror (errno));
|
||||||
|
- return 1;
|
||||||
|
+ if (shift_down (jfd, existing->next_entry->offset,
|
||||||
|
+ ze->usize - existing->usize, existing->next_entry))
|
||||||
|
+ {
|
||||||
|
+ fprintf (stderr, "%s: %s\n", progname, strerror (errno));
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1730,33 +1734,46 @@ int extract_jar(int fd, const char **files, int file_n
|
||||||
|
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, '/');
|
||||||
|
|
||||||
|
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");
|
||||||
|
@@ -1765,6 +1782,7 @@ int extract_jar(int fd, const char **files, int file_n
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("Directory exists\n");
|
||||||
|
#endif
|
||||||
|
+ tmp_buff[idx - filename] = '/';
|
||||||
|
continue;
|
||||||
|
}else {
|
||||||
|
fprintf(stderr, "Hmmm.. %s exists but isn't a directory!\n",
|
||||||
|
@@ -1781,10 +1799,11 @@ int extract_jar(int fd, const char **files, int file_n
|
||||||
|
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
|
||||||
|
@@ -1792,7 +1811,7 @@ int extract_jar(int fd, const char **files, int file_n
|
||||||
|
#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);
|
||||||
|
@@ -1876,7 +1895,8 @@ int extract_jar(int fd, const char **files, int file_n
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
- close(f_fd);
|
||||||
|
+ if (f_fd != -1)
|
||||||
|
+ close(f_fd);
|
||||||
|
|
||||||
|
if(verbose && dir == FALSE && handle)
|
||||||
|
printf("%10s: %s\n",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue