Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: --allow-paths should support trailing / #2147

Closed
axic opened this issue Apr 20, 2017 · 6 comments · Fixed by #3015
Closed

CLI: --allow-paths should support trailing / #2147

axic opened this issue Apr 20, 2017 · 6 comments · Fixed by #3015
Labels

Comments

@axic
Copy link
Member

axic commented Apr 20, 2017

$ solc/solc --allow-paths /Users/alex/Projects/solidity xyxy.sol 
Warning: This is a pre-release compiler version, please do not use it in production.
/Users/alex/Projects/solidity/restricted/test.sol:1:1: Warning: Source file does not specify required compiler version!

^
xyxy.sol:1:1: Warning: Source file does not specify required compiler version!
import "/Users/alex/Projects/solidity/restricted/test.sol";
^
Spanning multiple lines.
$ solc/solc --allow-paths /Users/alex/Projects/solidity/ xyxy.sol 
Warning: This is a pre-release compiler version, please do not use it in production.
xyxy.sol:1:1: Error: Source "/Users/alex/Projects/solidity/restricted/test.sol" not found: File outside of allowed directories.
import "/Users/alex/Projects/solidity/restricted/test.sol";
^---------------------------------------------------------^
@axic axic added the bug 🐛 label Apr 20, 2017
q3k added a commit to Getline-Network/solidity that referenced this issue Oct 3, 2017
axic pushed a commit to Getline-Network/solidity that referenced this issue Oct 5, 2017
@dryruner
Copy link

dryruner commented Oct 5, 2017

I'm observing different things:

$ solc --overwrite --bin -o out_dir github.com/ethereum/dapp-bin/library/=/tmp/test_contract --allow-paths /tmp/test_contract/ temp.sol
temp.sol:3:1: Error: Source "/tmp/test_contract/linkedList.sol" not found: File outside of allowed directories.
import "github.com/ethereum/dapp-bin/library/linkedList.sol" as linked_list;
^--------------------------------------------------------------------------^
temp.sol:4:1: Error: Source "/tmp/test_contract/iterable_mapping.sol" not found: File outside of allowed directories.
import "github.com/ethereum/dapp-bin/library/iterable_mapping.sol" as it_mapping;
^-------------------------------------------------------------------------------^

However, just by appending a comma it'll compile:
$ solc --overwrite --bin -o out_dir github.com/ethereum/dapp-bin/library/=/tmp/test_contract/ --allow-paths /tmp/test_contract, temp.sol

@axic
Copy link
Member Author

axic commented Oct 5, 2017

@jonnyhsy I think it is the same problem. The problem is that allow-paths doesn't work with a trailing slash.

@dryruner
Copy link

dryruner commented Oct 5, 2017

Hi @axic , I also tried $ solc --overwrite --bin -o out_dir github.com/ethereum/dapp-bin/library/=/tmp/test_contract/ --allow-paths /tmp/test_contract temp.sol; (no trailing slash), it also failed with error

temp.sol:3:1: Error: Source "/tmp/test_contract/linkedList.sol" not found: File outside of allowed directories.
import "github.com/ethereum/dapp-bin/library/linkedList.sol" as linked_list;
^--------------------------------------------------------------------------^
temp.sol:4:1: Error: Source "/tmp/test_contract/iterable_mapping.sol" not found: File outside of allowed directories.
import "github.com/ethereum/dapp-bin/library/iterable_mapping.sol" as it_mapping;
^-------------------------------------------------------------------------------^

@axic axic closed this as completed in #3015 Oct 6, 2017
@JechoJekov
Copy link

Does not work as expected with"." and ".." in Solidity 0.4.19 (0.4.19+commit.c4cbbb05.Windows.msvc).

Working cases:
solc --allow-paths .
solc --allow-paths ./,
solc --allow-paths ../,

Cases that do not work:
solc --allow-paths ./
solc --allow-paths ..
solc --allow-paths ../

@a186r
Copy link

a186r commented Jul 8, 2018

@JechoJekov it's working for me , thank you

@tpmccallum
Copy link

@JechoJekov Thanks Champ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants