Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion nodejs.BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Build targets for the Node.js source repository."""

load(":bazel/release.bzl", "NODEJS_RELEASE")
load("@bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
load("@nodejs//nodejs:compiler_options.bzl", "cxx20_copts")
load(
Expand Down Expand Up @@ -3684,7 +3685,7 @@ nodejs_release_archives(
name = "release_archives",
config_gypi = ":config_gypi",
node = ":node",
version = "26.3.1",
version = NODEJS_RELEASE.release,
)

cc_library(
Expand Down
1 change: 1 addition & 0 deletions nodejs/private/release_archive.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ def nodejs_release_archives(name, version, node, config_gypi):
args = [
"$(execpath :_release_mtree)",
"$(execpath {}.mtree)".format(normalized_mtree),
version,
root,
] + _EXECUTABLE_RELEASE_FILES,
target_compatible_with = release_constraints,
Expand Down
24 changes: 16 additions & 8 deletions nodejs/private/release_mtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,17 @@ static int compare_entries(const void *left_value, const void *right_value) {
return strcmp(left->destination, right->destination);
}

static int valid_root(const char *root) {
static const char prefix[] = "node-v26.3.1-";
static int valid_root(const char *root, const char *version) {
static const char prefix[] = "node-v";
const size_t prefix_length = sizeof(prefix) - 1;
const size_t version_length = strlen(version);
const size_t root_prefix_length = prefix_length + version_length + 1;
const size_t root_length = strlen(root);
const unsigned char *cursor = (const unsigned char *)root;
if (strncmp(root, prefix, sizeof(prefix) - 1) != 0) {
if (version_length == 0 || root_length <= root_prefix_length ||
strncmp(root, prefix, prefix_length) != 0 ||
strncmp(root + prefix_length, version, version_length) != 0 ||
root[prefix_length + version_length] != '-') {
return 0;
}
for (; *cursor != '\0'; ++cursor) {
Expand Down Expand Up @@ -271,15 +278,16 @@ int main(int argc, char **argv) {
char required_npm[192];
char required_npx[192];

if (argc < 4 || !valid_root(argv[3])) {
fprintf(stderr, "usage: release_mtree INPUT OUTPUT node-v26.3.1-PLATFORM "
"[EXECUTABLE ...]\n");
if (argc < 5 || !valid_root(argv[4], argv[3])) {
fprintf(stderr,
"usage: release_mtree INPUT OUTPUT VERSION node-vVERSION-PLATFORM "
"[EXECUTABLE ...]\n");
return 2;
}
input_path = argv[1];
output_path = argv[2];
root = argv[3];
for (index = 4; index < (size_t)argc; ++index) {
root = argv[4];
for (index = 5; index < (size_t)argc; ++index) {
if (!valid_relative_path(argv[index])) {
fprintf(stderr, "release_mtree: invalid executable path %s\n",
argv[index]);
Expand Down
Loading