Thread overview
rdmd -cov generates bad file names with absolute directories or .. directories in -I flag
Mar 18, 2013
timotheecour
Mar 18, 2013
Andrej Mitrovic
Mar 18, 2013
timotheecour
Mar 18, 2013
Andrej Mitrovic
Mar 18, 2013
Andrej Mitrovic
March 18, 2013
rdmd -cov /Users/timothee/test/test_01.d
creates a file "-Users-timothee-test-test_01.lst"

A)
This leading "-" in filename is very unix unfriendly, eg:
mv "-Users-timothee-test-test_01.lst" temp.lst
yields: mv: illegal option --U, etc.

Even worse in the following case:
rdmd --force -cov -I.. ../temp1/test_024.d
generates:
..-temp1-test_01.lst
which is invisible by ls (requires ls -a)
probably similar with ".".

Furthermore, similar problems occur if the user cds to the source package directory and adds a -I include flag that points to an absolute or ".." path.

B)
Can the file location be improved?
For example, replacing "-" with "_", and converting paths to use "buildNormalizedPath" to avoid ".." or "." in filename.

Also, why not add dmd flag : -covd=dirname, in which all lst files will be generated?

March 18, 2013
On 3/18/13, timotheecour <timothee.cour2@gmail.com> wrote:
> rdmd -cov /Users/timothee/test/test_01.d
> creates a file "-Users-timothee-test-test_01.lst"
>
> A)
> This leading "-" in filename is very unix unfriendly

It's not an RDMD issue, it's Druntime. Specifically the baseName function in src/rt/cover.d. This can easily be fixed.

> B)
> Can the file location be improved?
> For example, replacing "-" with "_", and converting paths to use
> "buildNormalizedPath" to avoid ".." or "." in filename.

The problem is Druntime can't have dependencies to Phobos.

> Also, why not add dmd flag : -covd=dirname, in which all lst files will be generated?

This could be an enhancement. Or we could make cov generation follow the -od switch.
March 18, 2013
> It's not an RDMD issue, it's Druntime. Specifically the baseName
> function in src/rt/cover.d. This can easily be fixed.

Should I file a BUG/enhancement request?

> The problem is Druntime can't have dependencies to Phobos.

Sure, I meant reusing same functionality (rewritten in C++) so there's no dependency.


> This could be an enhancement. Or we could make cov generation follow the -od switch.

No overloads, please: for example with rdmd, the output will be in a temp directory that the user shouldn't know about. An explicit switch would be needed, and the user can use same dir as for -od if he wishes to.

March 18, 2013
On 3/18/13, timotheecour <timothee.cour2@gmail.com> wrote:
> rdmd -cov /Users/timothee/test/test_01.d
> creates a file "-Users-timothee-test-test_01.lst"
>
> A)
> This leading "-" in filename is very unix unfriendly, eg:

http://d.puremagic.com/issues/show_bug.cgi?id=9751

There's a pull ready, which replaces invalid characters with an underscore. It also does this for periods to avoid the ..\foo.d or -I.. issue.

> Also, why not add dmd flag : -covd=dirname, in which all lst files will be generated?

File as enhancement: http://d.puremagic.com/issues/show_bug.cgi?id=9752
March 18, 2013
On 3/18/13, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> File as enhancement: http://d.puremagic.com/issues/show_bug.cgi?id=9752

*Filed*.