[Issue 5243] dmd -run potentially removes user files

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 8 07:31:30 PST 2013


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



--- Comment #5 from Leandro Lucarella <leandro.lucarella at sociomantic.com> 2013-01-08 07:31:29 PST ---
(In reply to comment #3)
> (In reply to comment #2)
> > Can you convert this into a pull request? It will make reviewing more easy.
> 
> I'll do it later tonight.

Thanks!

> > All your changes are POSIX only, is the overwriting not happening on Windows?
> 
> No because executables on win32 always end with .exe. Even if you do "dmd
> -oftest", DMD will still append an .exe .

But you can accidentally overwrite another .exe file, maybe something you
compiled before and now you want to do some temporary test without overwriting
that file? I know it looks unlikely, but I think -run should never overwrite
any files.

Anyway, your patch is certainly a progress :)

> > Finally, any reason for declaring getuid() manually instead of including the
> > appropriate headers?
> 
> The DMC header is unistd.h, but the front-end is also used by GDC and LDC, I
> don't know which headers they use for this function. It seemed easiest to just
> declare the function rather than to include an entire header (remember that
> includes are costly for compile-times in C++).

POSIX says it is in unistd.h, so I guess we can trust different platforms to
provide it in that header :)

http://pubs.opengroup.org/onlinepubs/009695299/functions/getuid.html

I will add these comments to the pull request too, just for convenience.

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


More information about the Digitalmars-d-bugs mailing list