[BUG] bin doesnt work when incrementing arg with equals sign
envgap__npm__node-semver-431
01 / FAILURE SIGNATURE
As reported upstream
No identifying execution failure has been captured.
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
f070dde0cc22894ac254e281cb36a79ab790272d- Manifest
package.json- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
npm/node-semver #431 · read the original issue
# What / Why
Why it unshift an empty string into argv when an argument contains a "="?
```javascript
// line 35 @ /bin/semver.js
let a = argv.shift()
const indexOfEqualSign = a.indexOf('=')
if (indexOfEqualSign !== -1) {
a = a.slice(0, indexOfEqualSign)
argv.unshift(a.slice(indexOfEqualSign + 1))
}
```
Let's suppose `a` contains an "=", then `indexOfEqualSign` won't be -1. Inside the if statement, it overwrites `a` with a slice of it (removing whatever is after the "="). After that, it inserts into argv another slice of `a`. But this slice starts at `indexOfEqualSign` + 1 (the part we just remove), so an empty string ("") will be returned by the slice and inserted by the unshift.
As I understood, the empty string doesn't affect the execution because it is filtered out at line 92. But, Why it bother to add an "", loop with it, add it to versions to finally remove from versions? I think I am missing something. Can someone explain it to me, please?04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]