Package: libjlha-java
Version: 0.0.20050504-9

Amiga LhA is a variant of MS-DOS LHA which tweaks the file format to store filenotes. jlha does not support them. I've attached a patch to add support.

AmigaDOS allows files to have a "filenote", free-form ISO-8859-1 text up to 80 characters. Amiga LhA archives this by appending it to the stored file path, separated from the path by a null byte.

For example, if you download the archive at https://www.exotica.org.uk/wiki/The_Wall you'll find two files in the archive, the first archive file has path "The_Wall\\mod.days of fury\0Martin de Agger | The Wall | 1990 | Kefrens" (note the null byte). The intended filename is "The Wall/mod.days of fury"

00000000: 5b562d6c 68352d0b 0101005e a5010073  [V-lh5-....^...s
00000010: 52792d00 00455468 655f5761 6c6c5c6d  Ry-..EThe_Wall\m
00000020: 6f642e64 61797320 6f662066 75727900  od.days of fury.
00000030: 4d617274 696e2064 65204167 67657220  Martin de Agger
00000040: 7c205468 65205761 6c6c207c 20313939  | The Wall | 199
00000050: 30207c20 4b656672 656e7350 7c25e885  0 | KefrensP|%..

jlha doesn't know about this trick, so it doesn't support it:

$ jlha v The_Wall.lha
PERMSSN UID GID PACKED SIZE RATIO METHOD CRC STAMP NAME ---------- ----------- ------- ------- ------ ---------- ------------ ------------- [generic] 65803 107870 61.0% -lh5- 7c50 Nov 25 2002 The_Wall/mod.days of furyMartin de Agger | The Wall | 1990 | Kefrens [generic] 66429 95176 69.7% -lh5- 5101 Nov 25 2002 The_Wall/mod.thunder-wallMartin de Agger | The Wall | 1990 | Kefrens ---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total         2 files  132232  203046  65.1%            Aug 12 13:14

$ jlha x The_Wall.lha
The_Wall/mod.days of furyMartin de Agger | The Wall | 1990 | Kefrens - Melted : Aug 12, 2017 3:50:34 PM org.jlhafrontend.JLHAFrontEnd extract SEVERE: open OutputStream error java.io.FileNotFoundException: Invalid file path
Aug 12, 2017 3:50:34 PM org.jlhafrontend.JLHAFrontEnd extract
SEVERE: open OutputStream error java.io.FileNotFoundException: Invalid file path The_Wall/mod.thunder-wallMartin de Agger | The Wall | 1990 | Kefrens - Melted : Aug 12, 2017 3:50:34 PM org.jlhafrontend.JLHAFrontEnd extract SEVERE: open OutputStream error java.io.FileNotFoundException: Invalid file path
Aug 12, 2017 3:50:34 PM org.jlhafrontend.JLHAFrontEnd extract
SEVERE: open OutputStream error java.io.FileNotFoundException: Invalid file path

I've attached a patch to fix this. Once applied, jlha handles the archives correctly.

$ lha v The_Wall.lha
PERMSSN UID GID PACKED SIZE RATIO METHOD CRC STAMP NAME ---------- ----------- ------- ------- ------ ---------- ------------ ------------- [generic] 65803 107870 61.0% -lh5- 7c50 Nov 25 2002 The_Wall/mod.days of fury [generic] 66429 95176 69.7% -lh5- 5101 Nov 25 2002 The_Wall/mod.thunder-wall ---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total         2 files  132232  203046  65.1%            Aug 12 13:14

$ lha x The_Wall.lha
The_Wall/mod.days of fury    - Melted   :  oooooooooooooo
The_Wall/mod.thunder-wall    - Melted   :  oooooooooooo

From 24eac22c434aedfbe953db4aba001b5ec4e59445 Mon Sep 17 00:00:00 2001
From: Stuart Caie <ky...@kyzer.me.uk>
Date: Sat, 12 Aug 2017 15:25:09 +0100
Subject: [PATCH] Support Amiga LhA files

---
 debian/patches/04_AmigaLhA.patch | 10 ++++++++++
 debian/patches/series            |  1 +
 2 files changed, 11 insertions(+)
 create mode 100644 debian/patches/04_AmigaLhA.patch

diff --git a/debian/patches/04_AmigaLhA.patch b/debian/patches/04_AmigaLhA.patch
new file mode 100644
index 0000000..4162001
--- /dev/null
+++ b/debian/patches/04_AmigaLhA.patch
@@ -0,0 +1,10 @@
+--- jp/gr/java_conf/dangan/util/lha/LhaHeader.java	2005-05-03 08:50:30.000000000 +0100
++++ jp/gr/java_conf/dangan/util/lha/LhaHeader.java	2017-08-12 15:14:05.465109915 +0100
+@@ -919,6 +919,7 @@
+         this.HeaderLevel    = HeaderData[ HeaderLevelIndex ] & 0xFF;
+         this.Path           = new String( HeaderData, PathIndex, PathLength, encode );    //After Java 1.1 throw IndexOutOfBoundsException
+         this.Path           = this.Path.replace( '\\', File.separatorChar );
++        this.Path           = this.Path.split("\0")[0]; // Amiga LhA adds filenote to path after a null byte
+ 
+         if( CRCIndex + 2 <= HeaderSize ){
+             this.CRC = LittleEndian.readShort( HeaderData, CRCIndex );          //throw ArrayIndexOutOfBoundsException
diff --git a/debian/patches/series b/debian/patches/series
index 6503cc2..0eb42a5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 01_AntBuildfiles.patch
 02_AccessingClassField.patch
 03_DateDeprecation.patch
+04_AmigaLhA.patch
-- 
2.7.4

Reply via email to