Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archive target is unable to produce a ZIP file with no extension #21693

Open
lowvoltage opened this issue Nov 26, 2024 · 1 comment · May be fixed by #21694
Open

archive target is unable to produce a ZIP file with no extension #21693

lowvoltage opened this issue Nov 26, 2024 · 1 comment · May be fixed by #21694
Labels

Comments

@lowvoltage
Copy link
Contributor

Describe the bug
No ZIP-file is produced when package-ing an archive target with format="zip" and output_path with no extension.
Other packers and ZIPs with (any) extension seem to work fine.

❯ ls -l
total 24
-rw-r--r--  1 mitko  staff  153 Nov 23 20:12 BUILD
-rw-r--r--  1 mitko  staff   14 Nov 23 20:08 a.txt
-rw-r--r--  1 mitko  staff   36 Nov 23 20:08 pants.toml

❯ cat BUILD
file(
    name="file-a",
    source="a.txt",
)

archive(
    name="zip-of-a",
    files=[":file-a"],
    format="zip",
    output_path="with_no_ext",
)

❯ pants package //:zip-of-a
22:18:10.10 [INFO] Wrote dist/with_no_ext

❯ ls -l dist
total 0

Pants version
2.23.0; main

OS
macOS

Additional info
Seems to be caused by the zip-executable "conveniently" appending a .zip extension, when no extension is specified

@lowvoltage lowvoltage added the bug label Nov 26, 2024
@lowvoltage lowvoltage changed the title achive target is unable to produce a ZIP file with no extension archive target is unable to produce a ZIP file with no extension Nov 26, 2024
@lilatomic
Copy link
Contributor

Based on this line from the man page:

the .zip suffix is added automatically, unless the archive name contains a dot already; this allows the explicit specification of other suffixes

Probably, when zip appends ".zip" it doesn't match our output filter, so no file is collected. It works for files with a ".", because zip doesn't append ".zip" and it matches our expectation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants