I accidentally had a dmd.conf sitting in my ~/tmp directory, which produced this really confusing interaction: ~/src$ /usr/local/bin/dmd d-grep/main.d -ofgrep -w -wi -g d-grep/main.d(2): Error: module blah is in file 'blah.d' which cannot be read import path[0] = /usr/local/bin/../share/dmd2/phobos import path[1] = /usr/local/bin/../share/dmd2/druntime/import ~/src$ cd ~/tmp ~/tmp$ /usr/local/bin/dmd ~/src/d-grep/main.d -ofgrep -w -wi -g object.d: Error: module object is in file 'object.d' which cannot be read import path[0] = ./../share/dmd2/phobos import path[1] = ./../share/dmd2/druntime/import If dmd had printed that it was using different dmd.conf files for each run, I'd have found the problem much faster.
Running dmd -v does print out which config file it's using. Would that be good enough?
(In reply to hsteoh from comment #1) > Running dmd -v does print out which config file it's using. Would that be > good enough? Yes, this bug is really old, it's possible it didn't back then.
Hm... on second thought, dmd -v spits out a LOT of stuff. I don't want to contend with that when looking for that one piece of info. It would be nice for dmd *without* any parameters to spit out the config location. Even if dmd -v did it (without any other parameters), it would be good. But I think asking for env variables is a bit too much. Updating bug and reopening.
Running dmd without any input files spits out a long usage screen dump. Wouldn't the config location get lost in there?
https://github.com/D-Programming-Language/dmd/pull/4108
(In reply to hsteoh from comment #4) > Running dmd without any input files spits out a long usage screen dump. > Wouldn't the config location get lost in there? I built a simple hello world app. dmd -v compiling spit out 141 extremely unreadable lines. dmd without any args spits out 70 lines. But the lines are formatted and organized for easy reading. I'm also frequently used to doing dmd without args to see what version I'm using. dmd.conf naturally belongs there IMO.
I like the pull direction -- outputting dmd.conf when object.d cannot be found is a good idea. But it still doesn't solve the issue of when you are compiling with the wrong *working* installation. Is it difficult to add the dmd.conf location to the usage output? Arguably, dmd -v without any parameters should show it.
Updated the PR to display the config file along with the usage text, so you can see it if you run dmd with no input files.
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e30213d6672bdf7440be662575be2c1cf29b1eb3 Show config file if object.d can't be found. To help troubleshoot problems caused by stray copies of dmd.conf (see bugzilla issue 4567). https://github.com/D-Programming-Language/dmd/commit/96b7b2fdd26fe8b2e4ec8da273d1e2e5c00f6bdc Merge pull request #4108 from quickfur/issue4567 Issue 4567: display dmd.conf path being used if object.d can't be found
Nice, thanks!
Commits pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e30213d6672bdf7440be662575be2c1cf29b1eb3 Show config file if object.d can't be found. https://github.com/D-Programming-Language/dmd/commit/96b7b2fdd26fe8b2e4ec8da273d1e2e5c00f6bdc Merge pull request #4108 from quickfur/issue4567