Skip to content

solc/wrapper crashes on Solidity version 0.4.10 and earlier when there's a colon in the file path #555

@haltman-at

Description

@haltman-at

So, versions of Solidity prior to 0.4.20 don't handle colons in file paths well; and since Truffle not too long ago started relabelling all file paths to begin with project:/, this has become an issue for older Solidity support. For Solidity 0.4.11-19, the problem is handleable, and I've put up this Truffle PR to address it.

For Solidity 0.4.10 and earlier, however, a colon in the file path causes solc/wrapper itself to crash. (I don't know why it's only 0.4.10 and earlier, while 0.4.11-19 don't cause a problem here.) To be clear, I tried updating solc/wrapper to 0.8.9 to ensure that the problem still exists on this version.

So, solc/wrapper should be updated so that it doesn't crash on this condition, and we can at least get some output. Whether that's nice clean output in the style of 0.4.20, or messed-up output in the style of 0.4.11-19 that we have to repair... as long as we can at least get something we can work with.

(Should the 0.4.11-19 problem itself be reported as a solc/wrapper issue? Maybe that's something that could itself be fixed in solc/wrapper so that Truffle doesn't have to repair it after the fact? Not sure whether that's appropriate but I'm starting to think maybe it is; obviously it's closely related to this problem.)

(Now I'm wondering if maybe the problems Truffle has had with 0.4.8 and earlier should be solc/wrapper issues, too. :P Probably not, but...)

Edit: Forgot to include a stacktrace, here's the relevant part of the stacktrace:

TypeError: Cannot read property 'length' of null
    at Object.translateJsonCompilerOutput (/home/sniffnoy/truffle/truffle/packages/compile-solidity/node_modules/solc/translate.js:82:13)
    at translateOutput (/home/sniffnoy/truffle/truffle/packages/compile-solidity/node_modules/solc/wrapper.js:275:26)
    at Object.compileStandardWrapper [as compile] (/home/sniffnoy/truffle/truffle/packages/compile-solidity/node_modules/solc/wrapper.js:292:14)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions