Skip to content
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

Non-hermetic basename tool #141

Open
birunts opened this issue Dec 16, 2024 · 1 comment · May be fixed by #143
Open

Non-hermetic basename tool #141

birunts opened this issue Dec 16, 2024 · 1 comment · May be fixed by #143

Comments

@birunts
Copy link

birunts commented Dec 16, 2024

A genrule from deb_import.bzl is using non-hermetic basename tool.
This is very simple case here to grab only the file name without any sophisticated usage. Seems to be reasonable to use simple POSIX instead e.g.:

    # gzip compression.

-    data_file="$$(basename $<)"
+    SRC="$<"
+    data_file="$${SRC##*/}"

    if [[ "$$data_file" == "data.tar.bz2" ]]; then
jjmaestro added a commit to jjmaestro/rules_distroless that referenced this issue Dec 16, 2024
Fixes GoogleContainerTools#141

In GoogleContainerTools#99 I added a dependency to basename when it's not really needed.

Credit and thanks to @birunts for finding the dependency and providing a
potential solution!
@jjmaestro jjmaestro linked a pull request Dec 16, 2024 that will close this issue
@jjmaestro
Copy link
Contributor

Good catch! Looking at it, I inadvertently added it in #99 but it's not really needed, so I've removed it in #143.

I probably left it when I copy-pasted the script from a standalone version that I wrote in my computer, to test a few thing outside of Bazel before moving it into deb_import 😅

jjmaestro added a commit to jjmaestro/rules_distroless that referenced this issue Dec 17, 2024
Fixes GoogleContainerTools#141

In GoogleContainerTools#99 I added a dependency to basename when it's not really needed.

Credit and thanks to @birunts for finding the issue and providing the
solution!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants