www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3547] New: for option -od for relative path the path is added twice

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3547

           Summary: for option -od for relative path the path is added
                    twice
           Product: D
           Version: 2.036
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: y0uf00bar gmail.com



When I specified a -od, <objpath> , a double level of 2 directories was created
in my current directory, and the object file place theirin, namely
<./objpath/objpath/myobjfile.o, for both linux, dmd, dmd 1.0 and dmd 2.0.

An examination of the mars.c source and module.c source for the string
"global.params.objdir" shows under these conditions the string passed in the
options is concantenated twice.

In mars.c

line 713 if (global.params.link)
    {..

    if(global.params.objname)
    {
    // name as the exe file.

        if (global.params.objdir)
        {
        ..
        global.params.objname = 

FileName::combine(global.params.objdir,name)


And in module.c

line 136

if (global.params.objname)
    // objdir must be already combined by here!
    argobj = global.params.objname;

..

if (!FileName::absolute(argobj))
{
// objdir is combined again, because already in global.params.objname

    argobj = 

FileName::combine(global.params.objdir, argobj);
}

I was testing a little XML configuration build tool, and dmd refused to make
just one level of relative directory.

The workaround would seem to be to work out the absolute path and pass that to
the option.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 24 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3547


Vladimir <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |thecybershadow gmail.com
            Version|2.036                       |2.014
           Severity|trivial                     |regression



---
Some more findings:
 - this is a regression in DMD 2.014 / 1.030
 - the bug only manifests when the -of option is present

Attaching a patch which fixes it. The patch changes the module.c code to not
prepend global.params.objdir to filename if global.params.objname is set (in
which case, the prepending had already been done in mars.c).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 17 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3547




---
Created an attachment (id=525)
Proposed patch

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 17 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3547


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



10:56:47 PDT ---
http://www.dsource.org/projects/dmd/changeset/516

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 02 2010