English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 25 March 2021, 21:22   #1
Loki762
Registered User
 
Join Date: Apr 2020
Location: Denmark
Posts: 56
Extracting LHA files on Linux gives a "stack smashing detected"

I am trying to automate the process, when I have downloaded the WHDLoad games from Grandis and then to build a complete set of games with Arcade Game Selector 2 menu. When it works then this is king (in my opinion) :-)

The problem I have currently is a simple thing like unpacking the LHA files on my CentOS Linux server.
The most files can be unpacked without any problems but there are also quite a few files that give an error.

E.g. the file Assassin_v1.2a_1214.lha.

if I unpack this file with lha x Assassin_v1.2a_1214.lha then I get this error:

Code:
[root@srv b]# lha xw=b Assassin_v1.2a_1214.lha 
b/Assassin.info - Melted   :  o
b/Assassin/Assassin.info        - Melted   :  oo
b/Assassin/Assassin.slave       - Melted   :  o
b/Assassin/Disk.1       - Melting  :  ooooooooooooooooooooooooooooooo*** stack smashing detected ***: lha terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x7f3223f7c697]
/lib64/libc.so.6(+0x118652)[0x7f3223f7c652]
lha[0x40a0eb]
lha[0x409887]
lha[0x40b3fe]
lha[0x408aee]
lha[0x405a96]
lha[0x401f4d]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f3223e86555]
lha[0x402189]
======= Memory map: ========
00400000-00410000 r-xp 00000000 fd:01 547439722                          /usr/bin/lha
0060f000-00610000 r--p 0000f000 fd:01 547439722                          /usr/bin/lha
00610000-00611000 rw-p 00010000 fd:01 547439722                          /usr/bin/lha
00611000-00619000 rw-p 00000000 00:00 0 
00b82000-00ba3000 rw-p 00000000 00:00 0                                  [heap]
7f3223c4e000-7f3223c63000 r-xp 00000000 fd:01 1075268954                 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f3223c63000-7f3223e62000 ---p 00015000 fd:01 1075268954                 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f3223e62000-7f3223e63000 r--p 00014000 fd:01 1075268954                 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f3223e63000-7f3223e64000 rw-p 00015000 fd:01 1075268954                 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f3223e64000-7f3224028000 r-xp 00000000 fd:01 1084485150                 /usr/lib64/libc-2.17.so
7f3224028000-7f3224227000 ---p 001c4000 fd:01 1084485150                 /usr/lib64/libc-2.17.so
7f3224227000-7f322422b000 r--p 001c3000 fd:01 1084485150                 /usr/lib64/libc-2.17.so
7f322422b000-7f322422d000 rw-p 001c7000 fd:01 1084485150                 /usr/lib64/libc-2.17.so
7f322422d000-7f3224232000 rw-p 00000000 00:00 0 
7f3224232000-7f3224254000 r-xp 00000000 fd:01 1084485143                 /usr/lib64/ld-2.17.so
7f3224441000-7f3224444000 rw-p 00000000 00:00 0 
7f322444e000-7f3224453000 rw-p 00000000 00:00 0 
7f3224453000-7f3224454000 r--p 00021000 fd:01 1084485143                 /usr/lib64/ld-2.17.so
7f3224454000-7f3224455000 rw-p 00022000 fd:01 1084485143                 /usr/lib64/ld-2.17.so
7f3224455000-7f3224456000 rw-p 00000000 00:00 0 
7fff71ead000-7fff71ece000 rw-p 00000000 00:00 0                          [stack]
7fff71ed7000-7fff71ed9000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted
Also for this file AdventureConstructionSet_v1.1_NTSC_0904 I get this problem, where it sems to threat two empty files as directories:

Code:
Unpacking to [/amiga/WHDLoad/Games/A/AdventureConstructionSet_v1.1_NTSC_0904]
LHa: Error: Cannot extract /amiga/WHDLoad/Games/Games/A/AdventureConstructionSet_v1.1_NTSC_0904/AdvConstructionSetNTSC/data/userdata0/l/: Is a directory
LHa: Error: Cannot extract /amiga/WHDLoad/Games/Games/A/AdventureConstructionSet_v1.1_NTSC_0904/AdvConstructionSetNTSC/data/userdata1/l/: Is a directory
I am using this LHA version:

Code:
[root@srv]# lha --version
lha for unix version 1.14g
As such I don't care too much about these games and if there vould be a possibility to react on these errors and then exclude the games that fails, then this would be fully fine also.

An alternative way would be for me to use 7ZIP on Windows and manually process each subdirectory. This works but it is veeery borring and tedious ;-)

Does any one have an idea?
Loki762 is offline  
Old 25 March 2021, 21:29   #2
Exodous
Registered User
 
Join Date: Sep 2019
Location: Leicester / England
Posts: 201
If you've enabled EPEL, you can install p7zip with:

yum install p7zip

This gives you the 7z command line tool.

If you've not setup EPEL, take a look here: https://fedoraproject.org/wiki/EPEL
Exodous is offline  
Old 25 March 2021, 21:39   #3
Loki762
Registered User
 
Join Date: Apr 2020
Location: Denmark
Posts: 56
I already tried the p7zip (actually it is "7za" when installed) but it cannot handle the LHA format:

Code:
[root@srv]# 7za x Assassin_v1.2a_1214.lha 

7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_DK.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz (40651),ASM,AES-NI)

Scanning the drive for archives:
1 file, 737280 bytes (720 KiB)

Extracting archive: Assassin_v1.2a_1214.lha
ERROR: Assassin_v1.2a_1214.lha
Can not open the file as archive
Loki762 is offline  
Old 25 March 2021, 22:45   #4
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,186
Amiga uses custom metadata that Linux isn't aware of. For example there are custom flags in the filesystem.
Samurai_Crow is offline  
Old 26 March 2021, 09:18   #5
Loki762
Registered User
 
Join Date: Apr 2020
Location: Denmark
Posts: 56
Quote:
Originally Posted by Samurai_Crow View Post
Amiga uses custom metadata that Linux isn't aware of. For example there are custom flags in the filesystem.
Hmm... okay, I see. Are there any better ways to automate this then? I cannot do this from my Amiga as it does not have that kind of storage nor access to any network. Is there a possibility to do this on a Windows or Linux system at all?

My thoigh-process is - collect the up2date collection from Grandis. Unpack it and transfer it to my Amiga via PCMCIA CF.
Loki762 is offline  
Old 26 March 2021, 21:15   #6
Exodous
Registered User
 
Join Date: Sep 2019
Location: Leicester / England
Posts: 201
I have a CentOS 8 box with EPEL configured and p7zip installed and I have both 7z and 7za in /usr/bin.

Code:
$ 7z

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
Code:
$ ls -l /usr/bin/7z*
-rwxr-xr-x. 1 root root 40 Aug 15  2019 /usr/bin/7z
-rwxr-xr-x. 1 root root 41 Aug 15  2019 /usr/bin/7za
They are both scripts that call /usr/libexec/p7zip/7z and /usr/libexec/p7zip/7za respectively.

Code:
$ cat /usr/bin/7z
#! /bin/sh
"/usr/libexec/p7zip/7z" "$@"

$ cat /usr/bin/7za
#! /bin/sh
"/usr/libexec/p7zip/7za" "$@"
Code:
$ ls -l /usr/libexec/p7zip
total 6016
-rwxr-xr-x. 1 root root  701400 Aug 15  2019 7z
-rwxr-xr-x. 1 root root 1781728 Aug 15  2019 7za
-rwxr-xr-x. 1 root root  581280 Aug 15  2019 7zCon.sfx
-rwxr-xr-x. 1 root root 3088888 Aug 15  2019 7z.so
If I run "7z x file.lha" it works.

If I run "7za x file.lha" it fails with the same error you're seeing.
Exodous is offline  
Old 27 March 2021, 11:50   #7
Tomislav
Registered User
 
Join Date: Aug 2014
Location: Zagreb / Croatia
Posts: 302
Why not to unpack on Amiga side (real or emulated)? You won't have problems and attributes would be preserved. Also you can automate on Amiga side, too.
Tomislav is offline  
Old 28 March 2021, 12:48   #8
Loki762
Registered User
 
Join Date: Apr 2020
Location: Denmark
Posts: 56
Quote:
Originally Posted by Exodous View Post
If I run "7z x file.lha" it works.
If I run "7za x file.lha" it fails with the same error you're seeing.
I am using CentOS 7 and I am not sure if this is the case but "7z" is not avaiable to me when installing the "p7zip". However from this page, https://gist.github.com/P7h/9fcccc54...128dec6f6cf78d, I noticed I could install a plugin for it:

Code:
rpm -U --quiet p7zip-plugins-16.02-10.el7.x86_64.rpm
This now works for me also and I can unpack the LHA files correctly on my Linux - well, I know of the attribute problem, and probably not all games will work but I hope it will be the fewest not working and the most working and this is for now fine with me :-)
Loki762 is offline  
Old 18 November 2021, 12:24   #9
svin83
Meditating Guru
 
Join Date: Aug 2013
Location: Trondheim / Norway
Posts: 32
Ihasa vs lha for Unix (non-free)

I have seen these errors when the package named lhasa was installed instead of the original lha package.

lhasa is an open source recreation of (the non-free) lha for Unix. To us Amiga users lhasa is a bit limited in comparison to lha.
  • read/extract only, no archive creation or modification.
  • Some of the old compression schemes are not supported. (-lh2-, -lh3-, -pm1-, -lx1-, -lhx-)

Since the non-free version was available in my distro's repositories, i simply uninstalled lhasa and then installed the non-free version to fix the problem with extracting older lha files.

NOTE:
IF the lha-archive contains files named with international characters, and your shell's charset encoding is incompatible with the one on the Amiga, then those filenames may erroneously be interpreted as invalid/non-printable/garbled characters or worse (escape/command sequences etc.). This can lead to problems while extracting or potentially corrupt your FS/partition (depends on fs driver etc.).(ps: unicode is usually not compatible)

NOTE2:
There may also be Amiga specific filesystem flags set for one or more files in lha-archives. These flags may be important if you intend to use the extracted files on your Amiga. They will not be preserved by other (non Amiga) OSes/filesystems.


The safest bet is to extract lha files to an FFS partition using an Amiga (or emulation).

Enable FFS international support when formatting partitions for better compatibility with non-english filenames.
svin83 is offline  
Old 18 November 2021, 13:43   #10
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Luckily until now I had no problems with lhasa on Raspbian if I remember correct. Most lha archives are -lh5. No lha here in the repository but jlha-utils but never tried it.

Usually I only extract lha archives to ramdisk for temporary use. Of course protection bits and comments are lost. That is obvious because different filesystems are usually not compatible to each other.

Of course you can also use SFS or PFS on Amiga not only FFS. And the ramdisk should always work too.
daxb is offline  
Old 09 December 2021, 10:47   #11
svin83
Meditating Guru
 
Join Date: Aug 2013
Location: Trondheim / Norway
Posts: 32
lha is in the non-free source repository for raspbian
svin83 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting .lha files RetrogamerRhys support.Apps 4 28 February 2020 21:53
A500 Green Screen. DiagROM says: "raster: NOT DETECTED" retrofriends support.Hardware 12 18 January 2020 04:04
"Not enough RAM detected"?/"Inappropriate configuration found"? stevsurv Retrogaming General Discussion 15 04 October 2012 21:26
"Stack overflow": any way to solve that problem? Paulisse New to Emulation or Amiga scene 10 27 January 2008 13:45
Can I "install" the Poseidon USB stack on a KICKFLASH OS4 ??? keropi support.Hardware 8 21 June 2006 16:01

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:41.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11254 seconds with 15 queries