D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4567 - dmd should print the dmd.conf location with usage statement
Summary: dmd should print the dmd.conf location with usage statement
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2010-08-01 17:45 UTC by Jeffrey Yasskin
Modified: 2015-02-18 03:39 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jeffrey Yasskin 2010-08-01 17:45:47 UTC
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.
Comment 1 hsteoh 2014-11-01 15:43:08 UTC
Running dmd -v does print out which config file it's using. Would that be good enough?
Comment 2 Steven Schveighoffer 2014-11-03 16:19:34 UTC
(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.
Comment 3 Steven Schveighoffer 2014-11-03 16:41:33 UTC
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.
Comment 4 hsteoh 2014-11-03 23:24:34 UTC
Running dmd without any input files spits out a long usage screen dump. Wouldn't the config location get lost in there?
Comment 6 Steven Schveighoffer 2014-11-04 02:55:16 UTC
(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.
Comment 7 Steven Schveighoffer 2014-11-04 02:59:48 UTC
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.
Comment 8 hsteoh 2014-11-04 05:52:47 UTC
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.
Comment 9 github-bugzilla 2014-11-04 08:09:13 UTC
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
Comment 10 Steven Schveighoffer 2014-11-04 15:50:17 UTC
Nice, thanks!