-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Refactor mtree_spec to vis encode filenames #795
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks! I'm excited to get this improvement in.
We are trying hard to make our bsdtar more hermetic (likely something like bazelbuild/bazel-central-registry#1662 with @dzbarsky )
so I'm pretty sad to regress that by assuming vis
is on the host machine.
We have a lot of users under nix or in a distroless/wolfi image that has a stripped down distro.
I'm also not clear why it's beneficial to encode into jsonl as a transport between starlark and the multi-line run_shell command - can't the latter read data from the struct directly?
Will discuss with @thesayyn at standup.
Sure. I intended this PR as a workable example that allows me to move forward, and possibly as a base for someone from your team to continue with. Maybe include go-mtree as a dependency and build/distribute pre-built binaries? Alternatively, a simple but dedicated C/C++ program using libarchive that gets built for the target architecture?
Yeah there certainly many possible ways to pass the information into a separate subprocess that generates the final mtree output. I also wasn't totally clear on the code that generates the lines (first iterates through |
Thanks Paul - I'm not sure when I'll get time to work on this, but I imagine you can already patch in this change in the spot you need it, so you're not blocked on us merging and releasing? |
Tried this out locally on my linux machine (stock Ubuntu 22.04.4 LTS), and I don't have |
I just ran into a nodejs dependency where the directory name included a space in it that is not covered by #835. I am using The line in my mtree spec is
I had claude generate this genrule to cover it. So far tested on mac, need to test on linux still but its a simple awk script so i'm hopeful shelling to the host awk wont be a problem
|
I just ran into a nodejs dependency where the directory name included a space in it that is not covered by #835 The line in my mtree spec is
I had claude generate this genrule to cover it. So far tested on mac, need to test on linux still but its a simple awk script so i'm hopeful shelling to the host awk wont be a problem
|
Ran into the same issue with spaces in a directory. Ended up overriding the module with a simple one line patch OldLine 396 in eb4c47f
New
|
This PR refactors the
mtree_spec
rule:Instead of emitting the
.spec
output file directly in it's final formatted form, it has been changed to emit a jsonl equivalent. This intermediate file is then processed line-by-line in a shell script withjq
to assist with parsing. The filenames (andcontent
) are encoded withvis
prior to final mtree line formatting. A golden test has been added toe2e/smoke
.Fixes #794