-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Print the canonical path of wasm/abi when not found #6346
Conversation
programs/cleos/main.cpp
Outdated
@@ -2468,7 +2468,7 @@ int main( int argc, char** argv ) { | |||
bytes code_bytes; | |||
if(!contract_clear){ | |||
std::string wasm; | |||
fc::path cpath(contractPath); | |||
fc::path cpath = fc::canonical(fc::path(contractPath)); | |||
|
|||
if( cpath.filename().generic_string() == "." ) cpath = cpath.parent_path(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check should be before the conversion to canonical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean "don't call canonical() when given path is already absolute path"? (By check whether the first character of contractPath
is .
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 2473 checks if cpath is "." and if it is then it sets cpath to cpath.parent_path(). If you convert to canonical then cpath will never equal ".".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Sorry for the stupid question. :)
programs/cleos/main.cpp
Outdated
@@ -2523,7 +2523,7 @@ int main( int argc, char** argv ) { | |||
|
|||
bytes abi_bytes; | |||
if(!contract_clear){ | |||
fc::path cpath(contractPath); | |||
fc::path cpath = fc::canonical(fc::path(contractPath)); | |||
if( cpath.filename().generic_string() == "." ) cpath = cpath.parent_path(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, the check for "." should be before switch to canonical.
I've tested above code, but it just converts path to empty one when given condition is true, so with the current version of cleos, the next command fails:
By converting path to canonical one, I found the command |
Change Description
Fixes #6343.
This patch makes cleos print the canonical path of wasm or abi when they are not found. Showing the canonical path for contract-dir can help users find out wrong configuration or option set by themselves.
Consensus Changes
None
API Changes
None
Documentation Additions
None