Skip to content

extfs.d/uace cant handle files with spaces #4930

@JamesOlvertone

Description

@JamesOlvertone

Is there an existing issue for this?

  • I have searched the existing issues

Midnight Commander version and build configuration

GNU Midnight Commander 4.8.33

Operating system

Linux foo 6.14.0-36-generic #36-Ubuntu x86_64 GNU/Linux

Is this issue reproducible using the latest version of Midnight Commander?

  • I confirm the issue is still reproducible with the latest version of Midnight Commander

How to reproduce

Create a .ace that contains a file with a space in filename.

Expected behavior

E.g a file inside the archive has the name "A B C.txt",
that means it has three spaces in its name.

Actual behavior

The file name is shown as "A" bec. the spaces in awk are handled as colums that the uace-scipt does not handle.

Additional context

Here is a fix for extfs.d/uace:
only function mc_ace_fs_list() is affected:

mc_ace_fs_list()
{
    if [ "x$UID" = "x" ]; then
        UID=`id -ru 2>/dev/null`
        if [ "x$UID" = "x" ]; then
            UID=0
        fi
    fi
    $ACE_LIST "$1" | awk -v uid=$UID '
/%/ { 
  split($1,date,".")

  if (date[3] > 50)
    date[3]=date[3] + 1900
  else
    date[3]=date[3] + 2000

  # this is new code
  col2=$2  # we need this later, $2 will be eliminiated
  col4=$4  # we need this later  $4 will be eliminated
  $1=$2=$3=$4=$5="";   # this trick does this: $0 becomes the rest that means $6,$7,... if there is something
                       # if we have filename with spaces we use $0 for the wohle line that covers al colums

  # old: printf "-rw-r--r--   1 %-8d %-8d %8d %02d-%02d-%04d %s %s\n", uid, 0, $4, date[2], date[1], date[3], $2, $6
  printf "-rw-r--r--   1 %-8d %-8d %8d %02d-%02d-%04d %s %s\n", uid, 0, col4, date[2], date[1], date[3], col2, $0
}' 2>/dev/null
    exit 0
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageNeeds triage by maintainersprio: mediumHas the potential to affect progress

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions