diff options
author | chriseth <chris@ethereum.org> | 2018-08-13 19:37:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-13 19:37:04 +0800 |
commit | a2c754b3fed422b3d8027a5298624bcfed3744a5 (patch) | |
tree | 9306c07b3445117a318f14dcde5efd1bd7dcaf9d /docs | |
parent | 43db88b8363d73ee2f5ffa094ff506414261bd11 (diff) | |
parent | a7885e0b0a8808e9daa7cc3b86781997c614b8d3 (diff) | |
download | dexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.tar.gz dexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.tar.zst dexon-solidity-a2c754b3fed422b3d8027a5298624bcfed3744a5.zip |
Merge pull request #4793 from ethereum/emptyRemappings
Disallow remappings with empty prefix.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/layout-of-source-files.rst | 11 | ||||
-rw-r--r-- | docs/using-the-compiler.rst | 11 |
2 files changed, 11 insertions, 11 deletions
diff --git a/docs/layout-of-source-files.rst b/docs/layout-of-source-files.rst index 46ef3d57..4bacd704 100644 --- a/docs/layout-of-source-files.rst +++ b/docs/layout-of-source-files.rst @@ -100,11 +100,10 @@ When the compiler is invoked, it is not only possible to specify how to discover the first element of a path, but it is possible to specify path prefix remappings so that e.g. ``github.com/ethereum/dapp-bin/library`` is remapped to ``/usr/local/dapp-bin/library`` and the compiler will read the files from there. -If multiple remappings can be applied, the one with the longest key is tried first. This -allows for a "fallback-remapping" with e.g. ``""`` maps to -``"/usr/local/include/solidity"``. Furthermore, these remappings can -depend on the context, which allows you to configure packages to -import e.g. different versions of a library of the same name. +If multiple remappings can be applied, the one with the longest key is tried first. +An empty prefix is not allowed. Furthermore, these remappings can depend on the context, +which allows you to configure packages to import e.g. different versions of a library +of the same name. **solc**: @@ -148,7 +147,7 @@ Note that solc only allows you to include files from certain directories: They have to be in the directory (or subdirectory) of one of the explicitly specified source files or in the directory (or subdirectory) of a remapping target. If you want to allow direct absolute includes, just add the -remapping ``=/``. +remapping ``/=/``. If there are multiple remappings that lead to a valid file, the remapping with the longest common prefix is chosen. diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index 1d7cb97b..b286e1a3 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -23,14 +23,15 @@ it is also possible to provide path redirects using ``prefix=path`` in the follo :: - solc github.com/ethereum/dapp-bin/=/usr/local/lib/dapp-bin/ =/usr/local/lib/fallback file.sol + solc github.com/ethereum/dapp-bin/=/usr/local/lib/dapp-bin/ file.sol This essentially instructs the compiler to search for anything starting with -``github.com/ethereum/dapp-bin/`` under ``/usr/local/lib/dapp-bin`` and if it does not -find the file there, it will look at ``/usr/local/lib/fallback`` (the empty prefix -always matches). ``solc`` will not read files from the filesystem that lie outside of +``github.com/ethereum/dapp-bin/`` under ``/usr/local/lib/dapp-bin``. +``solc`` will not read files from the filesystem that lie outside of the remapping targets and outside of the directories where explicitly specified source -files reside, so things like ``import "/etc/passwd";`` only work if you add ``=/`` as a remapping. +files reside, so things like ``import "/etc/passwd";`` only work if you add ``/=/`` as a remapping. + +An empty remapping prefix is not allowed. If there are multiple matches due to remappings, the one with the longest common prefix is selected. |