dmd
dmd copied to clipboard
Fix Issue 22575 - putting -run in dmd.conf causes a segfault
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.
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:andReturns:)
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"
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.
@Wesley-Jenkins are you still pursuing this?
Ping @Wesley-Jenkins
This needs the issue number reference in the commit.