-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
--allow-paths
does not resolve relative paths correctly
#4623
Comments
(Edit: note I don't think this option is the best idea, just wanted to make it known that it is also an approach) |
--allow-paths
and symlink handling--allow-paths
and symlink/relative path handling
Note that the metadata is identical because the physical paths on the machine you compile from are irrelevant for the metadata, only the virtual directory structure (with As far as I understand the problem, this just looks like relative paths are not properly taken into account for |
--allow-paths
and symlink/relative path handling--allow-paths
and symlink/relative path handling
The reason symlinks are not followed is simply that it would make the whole feature pointless. You use it to whitelist specific directories and be sure that nothing outside them cannot be included in the contract. If the compiler followed symlinks, this could be trivially by passed by placing a symlink to any file on your filesystem inside one of the whitelisted directories. |
solc doesn't support symbolic links that are made in `node_modules` by `npm link` command. We need to update the `--allow-paths` value to be the parent directory that is assumed to contain both current project and dependent project. Ref: ethereum/solidity#4623
solc doesn't support symbolic links that are made in `node_modules` by `npm link` command. We need to update the `--allow-paths` value to be the parent directory that is assumed to contain both current project and dependent project. Ref: ethereum/solidity#4623
--allow-paths
and symlink/relative path handling--allow-paths
does not resolve relative paths correctly
Just to clarify this issue: it's not really a problem with symlinks, relative paths without symlinks do not work properly either:
|
I ran into some ergonomics issues related to
--allow-paths
and symlinks.Problem description
Say I have two contracts
Foo
(infoo.sol
) andBar
(inbar/bar.sol
) and assume thatfoo.sol
importsbar/bar.sol
.This obviously works:
If we move
bar.sol
behind a symlink, everything still works:... or not, depending on where the symlink points to:
Weird, maybe I just need to add
bar
as an allowed directory?Nope, not working. Maybe I should try resolving the symlink?
Hmm, that doesn't work. (See also this issue.)
But this does:
Note that
solc
generates identical metadata in all three cases that compile:Suggestions
Can we improve this situation to make it more developer friendly?
Here are a few suggestions for resolving this issue:
2.1 resolve symlinks
2.2 resolve relative paths
3.1 document the behavior
3.2 detect that compilation failed due to a symlink/relative path, warn the user, and point them to the docs
The text was updated successfully, but these errors were encountered: