镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

ZipFS has a syspath and ospath #528

Description

@tfeldmann

As discussed in #523, normally ZipFS should have no syspath and a NoSysPath exception should be raised.

>>> import fs
>>> x = fs.open_fs("zip://test.zip", create=True)
>>> x.getospath("/")
b'/var/folders/lt/sg8874fn2lz5y3wcphs91j440000gn/T/tmpvdg2plgy__ziptemp__/'
>>> x.getsyspath("/")
'/var/folders/lt/sg8874fn2lz5y3wcphs91j440000gn/T/tmpvdg2plgy__ziptemp__/'

Activity

  1. lurch commented on Mar 21, 2022

    @lurch
    Contributor

    Do you fancy submitting a suitable PR?

  2. tfeldmann commented on Mar 21, 2022

    @tfeldmann
    ContributorAuthor

    Sure, no problem.

  3. althonos commented on Mar 22, 2022

    @althonos
    Member

    Ah, okay, I see what i was talking about in #523, but I'm not entirely sure this current situation here is to be treated as a bug.

    When you open a Zip file, you get a ReadZipFS which doesn't have a syspath because files are decompressed on request. But when you create a new Zip file from scratch, you get a WriteZipFS, which is actually a simple wrapper around a temporary filesystem which will be compressed when closed.

    So if the temporary filesystem is a temp folder, it makes sense that you have a syspath. It also enables efficient copying / moving files that are going to be compressed. There will be no syspath in the event where you use a temporary filesystem in memory to prepare the archive:

    zip_fs = fs.zipfs.WriteZipFS("/tmp/test.zip", temp_fs="mem://")
  4. tfeldmann commented on Mar 22, 2022

    @tfeldmann
    ContributorAuthor

    I see! Then the question is what went wrong with ZipFS in my optimization tests. I'll try to reproduce it.

  5. tfeldmann commented on Mar 25, 2022

    @tfeldmann
    ContributorAuthor

    Closing this as a non-issue. ZipFS having a syspath when wrapping a temp filesystem is fine.

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