Ticket #44: u7z.patch

File u7z.patch, 1.8 KB (added by slavazanko, 11 years ago)

added by sgh

  • vfs/extfs/u7z

    diff -Naur mc.old/vfs/extfs/u7z mc/vfs/extfs/u7z
    old new  
    22# 
    33# extfs support for p7zip 
    44# Written by Pavel Roskin <proski@gnu.org> 
     5# Some Bugfixes/workarounds by Sergiy Niskorodov <sgh@mail.zp.ua> 
    56# Licensed under GNU GPL version 2 or later version. 
    67 
    7 P7ZIP=7za 
     8P7ZIP=`which 7z` || \ 
     9P7ZIP=`which 7za` 
    810 
    911mcu7zip_list () 
    1012{ 
     
    1921 
    2022mcu7zip_copyout () 
    2123{ 
    22         $P7ZIP e -so "$1" "$2" > "$3" 2>/dev/null 
     24        #first we check if we have old p7zip archive with prefix ./ in filename 
     25        $P7ZIP l "$1" "$2" | grep -q "0 files" && \ 
     26        EXFNAME=*./"$2" || EXFNAME="$2" 
     27        $P7ZIP e -so "$1" "$EXFNAME" > "$3" 2>/dev/null 
    2328} 
    2429 
    2530mcu7zip_copyin () 
     
    3136{ 
    3237        dir=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-u7z.XXXXXX"` || exit 1 
    3338        mkdir -p "$dir"/"$2" 
    34         $P7ZIP a -w"$dir" "$1" "$2" >/dev/null 2>&1 
     39        $P7ZIP a -w"$dir" "$1" "$dir"/"$2" >/dev/null 2>&1 
    3540        rm -rf "$dir" 
    3641} 
    3742 
    3843mcu7zip_rm () 
    3944{ 
    4045        # NOTE: Version 4.20 fails to delete files in subdirectories 
    41         $P7ZIP d "$1" "$2" >/dev/null 2>&1 
     46        #first we check if we have old p7zip archive with prefix ./ in filename 
     47        $P7ZIP l "$1" "$2" | grep -q "0 files" && \ 
     48        EXFNAME=*./"$2" || EXFNAME="$2" 
     49        $P7ZIP d "$1" "$EXFNAME" 2>&1 | grep -q E_NOTIMPL &> /dev/null && \ 
     50        { echo -e "Function not implemented...\n7z cannot delete from solid archive." >&2 ; exit 1 ; } 
    4251} 
    4352 
    4453mcu7zip_rmdir () 
    4554{ 
    46         $P7ZIP d "$1" "$2"/ >/dev/null 2>&1 
     55        #first we check if we have old p7zip archive with prefix ./ in filename 
     56        $P7ZIP l "$1" "$2" | grep -q "0 files" && \ 
     57        EXFNAME=*./"$2" || EXFNAME="$2" 
     58        $P7ZIP d "$1" "$EXFNAME"/ 2>&1 | grep -q E_NOTIMPL &> /dev/null && \ 
     59        { echo -e "Function not implemented...\n7z cannot delete from solid archive." >&2 ; exit 1 ; } 
    4760} 
    4861 
    4962# override any locale for dates