-
Notifications
You must be signed in to change notification settings - Fork 656
BREAKING(tar/unstable): fix handling of mode, uid, and gid #6440
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6440 +/- ##
==========================================
- Coverage 95.98% 95.98% -0.01%
==========================================
Files 564 564
Lines 42482 42476 -6
Branches 6394 6391 -3
==========================================
- Hits 40775 40769 -6
Misses 1668 1668
Partials 39 39 ☔ View full report in Codecov by Sentry. |
options.uid.toString(8).padStart(6, "0") + " \0" + //uid | ||
options.gid.toString(8).padStart(6, "0") + " \0" + // gid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this in #6376, but I don't think UID and GID are generally handled as octals. See docs of Deno.chown
for example. https://docs.deno.com/api/deno/~/Deno.chown
Can we do these changes only for 'mode'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can but the spec is only expecting octal digits to be written
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that this change should be done for UID and GID as well. Currently, to set the UID to, for example, 501, the user would have to write uid: 765
(the octal representation of 501 disguised as a decimal literal), which doesn't make sense to me.
import { TarStream, type TarStreamInput } from "jsr:@std/[email protected]/tar-stream";
const file = new Blob(["hello world\n"]);
await ReadableStream.from<TarStreamInput>([
{
type: "file",
path: "hello.txt",
size: file.size,
readable: file.stream(),
options: { uid: 765, gid: 24, mtime: 0 },
},
])
.pipeThrough(new TarStream())
.pipeTo(Deno.stdout.writable);
$ deno run a.ts | tar tv
-rw-r--r-- 0 501 20 12 Jan 1 1970 hello.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0f-0b Ah, ok. That sounds correct. This part needs to be encoded in octals. Thanks for pointing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the fix!
…no_std into feat/fs-unstable-remove-api * 'feat/fs-unstable-remove-api' of github.com:eryue0220/deno_std: test(fs/unstable): remove windows specific paths and fix ci (denoland#6448) BREAKING(tar/unstable): fix handling of mode, uid, and gid (denoland#6440)
Closes: #6376
This pull request makes the changes discussed in the other linked pull request.
It changes mode, uid, and gid to accept and decode numbers in the octal format
0o775
instead of decimal format775
. It also changes slightly the decoding segment of these three to be more compatible with other tar specs.