python / python/cpython

zippapp/ macOS: .DS_Store files should be excluded from the generated archives

未关闭
#117,829 16 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

OS-mac stdlib type-feature
主要语言
Python
星标
77.2k
派生
36k
PR 合并指标
PR 指标待抓取

描述

Bug report

Bug description:

When generating a zipapp under macOS then random ".DS_Store" files get included into the generated archive.

e.g.

$ python3.12 -m zipapp --output cfv.pyz --compress --python /usr/local/bin/python3 zipapptempdir
$ unzip -l cfv.pyz 
Archive:  cfv.pyz 
  Length      Date    Time    Name
---------  ---------- -----   ----
     6148  04-13-2024 00:17   .DS_Store
      186  04-13-2024 00:20   __main__.py
        0  04-13-2024 00:17   cfv/
     6148  04-13-2024 00:17   cfv/.DS_Store
        …
---------                     -------
   137783                     20 files

Those files quickly get regenerated by Finder, so it's hard to entirely avoid them getting added to the archive by trying to pre-delete them before executing zipapp. .DS_Store files can add significantly to the size of the archive, possible have privacy implications (e.g. leaked spotlight comments), and serve zero purpose for the python app.

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Linked PRs
  • gh-120537

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从报告中显示的 python3.12 -m zipapp 命令开始,并使用包含 .DS_Store 文件的临时应用目录在 macOS 上复现该问题。生成的归档不再包含这些文件即表示完成;按照所示方式使用 unzip -l 检查归档内容。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
cli
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。