-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Zig Version
0.12.0-dev.985+e44152e25
Steps to Reproduce and Observed Behavior
- You create a tar file using something like
tar -cvf test.tar exec
whereexec
is just a file. - Then using this code here:
const std = @import("std");
pub fn main() !void {
var file = try std.fs.cwd().openFile("test.tar", .{});
defer file.close();
const outdir = try std.fs.cwd().openDir(
"out",
.{},
);
try std.tar.pipeToFileSystem(
outdir,
file.reader(),
.{ .strip_components = 1, .mode_mode = .ignore },
);
}
you attempt to untar it.
Results in:
error: TarComponentsOutsideStrippedPrefix
/usr/zig/lib/std/tar.zig:344:13: 0x2224b5 in stripComponents (test)
return error.TarComponentsOutsideStrippedPrefix;
^
/usr/zig/lib/std/tar.zig:219:35: 0x226260 in pipeToFileSystem__anon_3834 (test)
const file_name = try stripComponents(unstripped_file_name, options.strip_components);
I found this when working on solving #17462
Expected Behavior
It unzips the single file as expected.
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.This issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.