Added -Ddebug build option
Re-added errors from settings xattr values
This commit is contained in:
+1
-6
@@ -11,12 +11,7 @@
|
||||
|
||||
"build": {
|
||||
"command": "zig",
|
||||
"args": [
|
||||
"build",
|
||||
"-Doptimize=Debug",
|
||||
"-Duse_c_libs=true",
|
||||
"-Dvalgrind=true",
|
||||
],
|
||||
"args": ["build", "-Duse_c_libs=true", "-Ddebug=true"],
|
||||
},
|
||||
|
||||
"program": "zig-out/bin/unsquashfs",
|
||||
|
||||
@@ -18,9 +18,9 @@ Instead of using Zig's standard library for decompression, use the system's C li
|
||||
|
||||
Enable compiling with LZO decompression support. The LZO library currently has some issues with Zig when imported so it's easier to just disable it by default. Only has an effect when using `-Duse_c_libs=true`.
|
||||
|
||||
> `-Dvalgrind=true`
|
||||
> `-Ddebug=true`
|
||||
|
||||
Just sets the valgrind build option.
|
||||
Sets various build options that make debugging easier. Specifically, debug optimization is forced, valgrind support is enabled, error tracing is enabled, stipping is disabled, and copmilation uses LLVM (this is due to some linking issues when on Debug optimization and is required for debugging tools such as `lldb`. In the future this may be removed from the debug flag).
|
||||
|
||||
> `-Dversion=0.0.0`
|
||||
|
||||
@@ -37,6 +37,8 @@ Most features are present except for the following:
|
||||
|
||||
This is some basic observation's I've made about this library's performance when compared to `unsquashfs`. Unless otherwise stated, most observations were made when extracting my test archive (which is fairly small and uses zstd compression) and with `--release=fast`.
|
||||
|
||||
Currently, my only performance checks are checking execution time, nothing deeper.
|
||||
|
||||
* Under ideal circumstances, my library is ~70% slower (.12s vs .20s).
|
||||
* Using Zig decompression libraries *significantly* increases decompression time by ~600%. Under ideal circumstances.
|
||||
* Performance improvements/regressions will be common. I'm still learning Zig.
|
||||
|
||||
@@ -3,7 +3,7 @@ const std = @import("std");
|
||||
pub fn build(b: *std.Build) !void {
|
||||
const use_c_libs_option = b.option(bool, "use_c_libs", "Use C versions of decompression libraries instead of the Zig standard library ones");
|
||||
const allow_lzo = b.option(bool, "allow_lzo", "Compile with lzo support");
|
||||
const valgrind = b.option(bool, "valgrind", "Compile with valgrind integration");
|
||||
const debug = b.option(bool, "debug", "Enable options to make debugging easier.");
|
||||
const version_string_option = b.option([]const u8, "version", "Version of the library/binary");
|
||||
|
||||
const zig_squashfs_options = b.addOptions();
|
||||
@@ -15,9 +15,11 @@ pub fn build(b: *std.Build) !void {
|
||||
const mod = b.addModule("zig_squashfs", .{
|
||||
.root_source_file = b.path("src/root.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.optimize = if (debug == true) .Debug else optimize,
|
||||
.link_libc = use_c_libs_option,
|
||||
.valgrind = valgrind,
|
||||
.valgrind = debug,
|
||||
.error_tracing = debug,
|
||||
.strip = if (debug == true) false else null,
|
||||
});
|
||||
mod.addOptions("config", zig_squashfs_options);
|
||||
if (use_c_libs_option == true) {
|
||||
@@ -41,23 +43,26 @@ pub fn build(b: *std.Build) !void {
|
||||
var exe_mod = b.createModule(.{
|
||||
.root_source_file = b.path("src/bin/unsquashfs.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.optimize = if (debug == true) .Debug else optimize,
|
||||
.link_libc = use_c_libs_option,
|
||||
.imports = &.{
|
||||
.{ .name = "zig_squashfs", .module = mod },
|
||||
},
|
||||
.valgrind = valgrind,
|
||||
.valgrind = debug,
|
||||
.error_tracing = debug,
|
||||
.strip = if (debug == true) false else null,
|
||||
});
|
||||
exe_mod.addOptions("config", unsquashfs_options);
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "unsquashfs",
|
||||
.root_module = exe_mod,
|
||||
// .use_llvm = true, This can be needed to properly debug
|
||||
.use_llvm = debug,
|
||||
});
|
||||
|
||||
const lib = b.addLibrary(.{
|
||||
.name = "squashfs",
|
||||
.root_module = mod,
|
||||
.use_llvm = debug,
|
||||
});
|
||||
|
||||
b.installArtifact(lib);
|
||||
|
||||
+2
-3
@@ -171,14 +171,13 @@ pub fn setMetadata(self: Inode, alloc: std.mem.Allocator, tables: *Tables, fil:
|
||||
const xattrs = try tables.xattr_table.get(alloc, idx);
|
||||
defer alloc.free(xattrs);
|
||||
for (xattrs) |kv| {
|
||||
const res = std.os.linux.fsetxattr(fil.handle, @ptrCast(kv.key), @ptrCast(kv.value), kv.value.len, 0);
|
||||
const res = std.os.linux.fsetxattr(fil.handle, kv.key, kv.value.ptr, kv.value.len, 0);
|
||||
alloc.free(kv.key);
|
||||
alloc.free(kv.value);
|
||||
if (res != 0) {
|
||||
if (options.verbose)
|
||||
options.verbose_writer.?.print("fsetxattr has result of: {}\n", .{res}) catch {};
|
||||
//TODO: Currently this seems a bit flakey, so we just ignore the result... for now.
|
||||
// return error.SetXattr;
|
||||
return error.SetXattr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user