Bug 18275 – dmd deletes source file fun.cpp with `dmd fun.cpp.o main.d`

Status
NEW
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2018-01-22T03:31:27Z
Last change time
2024-12-13T18:56:17Z
Assigned to
No Owner
Creator
Timothee Cour
Moved to GitHub: dmd#19368 →

Comments

Comment #0 by timothee.cour2 — 2018-01-22T03:31:27Z
``` fun.cpp:extern"C" void test(){} main.d:extern(C) void test(); void main(){} ``` clang++ -o fun.cpp.o -c fun.cpp dmd fun.cpp.o main.d (same bug with ldc2) this caused https://github.com/Syniurge/Calypso/issues/59 proposed fix: if `-of` explicitly passed on cmd line, fine, nothing to check if not, infer output file as we already do, but first assert(!file.exists) (regardless of what type of file it is, that's irrelevant) downside: dmd main2.d #creates main2 dmd main2.d #error main2 already exists, please specify -of=main2 explicitly to force write I think the downside is not as bad as the bug I reported which deletes source code and can be very damaging if the file wasn't backed up in its latest form, which is common in edit/compile/debug cycles
Comment #1 by dfj1esp02 — 2018-01-23T07:41:42Z
What `clang++ fun.cpp.o` does?
Comment #2 by var.spool.mail700 — 2018-04-06T15:57:23Z
is this the same bug? if i have 2 files with the same name, like this test test.d and execute dmd -D test dmd picks test.d and generates the test.html but deletes the test file.
Comment #3 by greensunny12 — 2018-04-06T16:02:00Z
(In reply to ArturG from comment #2) > is this the same bug? > if i have 2 files with the same name, like this > > test > test.d > > and execute dmd -D test > > dmd picks test.d and generates the test.html but deletes the test file. It's probably related, but it would be great if you could open a new issue for it, s.t. it can be properly tracked. Thanks!
Comment #4 by var.spool.mail700 — 2018-04-06T19:05:17Z
Comment #5 by robert.schadek — 2024-12-13T18:56:17Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19368 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB