Ticket #3433: mc-3433-extfs-uzip-adjust-abnormal-directory-permission.patch

File mc-3433-extfs-uzip-adjust-abnormal-directory-permission.patch, 1.3 KB (added by and, 8 years ago)
  • src/vfs/extfs/helpers/uzip.in

    From 217b49de8a418ea13d88ac844543cb1cdafc9d2f Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Fri, 8 Jan 2016 22:11:21 +0000
    Subject: [PATCH] #3433 extfs/uzip adjust abnormal directory permission
    
    unzip 6.0 source reveal that unzip depends on filename and less on given zip object attribute
    
    zipinfo can show something like
        Unix file attributes (177777 octal):            ?rwsrwsrwt
    but unzip handle this object as directory if filename ended on '/'
    
    in this case adjust permission string for reasonable extfs handling
    for all other cases uzip remain conservative and relay on proper permission
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/vfs/extfs/helpers/uzip.in | 4 ++++
     1 file changed, 4 insertions(+)
    
    diff --git a/src/vfs/extfs/helpers/uzip.in b/src/vfs/extfs/helpers/uzip.in
    index 9492f2f..a3dde3d 100644
    a b sub print_file { 
    341341        if ($platform ne 'unx') { 
    342342                $perms = ($filename =~ /\/$/ ? 'drwxr-xr-x' : '-rw-r--r--'); 
    343343        } 
     344        # adjust abnormal perms on directory 
     345        if ($platform eq 'unx' && $filename =~ /\/$/ && $perms =~ /^\?(.*)$/) { 
     346                $perms = 'd'.$1; 
     347        } 
    344348        printf "%-10s    1 %-8d %-8d %8s %s/%s/%s %s:%s:%s %s", $perms, $<, 
    345349                $(, $realsize, $mon, $day, $year, $hours, $mins, $secs, $filename; 
    346350        if ($platform eq 'unx' && $perms =~ /^l/) {