Skip to content

Bug: Smart extracting a .tar file with "." as the only directory in root is not properly handled #18035

@A-Loot

Description

@A-Loot

Description

When smart extracting a .tar file with "." as the only directory in root, Files recognizes the tar as having only one directory in root, resulting in smart extract performing "Extract here". Since "." is just a link to the current directory, extracting "." to the current directory actually extracts the contents of "." into the current directory.

The fix for this should be pretty simple. When performing a smart extract, check not just if there is only one file or directory in root, but also if that directory is ".". If that is the case, perform the "one file or directory" check again to decide if to "Extract here" or "Extract to archive\". (I'm not sure if "." inside "." is possible, but maybe you should also account for that.)

Technically this also applies to "Extract here", but I think in that case the current behavior makes sense, since having "." as the root directory is pretty much the same thing as having the contents of "." in the root directory, except that in the first case you are able to specify posix directory metadata like privileges.

Btw.: While I don't have the time right now to test this, you should ensure that your extraction library properly handles ".." directories, which are also valid in .tar, as far as I know.

Steps To Reproduce

  1. create a .tar archive with "." as the only root directory. e.g. in linux bash: "tar --exclude=archive.tar -cf archive.tar ."
  2. copy the file to the windows file system
  3. unpack the file using "Extract here (Smart)"

Files Version

4.0.24.0

Windows Version

10.0.26200.7462

User ID

e96f2327-3332-4abc-ad0f-6299985c1aaa

Log File

debug.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    area - archivesFeatures or bug reports relating to archives

    Type

    Projects

    Status

    🏗 In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions