Binary release tarfile contains ./
Description
The released binary tar contains a ./ directory:
$ tar tvf jj-v0.29.0-aarch64-unknown-linux-musl.tar.gz
drwxr-xr-x runner/docker 0 2025-05-07 19:38 ./
-rwxr-xr-x runner/docker 28212968 2025-05-07 19:38 ./jj
-rw-r--r-- runner/docker 17771 2025-05-07 19:38 ./README.md
-rw-r--r-- runner/docker 11358 2025-05-07 19:38 ./LICENSE
Unpacking it can possibly change the permissions of the current directory.
E.g., if unpacking as root in /tmp, it will reset /tmp permission to 0755, which has strange effects.
Please either remove that entry in the tarfile, or put everything in a new toplevel directory in the tarfile.
cc @thoughtpolice who did the last release
https://github.com/jj-vcs/jj/blob/1194b94e51155f7955be16dfbc8c972f0672be2c/.github/workflows/release.yml#L70 is the culprit if I had to guess. I'll look into testing a fix soon-ish.
Problem still present in 0.33:
$ tar tvf jj-v0.33.0-x86_64-unknown-linux-musl.tar.gz
drwxr-xr-x runner/docker 0 2025-09-04 06:53 ./
-rw-r--r-- runner/docker 17683 2025-09-04 06:53 ./README.md
-rw-r--r-- runner/docker 11358 2025-09-04 06:53 ./LICENSE
-rwxr-xr-x runner/docker 25154928 2025-09-04 06:53 ./jj
Can we please get that fixed? Still present in 0.34.
Thanks for the reminders!
I did some research, and tar seems crazy, at least if you want to use the same command on Mac and Linux. For GNU tar, ~~it seems we could use the --transform AKA --xform option~~. (Update: gtar cf ~/tmp/qq.tar --xform='s_^./__' . results in the ./ being stripped from all but one of the entries, but the ./ entry itself remains. 😛 ) I'm not 100% sure these work when compressing (the --strip-components option documented next to those did not work when compressing for me).
Update: I also tried tar c --exclude ./ ., but this excludes everything. Not sure how to exclude only the ./ entry.
In BSD tar, this option is called -s (which seems saner to me, but means something different for GNU).
To do this in a POSIX fashion, I know two ways:
- Use the
paxtool instead oftar. It has the-soption. It's POSIX, but is not installed by default on Linux, it seems. - Do
cd "$staging"; tar czf "$staging.tar.gz" $(ls -A). - Do
cd "$staging"; tar czf "$staging.tar.gz" *, since we don't have any hidden files.
In our case, I guess the last of these is probably best.
https://serverfault.com/questions/457480/tar-leading-period-slash/544900#544900
BTW, one reason this is going slowly is that we'd need to manually test whatever change we make, so that we don't mess up the next release. The fact that tar refuses to provide an obvious way to do this correctly doesn't help either. (Perhaps there's some incantation in the full GNU tar manual; the BSD man page contains tar -cf - . in the examples)
Update: Didn't find anything useful in the GNU tar manual, https://www.gnu.org/software/tar/manual/tar.html#transform is the closest but doesn't even mention that --xform actually works when compressing.
Update 2: Another fun reference. https://stackoverflow.com/questions/939982/how-do-i-tar-a-directory-of-files-and-folders-without-including-the-directory-it/39530409#39530409 I think ls -A | tar cf file.tar -T - is better, though.
Maybe I miss the point, but would the obvious solution not be to try to remove the ./ directory, but instead use a properly named top-level directory like jj-vcs-0.34?