Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Conversation

@belka-ew
Copy link
Contributor

@belka-ew belka-ew commented Jan 5, 2018

src/rt isn't shipped with druntime's imports, so it can't be
imported directly from core.runtime. This PR fixes importing rt.config
from a public druntime module by replacing it with an extern
definition.

To reproduce the bug create a file that imports 'core.runtime' and
compile it with:
dmd -unittest -deps filename.d

The error is:
/usr/include/dmd/druntime/import/core/runtime.d(653): Error: module
config is in file 'rt/config.d' which cannot be read

@dlang-bot
Copy link
Contributor

dlang-bot commented Jan 5, 2018

Thanks for your pull request, @belka-ew! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.

Some tips to help speed things up:

  • smaller, focused PRs are easier to review than big ones

  • try not to mix up refactoring or style changes with bug fixes or feature enhancements

  • provide helpful commit messages explaining the rationale behind each change

Bear in mind that large or tricky changes may require multiple rounds of review and revision.

Please see CONTRIBUTING.md for more information.

Bugzilla references

Auto-close Bugzilla Description
18193 module config is in file 'rt/config.d' which cannot be read

@belka-ew belka-ew requested a review from MartinNowak as a code owner January 5, 2018 07:02
@rainers
Copy link
Member

rainers commented Jan 5, 2018

Thanks. Happens even without -unittest.

Looks like a regression (-deps has changed it's meaning, unfortunately, but having the import in a core module is incorrect anyway) so should be better targeting the stable branch. A bugzilla report should also be added so it appears in the changelog.

@belka-ew
Copy link
Contributor Author

belka-ew commented Jan 5, 2018

Looks like a regression (-deps has changed it's meaning, unfortunately, but having the import in a core module is incorrect anyway) so should be better targeting the stable branch.

Should I close this PR then?

It was introduced by d757a7d.

@rainers
Copy link
Member

rainers commented Jan 5, 2018

Should I close this PR then?

No, it should be switched to target "stable" (click "Edit" for the title) and a bugzilla entry should be added at https://issues.dlang.org/

@dlang-bot dlang-bot added the Bug Fix Include reference to corresponding bugzilla issue label Jan 5, 2018
@belka-ew belka-ew changed the base branch from master to stable January 5, 2018 10:07
@belka-ew
Copy link
Contributor Author

belka-ew commented Jan 5, 2018

It seems I messed it up. My branch is created from master. GitHub web interface allows to change the target branch only, not to rebase on another branch.

@Burgos
Copy link
Contributor

Burgos commented Jan 5, 2018

You can just rebase locally your branch on stable and push the new state to your remote and this PR will be in a good shape again :-)

… be read (edit)

src/rt isn't shipped with druntime's imports, so it can't be
imported directly from core.runtime. This PR fixes importing rt.config
from a public druntime module by replacing it with an extern
definition.

To reproduce the bug create a file that imports 'core.runtime' and
compile it with:
dmd -unittest -deps filename.d

The error is:
/usr/include/dmd/druntime/import/core/runtime.d(653): Error: module
config is in file 'rt/config.d' which cannot be read
@belka-ew
Copy link
Contributor Author

belka-ew commented Jan 5, 2018

Fine. That looks a bit better. @rainers and @Burgos, thanks.

Copy link
Member

@PetarKirov PetarKirov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM.

@wilzbach
Copy link
Contributor

wilzbach commented Jan 5, 2018

FYI: there are two more imports:

druntime/src/core/thread.d

Lines 713 to 718 in 7bfaa8c

version (Shared)
{
import rt.sections;
auto libs = pinLoadedLibraries();
auto ps = cast(void**).malloc(2 * size_t.sizeof);
if (ps is null) onOutOfMemoryError();

druntime/src/core/thread.d

Lines 305 to 309 in 7bfaa8c

version (Shared)
{
import rt.sections;
Thread obj = cast(Thread)(cast(void**)arg)[0];
auto loadedLibraries = (cast(void**)arg)[1];

@wilzbach
Copy link
Contributor

wilzbach commented Jan 5, 2018

Also this should have been accompanied by a unittest, s.t. the regression can't happen again.
@belka-ew could you quickly add a test? (see /test)

@wilzbach
Copy link
Contributor

wilzbach commented Jan 5, 2018

Also @ other reviewers. This would have never been merged, because for auto-tester new users need to be approved. So if auto-tester doesn't show up in the list of CIs, head over and you will see this screen:

image

@belka-ew I just clicked on "Approve" ;-)

@belka-ew
Copy link
Contributor Author

belka-ew commented Jan 5, 2018

I'll add a test this week. Can't promise to do it today.
Should I fix other imports in this PR?
What kind of test would it be, I see several directories in "test"?

@wilzbach
Copy link
Contributor

wilzbach commented Jan 5, 2018

Should I fix other imports in this PR?

If you ask like this, I can't really say no ;-)
But it's not a requirement for this PR.

What kind of test would it be, I see several directories in "test"?

You probably have to add a new directory to test.

@belka-ew
Copy link
Contributor Author

belka-ew commented Jan 6, 2018

/home/circleci/dmd/generated/linux/release/64/dmd -m64 -fPIC -w -I../../src -I../../import -Isrc -defaultlib= -debuglib= -dip1000 -L/home/circleci/druntime/generated/linux/debug/64/libdruntime.a -g -debug -ofgenerated/linux/debug/64/fiber_guard_page src/fiber_guard_page.d

There seems to be a very generic problem with druntime tests. -I../../src is always passed when compiling. ../../src contains both, core and rt, it prevents such errors from being found.

It is just a note, I still need some time to experiment with the test runner.

@belka-ew
Copy link
Contributor Author

belka-ew commented Jan 7, 2018

I couldn't find a better way to write the test. Is it ok? If so, I'll try to fix other two imports.

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good! Not so happy about the symlinks though.

@@ -0,0 +1 @@
../../../src/core No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, why do you need these files?
dmd isn't used with -conf= and will use the import path of druntime. If you don't trust it, you can always add -I../../import?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It fails: https://circleci.com/gh/dlang/druntime/1546

Testing bug18193
/home/circleci/dmd/generated/linux/release/64/dmd -o- -deps=generated/linux/debug/64/bug18193.done -Isrc -I../../import src/bug18193
Error: cannot find source code for runtime library file 'object.d'
dmd might not be correctly installed. Run 'dmd -man' for installation instructions.
config file: /home/circleci/dmd/generated/linux/release/64/dmd.conf

@belka-ew
Copy link
Contributor Author

belka-ew commented Jan 9, 2018

@rainers
Copy link
Member

rainers commented Jan 9, 2018

The problem seems to be that the tests are run without the import files being copied over from the source directory. That's why the other tests specify -I../../src, too.
Not sure if it is specific to the circleci script, but the default target should be built before running the tests.

@belka-ew
Copy link
Contributor Author

Any chance to get it merged with or without the tests before 2.080.1? As said it is a general problem with the makefiles, which prevents such bugs from being found. And this problem is not related to this regression introduced in 2.080.0 and can be fixed in another PR. I can create an issue if needed.

@wilzbach
Copy link
Contributor

wilzbach commented Jan 11, 2018

I added 3d153f8 to your PR. I think that should solve the problem. Sorry for the delay.

@wilzbach
Copy link
Contributor

Looks all good. @belka-ew do you mind if I squash your last three commits into one? No need to keep the experiments in the history.

@belka-ew belka-ew requested a review from Burgos as a code owner January 12, 2018 07:59
@belka-ew
Copy link
Contributor Author

@wilzbach, thanks for your fast response. I squashed the commits and added the fixes for core.thread.

@belka-ew
Copy link
Contributor Author

belka-ew commented Jan 12, 2018

I assume that the tests fail because code.dlang.org is dead?

@wilzbach
Copy link
Contributor

No the DUB registry outage was only for two hours and we have mirrors:

  1. Jenkins failure

Sending interrupt signal to process

./travis-ci.sh: line 40: 29145 Terminated              dub build --compiler=$DC --override-config=vibe-d:core/$VIBED_DRIVER $DUB_ARGS

script returned exit code 143

Might be related to: dlang/ci#118

  1. DAutoTest failure

.generated/stable_dmd-2.072.2/dmd2/linux/bin64/dub build --single --compiler=.generated/stable_dmd-2.072.2/dmd2/linux/bin64/dmd assert_writeln_magic.d
Root package assert_writeln_magic references unknown package libdparse
posix.mak:818: recipe for target '.generated/assert_writeln_magic' failed

2.072.0 doesn't come with mirrors, will look into upgrading it.

In the mean time I will git commit --amend the last commit and force-push as that's the only way to restart DAutoTest.

@wilzbach
Copy link
Contributor

2.072.0 doesn't come with mirrors, will look into upgrading it.

I already did so, it's just not in stable yet:

dlang/dlang.org#1926

@dlang-bot dlang-bot merged commit e5512c4 into dlang:stable Jan 12, 2018
@belka-ew belka-ew deleted the fix-deps-rt-import branch January 12, 2018 19:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Bug Fix Include reference to corresponding bugzilla issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants