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

[Bug]: tar generates incorrect mtree for aspect_rules_js runfiles #797

Open
Zemnmez opened this issue Mar 23, 2024 · 2 comments
Open

[Bug]: tar generates incorrect mtree for aspect_rules_js runfiles #797

Zemnmez opened this issue Mar 23, 2024 · 2 comments
Labels
bug Something isn't working untriaged Requires traige

Comments

@Zemnmez
Copy link

Zemnmez commented Mar 23, 2024

What happened?

I tried to make a tar of a js_binary from aspect_rules_js. It failed because the node_modules deps seem to have some incorrectly set filetypes in their mtree.

Instead we get this error:

ERROR: /Users/tshadwell/code/monorepo/ts/pulumi/lib/docker/testing/example/simple/BUILD.bazel:17:10: Tar ts/pulumi/lib/docker/testing/example/simple/simple_tar.tar failed: (Exit 1): tar failed: error executing Tar command (from target //ts/pulumi/lib/docker/testing/example/simple:simple_tar) external/aspect_bazel_lib~~toolchains~bsd_tar_host/tar --create --file bazel-out/darwin_arm64-fastbuild/bin/ts/pulumi/lib/docker/testing/example/simple/simple_tar.tar ... (remaining 1 argument skipped)

Version

Development (host) and target OS/architectures:

Output of bazel --version:

bazel 7.1.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

    http_archive(
        name = "aspect_rules_js",
        sha256 = "6148188cfa5cb76397b8745b71d57c47a7c1a8e00ff2f1e2e7955206846197f1",
        strip_prefix = "rules_js-1.39.0",
        url = "https://github.com/aspect-build/rules_js/releases/download/v1.39.0/rules_js-v1.39.0.tar.gz",
    )

bazel_dep(name = "aspect_bazel_lib", version = "2.5.3")

Language(s) and/or frameworks involved:

  • aspect_rules_js

How to reproduce

1. Pull this commit: https://github.com/zemn-me/monorepo/commit/2112ad5adbfc9aed993c2f90dc7406b58a52d124

2. Run `bazelisk build //ts/pulumi/lib/docker/testing/example/simple:simple_tar`

Any other information?

tshadwell@Thomass-Air monorepo % bazel build //ts/pulumi/lib/docker/testing/example/simple:simple_tar 
WARNING: Option 'experimental_remote_build_event_upload' is deprecated: Use --remote_build_event_upload instead
INFO: Invocation ID: 36daec61-8823-4ef8-8c88-23b4f409cecd
INFO: Streaming build results to: https://app.buildbuddy.io/invocation/36daec61-8823-4ef8-8c88-23b4f409cecd
WARNING: Option 'experimental_remote_build_event_upload' is deprecated: Use --remote_build_event_upload instead
INFO: Analyzed target //ts/pulumi/lib/docker/testing/example/simple:simple_tar (0 packages loaded, 0 targets configured).
ERROR: /Users/tshadwell/code/monorepo/ts/pulumi/lib/docker/testing/example/simple/BUILD.bazel:17:10: Tar ts/pulumi/lib/docker/testing/example/simple/simple_tar.tar failed: (Exit 1): tar failed: error executing Tar command (from target //ts/pulumi/lib/docker/testing/example/simple:simple_tar) external/aspect_bazel_lib~~toolchains~bsd_tar_host/tar --create --file bazel-out/darwin_arm64-fastbuild/bin/ts/pulumi/lib/docker/testing/example/simple/simple_tar.tar ... (remaining 1 argument skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
tar: Error reading archive bazel-out/darwin_arm64-fastbuild/bin/ts/pulumi/lib/docker/testing/example/simple/_simple_tar.mtree.txt: mtree specification has different type for ts/pulumi/lib/docker/testing/example/simple/main_bin.sh.runfiles/_main/node_modules/regenerator-runtime
tar: Error exit delayed from previous errors.
Target //ts/pulumi/lib/docker/testing/example/simple:simple_tar failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 3.000s, Critical Path: 2.79s
INFO: 2 processes: 2 internal.
ERROR: Build did NOT complete successfully
INFO: Streaming build results to: https://app.buildbuddy.io/invocation/36daec61-8823-4ef8-8c88-23b4f409cecd
tshadwell@Thomass-Air monorepo % 

Workaround

Make an npm_package and wrap it in js_binary.

@Zemnmez Zemnmez added the bug Something isn't working label Mar 23, 2024
@github-actions github-actions bot added the untriaged Requires traige label Mar 23, 2024
@Zemnmez
Copy link
Author

Zemnmez commented Mar 24, 2024

It looks like I was able to work around this by making an npm_package, and then creating a js_binary of that.

@thesayyn
Copy link
Collaborator

thesayyn commented Nov 1, 2024

Yes, this is why we have js_image_layer because rules_js is really sensitive to symlinks, #967 is my incomplete yet daring stab at fixing this, it's not even there yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged Requires traige
Projects
None yet
Development

No branches or pull requests

2 participants