Skip to content

Bad parse of entryTarPath #35

Closed
Closed

Description

@brandon-leapyear

When extracting postgresql 9.6.9, there's a failure:

pgsql/pgAdmin 4/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/: openBinaryFile: inappropriate type (Is a directory)

After some inspection in GHCi, I found

ghci> entries <- Tar.read . GZip.decompress =<< BS.readFile "..."
ghci> let entries' = Tar.foldEntries (:) [] (const []) entries
ghci> let path = "pgsql/pgAdmin 4/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/"
ghci> length $ filter ((== path) . Tar.entryPath) entries'
8

In other words, there are 8 Entry objects with the same path as their directory. I suspect there's a bug that doesn't parse or concatenate the TarPath name/prefix correctly.

Activity

  1. hasufell commented on Apr 2, 2021

    @hasufell
    Member

    There are two issues here:

    1. the paths you are referring to are over-long, see Add support for over-long filepaths via GNU extension and fix hardlinks #50
    2. There seem to be more errors due to symlinks that are handled incorrectly, when a symlink points to a directory (as opposed to a file). tar emulates symlinks and just copies them. This will fail for directories:
      emulateLinks = mapM_ $ \(relPath, relLinkTarget) ->
      let absPath = baseDir </> relPath
      absTarget = FilePath.Native.takeDirectory absPath </> relLinkTarget
      in copyFile absTarget absPath
      ...a patch is in the same PR as above: 499db33

    So, with the above PR, I can unpack said tarball.

  2. added 2 commits that reference this issue on Apr 2, 2021
    499db33
    bd98703
  3. added 8 commits that reference this issue on Nov 15, 2023
    47e4d95
    087d02a
    565b895
    cdcd330
    ad2a8e7
    19dbede
    91b110f
    899cbda
  4. added a commit that references this issue on Jul 17, 2024
    911f74f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions