www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Temporary files for `-run`

reply Johan Engelen <j j.nl> writes:
I think at the moment "ldc2 -run program.d" cannot be run 
multiple times in parallel (I hit this issue while writing some 
lit-based tests). LDC will generate the same temporary files for 
each parallel run and will delete them, resulting in strange 
problems when different processes are deleting/accessing the 
files in an unfortunate sequence.

My question to you:
does it make sense to work on a PR to generate "random" obj+exe 
filenames for "-run" ?

cheers,
   Johan
Apr 30 2016
parent reply Joakim <dlang joakim.fea.st> writes:
On Saturday, 30 April 2016 at 09:09:07 UTC, Johan Engelen wrote:
 I think at the moment "ldc2 -run program.d" cannot be run 
 multiple times in parallel (I hit this issue while writing some 
 lit-based tests). LDC will generate the same temporary files 
 for each parallel run and will delete them, resulting in 
 strange problems when different processes are 
 deleting/accessing the files in an unfortunate sequence.

 My question to you:
 does it make sense to work on a PR to generate "random" obj+exe 
 filenames for "-run" ?

 cheers,
   Johan
Yes, that's the way it should be, makes no sense not to randomize that way for single runs.
Apr 30 2016
parent reply Johan Engelen <j j.nl> writes:
On Saturday, 30 April 2016 at 16:42:01 UTC, Joakim wrote:
 On Saturday, 30 April 2016 at 09:09:07 UTC, Johan Engelen wrote:
 I think at the moment "ldc2 -run program.d" cannot be run 
 multiple times in parallel (I hit this issue while writing 
 some lit-based tests). LDC will generate the same temporary 
 files for each parallel run and will delete them, resulting in 
 strange problems when different processes are 
 deleting/accessing the files in an unfortunate sequence.

 My question to you:
 does it make sense to work on a PR to generate "random" 
 obj+exe filenames for "-run" ?

 cheers,
   Johan
Yes, that's the way it should be, makes no sense not to randomize that way for single runs.
Already working on the PR! But... linker errors will show the temporary filenames. I was thinking about creating a random temporary folder but then the problem is that I have to add logic to delete that folder after execution... Is it OK if linker errors will show funny filenames? (aren't linker errors supposed to be incomprehensible? ;-))
Apr 30 2016
next sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Saturday, 30 April 2016 at 16:59:30 UTC, Johan Engelen wrote:
 On Saturday, 30 April 2016 at 16:42:01 UTC, Joakim wrote:
 On Saturday, 30 April 2016 at 09:09:07 UTC, Johan Engelen 
 wrote:
   [...]
Yes, that's the way it should be, makes no sense not to randomize that way for single runs.
Already working on the PR! But... linker errors will show the temporary filenames. I was thinking about creating a random temporary folder but then the problem is that I have to add logic to delete that folder after execution... Is it OK if linker errors will show funny filenames? (aren't linker errors supposed to be incomprehensible? ;-))
If you prefix runTemp before the random string, it'll help.
Apr 30 2016
parent David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc puremagic.com> writes:
On 30 Apr 2016, at 18:43, Joakim via digitalmars-d-ldc wrote:
 On Saturday, 30 April 2016 at 16:59:30 UTC, Johan Engelen wrote:
 But... linker errors will show the temporary filenames. I was 
 thinking about creating a random temporary folder but then the 
 problem is that I have to add logic to delete that folder after 
 execution... Is it OK if linker errors will show funny filenames? 
 (aren't linker errors supposed to be incomprehensible? ;-))
If you prefix runTemp before the random string, it'll help.
You could also go for a random directory name inside the system temp path, where people pretty much expect "funny names". — David
Apr 30 2016
prev sibling parent reply Johan Engelen <j j.nl> writes:
On Saturday, 30 April 2016 at 16:59:30 UTC, Johan Engelen wrote:
 Is it OK if linker errors will show funny filenames?
What I meant is that, with my current implementation, you will no longer be able to see which source file has an unresolved symbol (say), because the object name will be "tmp_09AB4512.o". It's more a case of lazyness of the implementer, I think...
Apr 30 2016
parent Johan Engelen <j j.nl> writes:
On Saturday, 30 April 2016 at 18:43:47 UTC, Johan Engelen wrote:
 
 It's more a case of lazyness of the implementer
Fixed that. https://github.com/ldc-developers/ldc/pull/1470
Apr 30 2016