python / python/cpython

Enable for ZipFile to specify to create archives of arbitrary windows FAT or Unix filesystem

Đang mở
#133,667 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

stdlib type-feature
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Feature or enhancement

Proposal:

Hi, as dev working with app designed for both Windows, Mac and Linux systems, I had recently automating with ZipFile task of repacking some internal ZIP archives. To automate the task even more, I created formulas for each of systems to be available on single script, on single call (and so on one machine) to create packages easier.

Unfortunately generated tasks were faulty,
I noticed, that same script performed on Linux or Windows created archives of different types - FAT or UNX, therefore output files were seen as invalid on opposite system.

To make the picture, my flow was:
start on particular OS (either Windows or Linux) ==> download archive from web (fixed format, UNX or FAT) ==> unpacking archive ==> creating new archive from files from previous ==> resulting archive has format from OS, overriding input archive (while I need the exact opposite)

Could I ask You to add possibility from code to enforce archiving files by chosen system , for instance like a compression method (like I chose LZMA), like I suggest below ? Or maybe if it is dependent on the format of the not yet archived input , could a similar flag enforce unpacking file in chosen filesystem , not being dependent on the used machine and OS?
I also provide some output from zipinfo console utility.

I attach some links that hopefully might present the issue,
https://en.wikipedia.org/wiki/FAT_filesystem_and_Linux
https://forensics.wiki/zip/#external-file-attributes

Best regards and have a good day, also feel free to contact me for more info, Wiktor

class zipfile.ZipFile(file, filesystem='FAT/UNX', ...
ZipFile.write(filename, filesystem='FAT/UNX', ...

class zipfile.ZipFile(file, filesystem='FAT/UNX', ... 
ZipFile.write(filename, filesystem='FAT/UNX', ...

packed on Windows

zipinfo ~/Downloads/win7.1.5_sandbox.zip
Archive: win7.1.5_sandbox.zip
Zip file size: 47379022 bytes, number of entries: 92
drwx--- 6.3 fat 0 bx stor 25-Mar-12 11:41 Debug/
....
-rwx--- 6.3 fat 20554528 bx lzma 25-Mar-11 16:17 someWinApp.exe
....
-rwx--- 6.3 fat 422168 bx lzma 25-Mar-11 16:18 someWinApp2.exe
92 files, 205285623 bytes uncompressed, 47362726 bytes compressed: 76.9%

packed on Mac

zipinfo ~/Downloads/mac7.1.4_sandbox.zip
Archive: mac7.1.4_sandbox.zip
Zip file size: 93026056 bytes, number of entries: 160
drwxr-xr-x 6.3 unx 0 bx stor 25-Feb-14 01:00 .package/
drwxr-xr-x 6.3 unx 0 bx stor 25-Feb-14 00:59 RuntimeRoots/
-rwxr-xr-x 6.3 unx 25375808 bx lzma 25-Feb-14 01:00 someApp
...
-rwxr-xr-x 6.3 unx 11167424 bx lzma 25-Feb-14 01:00 someApp2
....
-rwxr-xr-x 6.3 unx 2053072 bx someApp3
-rw-r--r-- 6.3 unx 4315 bx lzma 25-Feb-10 09:30 headerfile.h
160 files, 409689641 bytes uncompressed, 92994544 bytes compressed: 77.3%

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với các entry point zipfile.ZipFile và ZipFile.write được nêu trong đề xuất, sau đó lần theo cách siêu dữ liệu hệ thống tệp được gán khi các tệp lưu trữ được tạo trên Windows, Mac và Linux. Công việc được hoàn tất khi API có thể áp đặt siêu dữ liệu tệp lưu trữ FAT hoặc Unix được yêu cầu một cách độc lập với hệ điều hành máy chủ, với hành vi được các test liên quan bao phủ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
operating-systems, tooling
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.