Skip to content

Commit a1741d6

Browse files
committed
bughunt yarn-classic probe: npm wrapper under yarn 1 on musl
1 parent 9c43dfc commit a1741d6

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: bughunt yarn-classic probe
2+
on:
3+
push:
4+
branches: ['bughunt/yarn-classic/**']
5+
permissions:
6+
contents: read
7+
jobs:
8+
probe:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 30
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
pm: ['yarn@1.0.2', 'yarn@1.7.0', 'yarn@1.10.1', 'yarn@1.22.22', 'npm-control']
15+
image: ['node:22-alpine', 'node:22-bookworm-slim']
16+
steps:
17+
- name: Probe wrapper under ${{ matrix.pm }} on ${{ matrix.image }}
18+
run: |
19+
cat > probe.sh <<'PROBEEOF'
20+
set -u
21+
PM="$1"
22+
echo "libc: $(ldd --version 2>&1 | head -1)"; node --version
23+
mkdir -p /p && cd /p && echo '{"name":"p","version":"1.0.0","private":true}' > package.json
24+
if [ "$PM" = npm-control ]; then
25+
npm --version; npm install -D --no-audit --no-fund @socketsecurity/socket-patch@4.0.0 > /tmp/i.log 2>&1; echo "install exit $?"
26+
else
27+
V="${PM#yarn@}"; npm install --prefix /y --no-audit --no-fund "yarn@$V" > /dev/null 2>&1
28+
Y="node /y/node_modules/yarn/bin/yarn.js"; $Y --version
29+
$Y add -D @socketsecurity/socket-patch@4.0.0 --no-progress > /tmp/i.log 2>&1; echo "install exit $?"
30+
fi
31+
tail -3 /tmp/i.log
32+
echo "installed platform packages: $(ls node_modules/@socketsecurity | tr '\n' ' ')"
33+
node node_modules/@socketsecurity/socket-patch/bin/socket-patch --version > /tmp/o.txt 2> /tmp/e.txt; rc=$?
34+
echo "wrapper --version exit $rc stdout=[$(cat /tmp/o.txt)] stderr=[$(cat /tmp/e.txt)]"
35+
node -e 'const r=require("child_process").spawnSync(require("path").join(process.cwd(),"node_modules/@socketsecurity/socket-patch-linux-x64-gnu/socket-patch"),["--version"]);console.log("direct gnu spawn: status",r.status,"error",r.error&&r.error.code)' 2>&1 || true
36+
[ -x node_modules/@socketsecurity/socket-patch-linux-x64-musl/socket-patch ] && echo "direct musl: $(node_modules/@socketsecurity/socket-patch-linux-x64-musl/socket-patch --version 2>&1)"
37+
if [ "$PM" != npm-control ]; then
38+
$Y socket-patch --version > /tmp/o2.txt 2>&1; echo "yarn run socket-patch --version exit $? out=[$(tr '\n' ' ' < /tmp/o2.txt | cut -c1-300)]"
39+
fi
40+
echo "RESULT $PM $(cat /etc/os-release | grep ^ID= ) wrapper_exit=$rc"
41+
PROBEEOF
42+
docker run --rm -v "$PWD/probe.sh:/probe.sh:ro" ${{ matrix.image }} sh /probe.sh '${{ matrix.pm }}'

0 commit comments

Comments
 (0)