Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Feb 2025 12:23:36 GMT
From:      Daniel Engberg <diizzy@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 8068f38f91eb - main - archivers/fastjar: Update to 0.98
Message-ID:  <202502091223.519CNaEE051011@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8068f38f91ebac6a374dd52193b97599a4cfe126

commit 8068f38f91ebac6a374dd52193b97599a4cfe126
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2025-02-09 11:25:41 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2025-02-09 12:19:31 +0000

    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)
---
 archivers/fastjar/Makefile               |  22 ++---
 archivers/fastjar/distinfo               |   5 +-
 archivers/fastjar/files/patch-compress.c |  13 +++
 archivers/fastjar/files/patch-jartool.c  | 142 +++++++++++++++++++++++++++++--
 4 files changed, 161 insertions(+), 21 deletions(-)

diff --git a/archivers/fastjar/Makefile b/archivers/fastjar/Makefile
index 75a0d9ee80c3..0a116b05d18b 100644
--- a/archivers/fastjar/Makefile
+++ b/archivers/fastjar/Makefile
@@ -1,28 +1,28 @@
 PORTNAME=	fastjar
-PORTVERSION=	0.93.20060808
-PORTREVISION=	4
+DISTVERSION=	0.98
 CATEGORIES=	archivers java
-MASTER_SITES=	LOCAL/maho/fastjar
+MASTER_SITES=	SAVANNAH
 
 MAINTAINER=	java@FreeBSD.org
 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_FILE=	${WRKSRC}/COPYING
+
+USES=		gmake makeinfo
 
-USES=		gmake makeinfo perl5 tar:bzip2
-USE_PERL5=	build
 GNU_CONFIGURE=	yes
-GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
 
-WRKSRC=		${WRKDIR}/${PORTNAME}
+INFO=		fastjar
 PORTDOCS=	CHANGES ChangeLog NEWS README
-PLIST_FILES=	bin/fastjar bin/grepjar \
+
+PLIST_FILES=	bin/fastjar \
+		bin/grepjar \
+		lib/charset.alias \
 		share/man/man1/fastjar.1.gz \
 		share/man/man1/grepjar.1.gz
 
-INFO=		fastjar
-
 OPTIONS_DEFINE=	DOCS
 
 post-install:
diff --git a/archivers/fastjar/distinfo b/archivers/fastjar/distinfo
index 44be7fe00a94..03866f646c7a 100644
--- a/archivers/fastjar/distinfo
+++ b/archivers/fastjar/distinfo
@@ -1,2 +1,3 @@
-SHA256 (fastjar-0.93.20060808.tar.bz2) = ba13e60bcffd782ac23383e24a1f50a92a30789944615f86a3f5c945abe2fe4e
-SIZE (fastjar-0.93.20060808.tar.bz2) = 112355
+TIMESTAMP = 1739100125
+SHA256 (fastjar-0.98.tar.gz) = f156abc5de8658f22ee8f08d7a72c88f9409ebd8c7933e9466b0842afeb2f145
+SIZE (fastjar-0.98.tar.gz) = 717984
diff --git a/archivers/fastjar/files/patch-compress.c b/archivers/fastjar/files/patch-compress.c
new file mode 100644
index 000000000000..6d40bf223c1d
--- /dev/null
+++ b/archivers/fastjar/files/patch-compress.c
@@ -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);
diff --git a/archivers/fastjar/files/patch-jartool.c b/archivers/fastjar/files/patch-jartool.c
index 001fb358468b..479e942aed1c 100644
--- a/archivers/fastjar/files/patch-jartool.c
+++ b/archivers/fastjar/files/patch-jartool.c
@@ -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
-@@ -313,7 +313,7 @@ int number_of_entries; /* number of entr
- const char *progname;
+@@ -790,6 +790,7 @@ int read_entries (int fd)
+ 		   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. */
--ub4 end_of_entries;
-+off_t end_of_entries;
+   /* 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");
  
- /* This is used to mark options with no short value.  */
- #define LONG_OPT(Num)  ((Num) + 128)
+   if(verbose){
+@@ -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",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502091223.519CNaEE051011>