This bounty is no longer available
Web3 DAO | Ethereum Foundation Logo

Older nightlies with leading zeros in version string crash `soljson`

Organization

Ethereum Foundation

Deadline

N/A

Status

ENDED


INSTRUCTIONS

Originally reported in https://github.com/ethereum/solc-bin/pull/21#discussion_r746961386.

soljson-v0.4.1-nightly.2016.9.9+commit.79867f49.js crashes solc-js because the version it reports apparently does not conform to semver. solc-js should be able to handle that more gracefully.

This happens for --version and --bin. Probably in other cases too.

Repro

npm install solc
curl https://binaries.soliditylang.org/bin/soljson-v0.4.1-nightly.2016.9.9+commit.79867f49.js --location --output node_modules/solc
npx solcjs --version

Running the above produces the following exception:

TypeError: Invalid Version: 0.4.1-nightly.2016.09.09+commit.79867f49.Emscripten.clang
    at new SemVer (/tmp/s/node_modules/semver/semver.js:323:11)
    at compare (/tmp/s/node_modules/semver/semver.js:614:10)
    at Function.gt (/tmp/s/node_modules/semver/semver.js:643:10)
    at setupMethods (/tmp/s/node_modules/solc/wrapper.js:20:27)
    at Object.<anonymous> (/tmp/s/node_modules/solc/index.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)