dmd icon indicating copy to clipboard operation
dmd copied to clipboard

Fix Issue 22575 - putting -run in dmd.conf causes a segfault

Open Wesley-Jenkins opened this issue 3 years ago • 5 comments

Length in "-run" code only considers command line args, causing an underflow here. This fixes the segfault, but breaks everything else, because it eats the rest of the arguments, and then it can't compile. So I'm not sure if it's easily possible to allow "-run" in a dmd.conf file, and maybe it should just error upon encountering it.

Wesley-Jenkins avatar Dec 07 '21 07:12 Wesley-Jenkins

Thanks for your pull request and interest in making D better, @Wesley-Jenkins! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#13394"

dlang-bot avatar Dec 07 '21 07:12 dlang-bot

Tests fail because options from DFLAGS are appended to the command line arguments and are now ignored for compilation. As you suggested, maybe it's just better to bail out if -run is inside a response file or environment variable, which might be possible to check via i >= argc.

rainers avatar Dec 11 '21 08:12 rainers

@Wesley-Jenkins are you still pursuing this?

RazvanN7 avatar Dec 16 '21 12:12 RazvanN7

Ping @Wesley-Jenkins

dkorpel avatar Mar 21 '22 13:03 dkorpel

This needs the issue number reference in the commit.

ljmf00 avatar Mar 25 '22 11:03 ljmf00