-
Notifications
You must be signed in to change notification settings - Fork 6.1k
"Cannot import url" error when working with standard json on newest mac version #10059
Copy link
Copy link
Closed
Labels
bug 🐛should compile without errorError is reported even though it shouldn't. Source is fine.Error is reported even though it shouldn't. Source is fine.waiting for more inputIssues waiting for more input by the reporterIssues waiting for more input by the reporter
Description
Description
In Mac OS 10.15.7, a single contract file compiled with standard-json with the input file provided as a URL, Solidity compiler fails to compile with the following error:
{"errors":[{"component":"general","formattedMessage":"Cannot import url (\"/Users/thomas/Code/MacSucks/Bank.sol\"): File outside of allowed directories.","message":"Cannot import url (\"/Users/thomas/Code/MacSucks/Bank.sol\"): File outside of allowed directories.","severity":"error","type":"IOError"}],"sources":{}}
A workaround is to provide a relative path instead of the absolute path.
This is a change of behavior compared to Ubuntu, Windows, and Mac OS 10.15.6.
Environment
- Compiler version: solc6.10
- Operating system: Mac OS 10.15.7
Steps to Reproduce
This happens on any contract. But we take this solidity snippet:
pragma solidity ^0.6.0;
contract Bank {
struct Account {
uint256 balance;
uint256 exists;
}
mapping (address => Account) accounts;
uint256 public totalSupply;
function create(address a) public {
require(accounts[a].exists == 0);
accounts[a].exists = 1;
}
}This file is stored in /Users/thomas/Code/MacSucks/Bank.sol.
We prepare the following standard-json input:
{
"language": "Solidity",
"sources": {
"/Users/thomas/Code/MacSucks/Bank.sol": {
"urls": [
"/Users/thomas/Code/MacSucks/Bank.sol"
]
}
},
"settings": {
"remappings": [],
"outputSelection": {
"*": {
"*": [
"storageLayout",
"abi",
"evm.deployedBytecode",
"evm.methodIdentifiers"
],
"": [
"id",
"ast"
]
}
}
}
}Here are a few attempts to run the compiler and what each one gives:
solc6.10 --allow-paths /Users/thomas/Code/MacSucks --standard-json < json.json- fails on newest Mac, succeeds in other environments.solc6.10 --standard-json < json.json- fails on all environmentssolc6.10 --allow-paths / --standard-json < json.json- succeedssolc6.10 --allow-paths . --standard-json < json.json- succeedssolc6.10 --allow-paths /Users/thomas/Code/MacSucks,. --standard-json < json.json- succeeds
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug 🐛should compile without errorError is reported even though it shouldn't. Source is fine.Error is reported even though it shouldn't. Source is fine.waiting for more inputIssues waiting for more input by the reporterIssues waiting for more input by the reporter