digitalmars.D.bugs - [Issue 8734] New: Compiler must verify exe path is writable before attempting compilation
- d-bugmail puremagic.com (54/54) Sep 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8734
- d-bugmail puremagic.com (10/10) Sep 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8734
- d-bugmail puremagic.com (16/17) Sep 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8734
- d-bugmail puremagic.com (6/6) Sep 28 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8734
- d-bugmail puremagic.com (18/19) Sep 29 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8734
http://d.puremagic.com/issues/show_bug.cgi?id=8734 Summary: Compiler must verify exe path is writable before attempting compilation Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 18:30:07 PDT --- Windows example: test1.d: module test; import std.stdio; import std.process; void main() { system("echo > test.exe"); auto file = File("test.exe", "r"); system("dmd test2.d -oftest.exe"); } test2.d: module test2; import std.string; string mixMe() { string res; foreach (i; 0 .. 3_000) res ~= xformat("int i_%s;", i); return res; } mixin(mixMe()); void main() { } $ rdmd test1.d OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html OPTLINK : Error 3: Cannot Create File test.exe --- errorlevel 1 test2.d demonstrates a module that takes a longer while to compile. test1.d creates a phony test.exe, then opens it in read-mode to lock it. Then it attempts to compile test2.d and write over test.exe. DMD will first compile test2.d and only then attempt to write to test.exe and fail. This can be a considerate waste of time, the compiler should check if the output location is writable *before* attempting to compile. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 28 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8734 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 19:21:24 PDT --- I'm not seeing why this is an issue. Does this come up a lot for you? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 28 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8734 19:29:10 PDT ---I'm not seeing why this is an issue. Does this come up a lot for you?It takes about half a minute to build one of my projects but I forgot to close down the previously compiled application when doing so, so I've had to recompile again. This could be integrated into a build system, or even RDMD, but I thought it would be nice to put the check directly into DMD. If you believe the check would slow things down then I guess we can live without the feature. It could be implemented as a simple system() call, e.g. pseudocode: if (system("echo > main.exe") == -1) // error, couldn't overwrite file { } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 28 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8734 23:29:56 PDT --- I think it would slow things down in general. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 28 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8734 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX 08:54:30 PDT ---I think it would slow things down in general.Ok I'm closing it. Anyway here's a win32 batch workaround: echo off set "exePath=test.exe" echo x > %exePath% || goto :ERROR goto :EOF :ERROR echo Can't write to "%exePath%". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 29 2012