Linux HOWTOs

About | Home | Search

HOWTO: lha
Description: Uncompresses and compresses .lha packages
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything

# lha 1.14i
# =========
# Slackware 8.1 and up (including current) originally included the original
# 1.14i version of lha, and now include a patched 1.14i (see below).

# If you're using Slackware and you haven't already upgraded things in your
# original 'bin' package, the easiest thing to do would be to grab the latest
# 'bin' package from for your version
# of slackware and run 'upgradepkg ./bin-*.tgz' to upgrade it.

# The home page link above will take you to the home page for this version.
# There is also a version 1.17 available here, but it is vulnerable to the
# security problems that are fixed by the patch to the 1.14i version.
# The 1.17 version is the one that is listed on

# lha is part of Slackware's 'bin' package.  Run this to remove the old
# lha and to clean up (remove lha from) the 'bin' package's package file:
FNAME=`find /var/adm/packages/bin* -type f | head -1`
egrep -q "^usr/bin/lha$" $FNAME && (
  rm -f /usr/bin/lha
  cat $FNAME | grep -v "^usr/bin/lha$" > ${FNAME}.new
  test -s ${FNAME}.new &&
   mkdir -p -m 0700 ~/backup/packages
   mv -f $FNAME ${FNAME}.`date +%Y%m%d`
   mv ${FNAME}.`date +%Y%m%d` ~/backup/packages/
   mv -f ${FNAME}.new $FNAME
unset FNAME

test -f installed/lha-114i.tar.gz && mv installed/lha-114i.tar.gz .
test ! -f lha-114i.tar.gz &&
cd /usr/local/src
find -type d -maxdepth 1 -name "lha-*" -exec rm -r {} \;
tar xzvf ~/lha-114i.tar.gz
cd lha-114i
chown -R root.root .

# Apply this patch to fix the buffer overflows and directory traversal
# problems referred to here:
cd src
wget -nc &&
 patch -p0 < lha.patch
cd ..

# You can use 'make install BINDIR=/usr/bin MANDIR=/usr/man' if you like
# below (instead of 'install -s ...'), but it will install a man page in
# Japanese that you probably can't read.

install -s src/lha /usr/bin/
mkdir -p -m 0700 installed
rm -f installed/lha-*.tar.*
mv lha-114i.tar.gz installed/

Back to the list

Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>