Skip to content

Commit

Permalink
- coverage - Fix coverage-function v8CoverageReportCreate() throwing …
Browse files Browse the repository at this point in the history
…error EINVAL in latest nodejs-security-patch, when running win32-coverage with npm.cmd.
  • Loading branch information
kaizhu256 committed Jun 23, 2024
1 parent d1130d3 commit 33ff0e7
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ import moduleFs from "fs";
"type": "git",
"url": "https://github.com/jslint-org/jslint.git"
},
"version": "2024.3.26"
"version": "2024.6.1"
}, undefined, 4)
}
].map(async function ({
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ jobs:
- x64
# - x86
node_version:
- 18
- 20
# - 22
python_version:
- "3.10"
- 22
os:
- macos-latest
- ubuntu-latest
- windows-latest
python_version:
- "3.10"
# base - .github/workflows/ci.yml - beg
env:
CI_MATRIX_NAME: >
Expand All @@ -55,7 +54,7 @@ jobs:
steps:
# disable autocrlf in windows
- run: |
sh -c uname
sh -c "uname -a"
echo "$(date -u +"%Y-%m-%d %TZ") - ${{ env.CI_WORKFLOW_NAME }}" # "
git config --global core.autocrlf false
# https://github.com/actions/checkout
Expand All @@ -70,7 +69,6 @@ jobs:
# https://github.com/actions/setup-node
- uses: actions/setup-node@v4
with:
architecture: ${{ matrix.architecture }}
node-version: ${{ matrix.node_version }}
# https://github.com/actions/setup-python
- uses: actions/setup-python@v5
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ jobs:
- x64
# - x86
node_version:
- 18
- 20
# - 22
- 22
os:
- macos-latest
- ubuntu-latest
Expand All @@ -43,20 +42,21 @@ jobs:
${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- run: echo "$(date -u +"%Y-%m-%d %TZ") - ${{ env.CI_WORKFLOW_NAME }}" # "
# disable autocrlf in windows
- run: git config --global core.autocrlf false
- run: |
sh -c "uname -a"
echo "$(date -u +"%Y-%m-%d %TZ") - ${{ env.CI_WORKFLOW_NAME }}" # "
git config --global core.autocrlf false
# https://github.com/actions/checkout
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# fetch jslint_ci.sh from trusted source
- run: |
git fetch origin alpha --depth=1
sh -c 'for FILE in .ci.sh .ci2.sh jslint_ci.sh myci2.sh; do
if [ -f "$FILE" ]; then git checkout origin/alpha "$FILE"; fi; done'
# https://github.com/actions/setup-node
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
architecture: ${{ matrix.architecture }}
node-version: ${{ matrix.node_version }}
# run nodejs coverages and tests
- run: sh jslint_ci.sh shCiBase
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
- x64
# - x86
node_version:
# - 18
- 20
# - 22
os:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- jslint - add new warning requiring paren around plus-separated concatenations.
- jslint - try to improve parser to be able to parse jquery.js without stopping.

# v2024.6.1-beta
- coverage - Fix coverage-function v8CoverageReportCreate() throwing error EINVAL in latest nodejs-security-patch, when running win32-coverage with npm.cmd.

# v2024.3.26
- ci - Add shell-functions shGitPullrequestCleanup(), shGitPullrequest() to automatically cleanup or create-and-push github-pull-commit to origin/alpha.
- jslint - Allow destructuring-assignment after function-definition.
Expand Down
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -917,13 +917,13 @@ eval("1"); //jslint-ignore-line
<br><br>
### pull-request merge
- find highest issue-number at https://github.com/jslint-org/jslint/issues/, https://github.com/jslint-org/jslint/pulls/, and add +1 to it for PR-xxx
- $ `shGitPullrequest beta beta`
- `shGitPullrequest beta beta`
- verify ci-success for origin-branch-alpha
- https://github.com/kaizhu256/jslint/actions/workflows/ci.yml
- $ `git push upstream alpha -f`
- https://github.com/kaizhu256/jslint/actions
- `git push upstream alpha -f`
- verify ci-success for upstream-branch-alpha
- https://github.com/jslint-org/jslint/actions/workflows/ci.yml
- goto https://github.com/jslint-org/jslint/compare/beta...kaizhu256:jslint:branch-p2024.3.21
- https://github.com/jslint-org/jslint/actions
- goto https://github.com/jslint-org/jslint/compare/beta...kaizhu256:jslint:branch-p2024.6.23
- click `Create pull request`
- input `Add your description here...` with:
```
Expand All @@ -945,24 +945,24 @@ this PR will additionally:
- wait awhile before continuing ...
- click `Rebase and merge`
- verify ci-success for upstream-branch-beta
- https://github.com/jslint-org/jslint/actions/workflows/ci.yml
- $ `shGitPullrequestCleanup`
- https://github.com/jslint-org/jslint/actions
- `shGitPullrequestCleanup`
- verify ci-success for origin-branch-alpha
- https://github.com/kaizhu256/jslint/actions/workflows/ci.yml
- $ `git push upstream alpha -f`
- https://github.com/kaizhu256/jslint/actions
- `git push upstream alpha -f`
- verify ci-success for upstream-branch-alpha
- https://github.com/jslint-org/jslint/actions/workflows/ci.yml
- https://github.com/jslint-org/jslint/actions
- click `Delete branch`


<br><br>
### branch-master commit
- $ `shGitPullrequest master beta`
- `shGitPullrequest master beta`
- verify ci-success for origin-branch-alpha
- https://github.com/kaizhu256/jslint/actions/workflows/ci.yml
- $ `git push upstream alpha -f`
- https://github.com/kaizhu256/jslint/actions
- `git push upstream alpha -f`
- verify ci-success for upstream-branch-alpha
- https://github.com/jslint-org/jslint/actions/workflows/ci.yml
- https://github.com/jslint-org/jslint/actions
- goto https://github.com/jslint-org/jslint/compare/beta...kaizhu256:jslint:branch-v2024.3.26
- click `Create pull request`
- input `Add a title` with: `# v20yy.mm.dd`
Expand All @@ -978,27 +978,27 @@ this PR will additionally:
- wait awhile before continuing ...
- click `Rebase and merge`
- verify ci-success for upstream-branch-beta
- https://github.com/jslint-org/jslint/actions/workflows/ci.yml
- $ `shGitPullrequestCleanup`
- https://github.com/jslint-org/jslint/actions
- `shGitPullrequestCleanup`
- verify ci-success for origin-branch-alpha
- https://github.com/kaizhu256/jslint/actions/workflows/ci.yml
- $ `git push upstream alpha -f`
- https://github.com/kaizhu256/jslint/actions
- `git push upstream alpha -f`
- verify ci-success for upstream-branch-alpha
- https://github.com/jslint-org/jslint/actions/workflows/ci.yml
- https://github.com/jslint-org/jslint/actions
- click `Delete branch`
- $ `git push origin beta:master`
- `git push origin beta:master`
- verify ci-success for origin-branch-master
- https://github.com/kaizhu256/jslint/actions/workflows/ci.yml
- $ `git push upstream beta:master`
- https://github.com/kaizhu256/jslint/actions
- `git push upstream beta:master`
- verify ci-success for upstream-branch-master
- https://github.com/jslint-org/jslint/actions/workflows/ci.yml
- https://github.com/jslint-org/jslint/actions


<br><br>
### branch-master publish
- $ `git push upstream beta:master`
- `git push upstream beta:master`
- verify ci-success for upstream-branch-master
- https://github.com/jslint-org/jslint/actions/workflows/ci.yml
- https://github.com/jslint-org/jslint/actions
- goto https://github.com/jslint-org/jslint/releases/new
- input `Choose a tag` with: `v20yy.mm.dd`
- click `Create new tag: v20yy.mm.dd on publish`
Expand All @@ -1016,18 +1016,18 @@ this PR will additionally:
- click `Preview` and review
- click `Publish release`
- verify ci-success for upstream-branch-publish
- https://github.com/jslint-org/jslint/actions/workflows/ci.yml
- https://github.com/jslint-org/jslint/actions
- verify email-notification `Successfully published @jslint-org/[email protected]`


<br><br>
### vscode-jslint publish
- goto https://github.com/jslint-org/jslint/tree/gh-pages/branch-beta/.artifact/jslint_wrapper_vscode
- click `vscode-jslint-20yy.mm.dd.vsix`
- click `Download`
- click `Raw` to download
- goto https://marketplace.visualstudio.com/manage/publishers/jslint
- right-click `Update`
- drag-and-drop downloaded `vscode-jslint-20yy.mm.dd.vsix`
- upload downloaded file `vscode-jslint-20yy.mm.dd.vsix`
- click 'Upload'
- verify email-notification `[Succeeded] Extension publish on Visual Studio Marketplace - vscode-jslint`

Expand Down
37 changes: 25 additions & 12 deletions jslint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@
process_env, process_exit, promises, property, property_dict, push, quote,
ranges, readFile, readdir, readonly, recursive, reduce, repeat, replace,
resolve, result, reverse, role, round, scriptId, search, set, shebang,
shift, signature, single, slice, some, sort, source, spawn, splice, split,
stack, stack_trace, start, startOffset, startsWith, statement,
shell, shift, signature, single, slice, some, sort, source, spawn, splice,
split, stack, stack_trace, start, startOffset, startsWith, statement,
statement_prv, stdio, stop, stop_at, stringify, subscript, switch,
syntax_dict, tenure, test, test_cause, test_internal_error, this, thru,
toLocaleString, toString, token, token_global, token_list, token_nxt,
Expand Down Expand Up @@ -163,7 +163,7 @@ let jslint_charset_ascii = (
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
+ "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
);
let jslint_edition = "v2024.3.26";
let jslint_edition = "v2024.6.1-beta";
let jslint_export; // The jslint object to be exported.
let jslint_fudge = 1; // Fudge starting line and starting
// ... column to 1.
Expand Down Expand Up @@ -11285,24 +11285,37 @@ function sentinel() {}
}
}));
exitCode = await new Promise(function (resolve) {
moduleChildProcess.spawn(
(
processArgv[0] === "npm"
let processArgv0 = processArgv[0];

// If win32 environment, then replace program npm with npm.cmd.
// Coverage-hack - Ugly-hack to get test-coverage under both win32 and linux.

? process.platform.replace("win32", "npm.cmd").replace(
process.platform,
"npm"
)
: processArgv[0]
),
if (processArgv0 === "npm") {
processArgv0 = process.platform.replace(
"win32",
"npm.cmd"
).replace(
process.platform,
"npm"
);
}
moduleChildProcess.spawn(
processArgv0,
processArgv.slice(1),
{
env: Object.assign({}, process.env, {
NODE_V8_COVERAGE: coverageDir
}),

// PR-465
// https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2
// Node.js will now error with EINVAL if a .bat or .cmd file is passed to
// child_process.spawn and child_process.spawnSync without the shell option set.

shell: (
processArgv0.endsWith(".bat")
|| processArgv0.endsWith(".cmd")
),
stdio: ["ignore", 1, 2]
}
).on("exit", resolve);
Expand Down
37 changes: 22 additions & 15 deletions jslint_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ shGitInitBase() {(set -e

shGitLsTree() {(set -e
# this function will "git ls-tree" all files committed in HEAD
# example use:
# example usage:
# shGitLsTree | sort -rk3 # sort by date
# shGitLsTree | sort -rk4 # sort by size
node --input-type=module --eval '
Expand Down Expand Up @@ -1062,7 +1062,7 @@ import moduleFs from "fs";
default:
version = `p${version}`;
commitMessage = (
/\n\n# v\d\d\d\d\.\d\d?\.\d\d?(?:-.*?)?\n(- [\S\s]+?)\n- /
/\n\n# v\d\d\d\d\.\d\d?\.\d\d?(?:-.*?)?\n(- [\S\s]+?)(?:\n- |\n\n)/
).exec(data)[1];
}
branchPull = `branch-${version}`;
Expand Down Expand Up @@ -1171,15 +1171,15 @@ shGithubCheckoutRemote() {(set -e
shGithubFileDownload() {(set -e
# this function will download file $1 from github repo/branch
# https://docs.github.com/en/rest/reference/repos#create-or-update-file-contents
# example use:
# example usage:
# shGithubFileDownload octocat/hello-world/master/hello.txt
shGithubFileDownloadUpload download "$1" "$2"
)}

shGithubFileDownloadUpload() {(set -e
# this function will upload file $2 to github repo/branch $1
# https://docs.github.com/en/rest/reference/repos#create-or-update-file-contents
# example use:
# example usage:
# shGithubFileUpload octocat/hello-world/master/hello.txt hello.txt
shGithubTokenExport
node --input-type=module --eval '
Expand Down Expand Up @@ -1272,7 +1272,7 @@ import modulePath from "path";
shGithubFileUpload() {(set -e
# this function will upload file $2 to github repo/branch $1
# https://docs.github.com/en/rest/reference/repos#create-or-update-file-contents
# example use:
# example usage:
# shGithubFileUpload octocat/hello-world/master/hello.txt hello.txt
shGithubFileDownloadUpload upload "$1" "$2"
)}
Expand All @@ -1287,7 +1287,7 @@ shGithubTokenExport() {

shGithubWorkflowDispatch() {(set -e
# this function will trigger github-workflow on given $REPO and $BRANCH
# example use:
# example usage:
# shGithubWorkflowDispatch octocat/hello-world master
shGithubTokenExport
REPO="$1"
Expand Down Expand Up @@ -2068,7 +2068,7 @@ function replaceListReplace(replaceList, data) {
if (dataUriType) {
return;
}
if (dateCommitted) {
if (dateCommitted && dateCommitted.toString()) {
result += (
"\n\n\n/*\n"
+ "repo " + prefix.replace("/blob/", "/tree/") + "\n"
Expand Down Expand Up @@ -3329,20 +3329,27 @@ function sentinel() {}
}
}));
exitCode = await new Promise(function (resolve) {
let processArgv0 = processArgv[0];
if (processArgv0 === "npm") {
processArgv0 = process.platform.replace(
"win32",
"npm.cmd"
).replace(
process.platform,
"npm"
);
}
moduleChildProcess.spawn(
(
processArgv[0] === "npm"
? process.platform.replace("win32", "npm.cmd").replace(
process.platform,
"npm"
)
: processArgv[0]
),
processArgv0,
processArgv.slice(1),
{
env: Object.assign({}, process.env, {
NODE_V8_COVERAGE: coverageDir
}),
shell: (
processArgv0.endsWith(".bat")
|| processArgv0.endsWith(".cmd")
),
stdio: ["ignore", 1, 2]
}
).on("exit", resolve);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
"shCiArtifactUpload": 1,
"shCiPublishNpm": 1,
"type": "module",
"version": "2024.3.26"
"version": "2024.6.1-beta"
}

0 comments on commit 33ff0e7

Please sign in to comment.