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

Windows: Backslash in a path to contract leads to solc crash #3968

Closed
mbolotov opened this issue Apr 21, 2018 · 21 comments
Closed

Windows: Backslash in a path to contract leads to solc crash #3968

mbolotov opened this issue Apr 21, 2018 · 21 comments

Comments

@mbolotov
Copy link

Steps to reproduce:

  1. Define two contracts:
contract A {}
import "./A.sol";
contract B {}
  1. Run the following command:
    solc -o . --bin .\A.sol B.sol

Expected result:

Contracts to be compiled successfully

Actual result:

Solc crashed

Output:

Exception during output generation: C:\projects\solidity\solc\CommandLineInterface.cpp(524): Throw in function void __cdecl dev::solidity::CommandLineInterface::createFile(const class std::bas
ic_string<char,struct std::char_traits,class std::allocator > &,const class std::basic_string<char,struct std::char_traits,class std::allocator > &)
Dynamic exception type: class boost::exception_detail::clone_impl
std::exception::what: FileError
[struct dev::tag_comment * __ptr64] = Could not write to file: ._\A_sol_A.bin

solc version:

0.4.23+commit.124ca40d.Windows.msvc

platform:

win7

@chriseth chriseth changed the title Backslash in a path to contract leads to solc crash Windows: Backslash in a path to contract leads to solc crash Apr 30, 2018
@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 75.0 DAI (75.0 USD @ $1.0/DAI) attached to it.

@GaretWebster
Copy link

I assume you already read through this, but just incase I wanted to link Solidities documentation on this issue - https://solidity.readthedocs.io/en/latest/layout-of-source-files.html#paths

I also noticed that you have a forward slash in one of your example and a backslash in another, could you have gotten them mixed up?

Finally is it possible back slashes have another meaning in Soliditiy and need to be escaped to work properly?

@mbolotov
Copy link
Author

mbolotov commented May 2, 2018

I'm aware that Solidity import statement accepts only forward slashes.
That being said when you run solc from command line the command must obey the OS path rules. And Windows defines backslash as a primary path separator character (though supporting / as well)
So I believe that my example is valid and moreover the most correct way to call solc in the mentioned example.

Just to clarify this: I'm quite sure if I tried call solc manually I would use a forward slash. But I found this bug when called solc programmatically from java.
And it generated a path with backslashes since java tries to conform to the specs as much as possible.
So I had to workaround this issue by converting \ to / explicitely

@chriseth
Copy link
Contributor

chriseth commented May 2, 2018

I agree, the commandline interface should support both backslashes and forward slashes on windows, while import statements should only support forward slashes. This should all be taken care of by boost::filesystem, it just looks like there is a bug about how we distinguish directories and files.

@gitcoinbot
Copy link

@asifmallik Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • warning (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


@asifmallik due to inactivity, we have escalated this issue to Gitcoin's moderation team. Let us know if you believe this has been done in error!

  • warning (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@vs77bb
Copy link

vs77bb commented May 14, 2018

Hi @asifmallik we see you've created a PR here - are you able to close the loop on the tests @axic has requested? Hope you're doing well!

@chriseth Let me know if you think I'm missing something here 😄

@asifmallik
Copy link
Contributor

@vs77bb Sorry, I had been busy in the last couple of days. I am looking into it right now!

@gitcoinbot
Copy link

@asifmallik Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • warning (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

1 similar comment
@gitcoinbot
Copy link

@asifmallik Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • warning (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


@asifmallik due to inactivity, we have escalated this issue to Gitcoin's moderation team. Let us know if you believe this has been done in error!

  • warning (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@gitcoinbot
Copy link

@asifmallik Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • warning (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


@asifmallik due to inactivity, we have escalated this issue to Gitcoin's moderation team. Let us know if you believe this has been done in error!

  • warning (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

@mxmauro
Copy link

mxmauro commented Jul 4, 2018

Using forward slashes does not solve the issue.

@cnusrini
Copy link

cnusrini commented Jul 6, 2018

Is this still an open issue? Of not, I would like to try. Please confirm.

@chriseth
Copy link
Contributor

@cnusrini please coordinate with @asifmallik , they were still working on #4070 two weeks ago.

@gitcoinbot
Copy link

gitcoinbot commented Aug 16, 2018

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 2 days, 22 hours from now.
Please review their action plans below:

1) asifmallik has started work.

I have fixed this bug by replacing the string() method with generic_string() to ensure backslash separated paths are also internally represented as paths separated with forward slashes.

Learn more on the Gitcoin Issue Details page.

@chriseth
Copy link
Contributor

I confirm that it has been solved by @asifmallik

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 75.0 DAI (75.0 USD @ $1.0/DAI) has been submitted by:

  1. @asifmallik

@gdipri01 please take a look at the submitted work:


@asifmallik
Copy link
Contributor

@gdipri01 could you please release the bounty?

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 75.0 DAI (75.0 USD @ $1.0/DAI) attached to this issue has been approved & issued to @asifmallik.

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

No branches or pull requests

10 participants