emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

archive-mode lzh filename fiddling problems (patch)


From: Kevin Ryde
Subject: archive-mode lzh filename fiddling problems (patch)
Date: Sun, 15 Apr 2007 08:02:55 +1000
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

In tinkering with some lzh archives I noticed two apparent problems
with the filename downcasing done by archive-lzh-summarize.

First, on an archive created by the lha for unix program, a file with
an all uppercase name only produces an empty buffer when viewed.  Eg.

        echo hi >README
        lha a foo.lzh README
        emacs -Q foo.lzh
        Ret
        => empty buffer

where I hoped to see "hi".  Only upper case filenames seem affected,
you can see "Readme" or "readme" ok.

Second, on an archive file of "MS-DOS" type but with a mixed-case
name, viewing the member similarly produces an empty buffer.  I
noticed this on some downloaded self-extracting exes (which might come
from w32, if someone has that obscure system to try directly).  Eg.

        wget http://kanex.or.jp/history/BRO07.exe
        dd ibs=1 skip=30720 <BRO07.exe >BRO07.lzh
        emacs -Q BRO07.lzh
        Ret
        => empty buffer

where I hoped to see the price of chicken futures.  You can also
change the .exe to .lzh by adding something to the archive, if you
don't trust dd.  Eg.

        lha a BRO07.exe /etc/passwd
        => writes BRO07.lzh

Either way the .csv file in the archive isn't empty, you can see it
with the following.  (The contents are shift-jis, I don't think that
affects anything.)

        lha pq BRO07.lzh bro07.csv


I believe archive-lzh-summarize has to follow the lha program's
up/down casing, because that munged form is what it expects on the
command line when asked for an "lha pq" extract etc, as done by
archive-mode.  I get some joy from the change below.

For exercising the cases, lha for unix produces level 1 type U (unix)
archives, or with the g flag produces level 0 (generic, and upcase
names).  The broilers download above is level 2 type M (msdos) with
mixed case name.  And I tried some level 0 (generic) with mixed case
names from kanex which are no longer available for download.


2007-04-14  Kevin Ryde  <address@hidden>

        * arc-mode.el (archive-lzh-summarize): Two fixes to filename fiddling.

        Only apply the "downcase if all upcase" rule to OS-ID 0 "generic".
        This fixes extracting of upper case files like "README" from archives
        created on unix (such filenames should be left alone).

        Alwyas apply a downcase to OS-ID M "MSDOS".  This fixes extracting of
        mixed-case filenames from archives apparently created on w32 systems,
        eg. http://kanex.or.jp/history/BR07.exe (delete the first 30720 bytes
        of self-extracting code to make a .lzh).

Attachment: arc-mode.el.lzh-filename-fiddle.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]