You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Child process' execFile and execFileSync handle arguments different when shell is not falsy #43333
How often does it reproduce? Is there a required condition?
It always reproduces.
What is the expected behavior?
child_process.execFileSync and child_process.execFile invoke commands in the same way given the same arguments. In particular, I believe the behaviour of execFileSync is expected.
What do you see instead?
child_process.execFileSync and child_process.execFile invoke commands in different ways given the same arguments.
This is caused by normalizeSpawnArguments being called repeatedly. We should avoid using the normalize function for spawn in execFile, even though it works fine most of the time.
Activity
bnoordhuis commentedon Jun 7, 2022
For the record: also happens with CJS.
zhmushan commentedon Jun 7, 2022
This is caused by
normalizeSpawnArgumentsbeing called repeatedly. We should avoid using the normalize function for spawn in execFile, even though it works fine most of the time.This issue can be assigned to me.
F3n67u commentedon Jun 7, 2022
Could you help me understand why the behavior of execFileSync is expected?
If
echo foo baris interpreted tobash -c 'echo foo bar'when shell is/bin/bash, thenfoo barshould be printed, right?zhmushan commentedon Jun 8, 2022
@F3n67u Your understanding is correct, but now execFileSync interprets
echo foo baras/bin/bash -c "/bin/bash -c echo foo bar"RaisinTen commentedon Jun 8, 2022
No need to wait for someone to assign you to the issue, feel free to send the PR when your patch is ready. :)
ericcornelissen commentedon Jun 8, 2022
That's based on @bnoordhuis' comments in #29466.
That is actually the topic of the discussion I brought up over at #29466 as well.
fix(scripts): running commands with certain shells
child_process: avoid repeated calls to `normalizeSpawnArguments`
child_process: avoid repeated calls to `normalizeSpawnArguments`
Test both sync and callback versions of explicitly
Update fuzz targets (#697)