From c0d8ea01b9a85debe9b317978aacbdca6ed164bb Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Fri, 23 Feb 2001 07:26:30 +0000 Subject: [PATCH] * extfs/uzip.in (mczipfs_list): Don't check zipinfo support on the real file - check usage info instead. Use more robust checks for valid lines. Suppress stderr from unzip. Workaround for jar files - fix mode for files ending with slash. --- vfs/ChangeLog | 7 +++++++ vfs/extfs/uzip.in | 42 +++++++++++++++++------------------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 756b210b4..c423b997d 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,10 @@ +2001-02-23 Pavel Roskin + + * extfs/uzip.in (mczipfs_list): Don't check zipinfo support on + the real file - check usage info instead. Use more robust checks + for valid lines. Suppress stderr from unzip. Workaround for jar + files - fix mode for files ending with slash. + 2001-02-20 Pavel Roskin * vfs.h: Include sys/timeb.h if it's present. Include time.h and diff --git a/vfs/extfs/uzip.in b/vfs/extfs/uzip.in index 343b659fc..d2b3357a7 100644 --- a/vfs/extfs/uzip.in +++ b/vfs/extfs/uzip.in @@ -12,19 +12,16 @@ XZIP="$DZIP/zip -g" XDZIP="$DZIP/zip -d" XUNZIP="$DZIP/unzip" XZIPINFO="$DZIP/unzip -Z" -# -#If you don't have zipinfo, set ZIPINFO= -# mczipfs_list () { -DOZIPINFO=no -if test -n "$XZIPINFO"; then - DOZIPINFO= - $XZIPINFO -l "$1" | @AWK@ -v uid=${UID-0} -v zipfile="$1" -v xunzip=${XUNZIP-unzip} ' -/^Archive/ { next } -/^[0-9]*\ file/ { next } -/(unx|fat|ntf)/ { +# Try zipinfo if available, fallback to unzip. +if $XZIPINFO 2>&1 | grep ZipInfo >/dev/null; then + $XZIPINFO -l "$1" 2>/dev/null | \ + @AWK@ -v uid=${UID-0} -v zipfile="$1" -v xunzip=$XUNZIP ' +# Zipinfo prints errors on stdout. Check mode and time to skip them. +/^[^a-z\-]/ { next } +($9 ~ /:/) { split($0,a,":") nam = substr(a[2],4) if ($1 ~ /^l/ ) { @@ -37,11 +34,16 @@ if ($1 ~ /^l/ ) { linkname="" } +# If mode is not UNIX-compatible, take first 4 characters. if (length($1) != 10) mode=substr($1, 1, 4) "------" else mode=$1 +# Workaround for jar files - files ending with / are directories. +if ($0 ~ /\/$/) + sub(/^./, "d", mode) + if (nam ~ /^\^/) nam=substr(nam, 2) split($8, a, "-") @@ -51,22 +53,12 @@ else a[3] = 1900 + a[3] printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s%s%s\n", mode, uid, 0, $4, a[2], a[1], a[3], $9, nam, arrow, linkname next -} -{ -exit 214 }' 2>/dev/null - if test $? = 214; then - DOZIPINFO=no - fi -fi -if test -n "$DOZIPINFO"; then - $XUNZIP -v "$1" | @AWK@ -v uid=${UID-0} ' -BEGIN { hyphens=0 } -/^Archive/ { next } -/^\ Length/ { next } -/^\ ?------/ { if (hyphens > 0) exit 0; hyphens=1; next } -{ -if (hyphens < 1) next; +else + $XUNZIP -v "$1" 2>/dev/null | @AWK@ -v uid=${UID-0} ' +# Not sure about portability of unzip -qq. +# Check ratio to eliminate all but valid entries. +($4 ~ /%$/) { if ($8 ~ /^\^/) $8=substr($8, 2) ## Y2K patch. if Year>=2000, unzip returns Year>=100