Bug 207233 - lang/dmd2: Wrong default path to dmd2.conf
Summary: lang/dmd2: Wrong default path to dmd2.conf
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Cy Schubert
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-16 00:02 UTC by Stas Miasnikoǔ
Modified: 2016-02-16 21:35 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (cy)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stas Miasnikoǔ 2016-02-16 00:02:36 UTC
The default config path has one too many /use/local component. See the "config" line. It seems s{/usr}{/usr/local} happened 2 times.

% dmd -v hello.d
binary    dmd
version   v2.070.0-devel
config    /usr/local/usr/local/etc/dmd.conf
parse     hello
importall hello
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: (null)
Specify path to file 'object.d' with -I switch

Steps to reproduce:

Try to compile the following trivial program.

import std.stdio;

void main() {
    writeln("Hello world!");
}
Comment 1 Cy Schubert freebsd_committer freebsd_triage 2016-02-16 01:24:18 UTC
lippy$ dmd -ofhello hello.d         
slippy$ ./hello
Hello world!
slippy$ dmd -v hello.d
binary    dmd
version   v2.070.0-devel
config    /usr/local/usr/local/etc/dmd.conf
parse     hello
importall hello
import    object	(/usr/local/include/d/druntime/import/object.d)
import    std.stdio	(/usr/local/include/d/phobos2/std/stdio.d)
import    core.stdc.stdio	(/usr/local/include/d/druntime/import/core/stdc/stdio.d)
import    core.stdc.config	(/usr/local/include/d/druntime/import/core/stdc/config.d)
import    core.stdc.stdarg	(/usr/local/include/d/druntime/import/core/stdc/stdarg.d)
import    core.stdc.stdlib	(/usr/local/include/d/druntime/import/core/stdc/stdlib.d)
import    core.stdc.stddef	(/usr/local/include/d/druntime/import/core/stdc/stddef.d)
import    core.stdc.stdint	(/usr/local/include/d/druntime/import/core/stdc/stdint.d)
import    core.stdc.signal	(/usr/local/include/d/druntime/import/core/stdc/signal.d)
import    core.stdc.wchar_	(/usr/local/include/d/druntime/import/core/stdc/wchar_.d)
import    core.stdc.time	(/usr/local/include/d/druntime/import/core/stdc/time.d)
import    core.sys.posix.sys.types	(/usr/local/include/d/druntime/import/core/sys/posix/sys/types.d)
import    core.sys.posix.config	(/usr/local/include/d/druntime/import/core/sys/posix/config.d)
import    std.typecons	(/usr/local/include/d/phobos2/std/typecons.d)
import    std.meta	(/usr/local/include/d/phobos2/std/meta.d)
import    std.traits	(/usr/local/include/d/phobos2/std/traits.d)
import    std.typetuple	(/usr/local/include/d/phobos2/std/typetuple.d)
import    std.stdiobase	(/usr/local/include/d/phobos2/std/stdiobase.d)
import    std.range.primitives	(/usr/local/include/d/phobos2/std/range/primitives.d)
semantic  hello
import    core.stdc.errno	(/usr/local/include/d/druntime/import/core/stdc/errno.d)
import    core.stdc.string	(/usr/local/include/d/druntime/import/core/stdc/string.d)
entry     main      	hello.d
semantic2 hello
semantic3 hello
import    std.exception	(/usr/local/include/d/phobos2/std/exception.d)
import    std.range	(/usr/local/include/d/phobos2/std/range/package.d)
import    std.range.interfaces	(/usr/local/include/d/phobos2/std/range/interfaces.d)
import    std.array	(/usr/local/include/d/phobos2/std/array.d)
import    std.functional	(/usr/local/include/d/phobos2/std/functional.d)
import    std.algorithm	(/usr/local/include/d/phobos2/std/algorithm/package.d)
import    std.algorithm.comparison	(/usr/local/include/d/phobos2/std/algorithm/comparison.d)
import    std.algorithm.iteration	(/usr/local/include/d/phobos2/std/algorithm/iteration.d)
import    std.algorithm.mutation	(/usr/local/include/d/phobos2/std/algorithm/mutation.d)
import    std.algorithm.setops	(/usr/local/include/d/phobos2/std/algorithm/setops.d)
import    std.algorithm.sorting	(/usr/local/include/d/phobos2/std/algorithm/sorting.d)
import    std.algorithm.searching	(/usr/local/include/d/phobos2/std/algorithm/searching.d)
import    std.utf	(/usr/local/include/d/phobos2/std/utf.d)
import    core.internal.string	(/usr/local/include/d/druntime/import/core/internal/string.d)
import    core.bitop	(/usr/local/include/d/druntime/import/core/bitop.d)
code      hello
function  D main
function  std.stdio.writeln!(string).writeln
function  std.stdio.File.LockingTextWriter.put!string.put
function  std.stdio.File.LockingTextWriter.put!string.put.trustedFwrite
function  std.stdio.File.LockingTextWriter.put!string.put.__dgliteral3
function  std.stdio.File.LockingTextWriter.put!string.put.__foreachbody4
function  std.exception.errnoEnforce!(int, "/usr/local/include/d/phobos2/std/exception.d", 588LU).errnoEnforce
function  std.stdio.File.LockingTextWriter.put!dchar.put
function  std.stdio.File.LockingTextWriter.put!dchar.put.trustedFPUTC
function  std.stdio.File.LockingTextWriter.put!dchar.put.trustedFPUTWC
function  std.stdio.File.LockingTextWriter.put!char.put
function  std.stdio.File.LockingTextWriter.put!char.put.trustedFPUTC
function  std.stdio.File.LockingTextWriter.put!char.put.trustedFPUTWC
cc hello.o -o hello -m64 -L/usr/local/lib -Xlinker --export-dynamic -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic -lpthread -lm 
slippy$
Comment 2 Stas Miasnikoǔ 2016-02-16 01:43:38 UTC
(In reply to Cy Schubert from comment #1)

Just in case

% uname -a
FreeBSD melange 10.2-RELEASE-p9 FreeBSD 10.2-RELEASE-p9 #0: Thu Jan 14 01:32:46 UTC 2016     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

This is strange. For me it runs only with -conf=/usr/local/etc/dmd.conf

% dmd -conf=/usr/local/etc/dmd.conf -v hello.d
binary    dmd
version   v2.070.0-devel
config    /usr/local/etc/dmd.conf
parse     hello
importall hello
import    object        (/usr/local/include/d/druntime/import/object.d)
import    std.stdio     (/usr/local/include/d/phobos2/std/stdio.d)
import    core.stdc.stdio       (/usr/local/include/d/druntime/import/core/stdc/stdio.d)
import    core.stdc.config      (/usr/local/include/d/druntime/import/core/stdc/config.d)
import    core.stdc.stdarg      (/usr/local/include/d/druntime/import/core/stdc/stdarg.d)
import    core.stdc.stdlib      (/usr/local/include/d/druntime/import/core/stdc/stdlib.d)
import    core.stdc.stddef      (/usr/local/include/d/druntime/import/core/stdc/stddef.d)
import    core.stdc.stdint      (/usr/local/include/d/druntime/import/core/stdc/stdint.d)
import    core.stdc.signal      (/usr/local/include/d/druntime/import/core/stdc/signal.d)
import    core.stdc.wchar_      (/usr/local/include/d/druntime/import/core/stdc/wchar_.d)
import    core.stdc.time        (/usr/local/include/d/druntime/import/core/stdc/time.d)
import    core.sys.posix.sys.types      (/usr/local/include/d/druntime/import/core/sys/posix/sys/types.d)
import    core.sys.posix.config (/usr/local/include/d/druntime/import/core/sys/posix/config.d)
import    std.typecons  (/usr/local/include/d/phobos2/std/typecons.d)
import    std.meta      (/usr/local/include/d/phobos2/std/meta.d)
import    std.traits    (/usr/local/include/d/phobos2/std/traits.d)
import    std.typetuple (/usr/local/include/d/phobos2/std/typetuple.d)
import    std.stdiobase (/usr/local/include/d/phobos2/std/stdiobase.d)
import    std.range.primitives  (/usr/local/include/d/phobos2/std/range/primitives.d)
semantic  hello
import    core.stdc.errno       (/usr/local/include/d/druntime/import/core/stdc/errno.d)
import    core.stdc.string      (/usr/local/include/d/druntime/import/core/stdc/string.d)
entry     main          hello.d
semantic2 hello
semantic3 hello
import    std.exception (/usr/local/include/d/phobos2/std/exception.d)
import    std.range     (/usr/local/include/d/phobos2/std/range/package.d)
import    std.range.interfaces  (/usr/local/include/d/phobos2/std/range/interfaces.d)
import    std.array     (/usr/local/include/d/phobos2/std/array.d)
import    std.functional        (/usr/local/include/d/phobos2/std/functional.d)
import    std.algorithm (/usr/local/include/d/phobos2/std/algorithm/package.d)
import    std.algorithm.comparison      (/usr/local/include/d/phobos2/std/algorithm/comparison.d)
import    std.algorithm.iteration       (/usr/local/include/d/phobos2/std/algorithm/iteration.d)
import    std.algorithm.mutation        (/usr/local/include/d/phobos2/std/algorithm/mutation.d)
import    std.algorithm.setops  (/usr/local/include/d/phobos2/std/algorithm/setops.d)
import    std.algorithm.sorting (/usr/local/include/d/phobos2/std/algorithm/sorting.d)
import    std.algorithm.searching       (/usr/local/include/d/phobos2/std/algorithm/searching.d)
import    std.utf       (/usr/local/include/d/phobos2/std/utf.d)
import    core.internal.string  (/usr/local/include/d/druntime/import/core/internal/string.d)
import    core.bitop    (/usr/local/include/d/druntime/import/core/bitop.d)
code      hello
function  D main
function  std.stdio.writeln!(string).writeln
function  std.stdio.File.LockingTextWriter.put!string.put
function  std.stdio.File.LockingTextWriter.put!string.put.trustedFwrite
function  std.stdio.File.LockingTextWriter.put!string.put.__dgliteral3
function  std.stdio.File.LockingTextWriter.put!string.put.__foreachbody4
function  std.exception.errnoEnforce!(int, "/usr/local/include/d/phobos2/std/exception.d", 588LU).errnoEnforce
function  std.stdio.File.LockingTextWriter.put!dchar.put
function  std.stdio.File.LockingTextWriter.put!dchar.put.trustedFPUTC
function  std.stdio.File.LockingTextWriter.put!dchar.put.trustedFPUTWC
function  std.stdio.File.LockingTextWriter.put!char.put
function  std.stdio.File.LockingTextWriter.put!char.put.trustedFPUTC
function  std.stdio.File.LockingTextWriter.put!char.put.trustedFPUTWC
cc hello.o -o hello -m64 -L/usr/local/lib -Xlinker --export-dynamic -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic -lpthread -lm
Comment 3 Stas Miasnikoǔ 2016-02-16 01:49:07 UTC
Oh yes, DOCS=off
Comment 4 Stas Miasnikoǔ 2016-02-16 02:16:34 UTC
Do you have dmd.conf in your homedir?

It appears to me that this line https://github.com/D-Programming-Language/dmd/blob/master/src/posix.mak#L22 will be processed twice by the Makefile:

- by line 59: -e "s|/etc|${PREFIX}/etc|" \
- by line 68: @${REINPLACE_CMD} -e '/^SYSCONFDIR=/s|/etc/|${PREFIX}/etc/|' ${WRKSRC}/posix.mak
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-02-16 03:30:52 UTC
A commit references this bug:

Author: cy
Date: Tue Feb 16 03:30:06 UTC 2016
New revision: 408973
URL: https://svnweb.freebsd.org/changeset/ports/408973

Log:
  Correctly locate dmd.conf.

  PR:		207233

Changes:
  head/lang/dmd2/Makefile
Comment 6 Cy Schubert freebsd_committer freebsd_triage 2016-02-16 03:32:18 UTC
Fixed.
Comment 7 Stas Miasnikoǔ 2016-02-16 11:16:57 UTC
I am sorry it's still broken in the same way. Turns out the line you deleted was never a source of the problem.

IIUC the problem lies in a duplication of work by files/patch-src__dmd__posix.mak and the substitutions in the port's Makefile. I am not sure what's the right way to do it. Probably in port's Makefile to be consistent between Makefile and Makefile.bootstrap.

Could you please have another look?
Comment 8 commit-hook freebsd_committer freebsd_triage 2016-02-16 14:21:01 UTC
A commit references this bug:

Author: cy
Date: Tue Feb 16 14:20:13 UTC 2016
New revision: 408998
URL: https://svnweb.freebsd.org/changeset/ports/408998

Log:
  Do not hard code SYSCONFDIR. This inadvertently was included in r407421.

  PR:		207233
  Noticed by:	gahr
  Pointy hat to:	yours truly

Changes:
  head/lang/dmd2/Makefile
  head/lang/dmd2/files/patch-src__dmd__posix.mak