D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13758 - RDMD renames directory if -ofNAME is the name of a directory
Summary: RDMD renames directory if -ofNAME is the name of a directory
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: tools (show other issues)
Version: D2
Hardware: All Linux
: P1 normal
Assignee: No Owner
URL:
Keywords: preapproved, pull
Depends on:
Blocks:
 
Reported: 2014-11-20 13:51 UTC by Andrej Mitrovic
Modified: 2015-06-18 16:54 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2014-11-20 13:51:20 UTC
-----
~/somedir $ mkdir foo
~/somedir $ echo asdf > foo/bar
~/somedir $ ls foo
> bar
~/somedir $ echo "void main() { }" > app.d
~/somedir $ rdmd -offoo app.d
~/somedir $ ls
app.d  foo  foo.635520880476161823-23425.old
-----

The "foo.hash.old" is the old folder which was renamed to make place for the 'foo' executable.

I don't think RDMD should have the power to move things around like that. It should fail compilation if the output name would overwrite the directory, with optionally providing a special switch for when you really need this behavior (I don't see the point of the feature though..).
Comment 1 Andrei Alexandrescu 2015-04-30 22:19:08 UTC
Yes please. Have it fail. Will preapprove, thanks.
Comment 2 Vladimir Panteleev 2015-05-01 05:42:24 UTC
https://github.com/D-Programming-Language/tools/pull/167

(In reply to Andrej Mitrovic from comment #0)
> I don't think RDMD should have the power to move things around like that. It
> should fail compilation if the output name would overwrite the directory,
> with optionally providing a special switch for when you really need this
> behavior (I don't see the point of the feature though..).

I added the renaming thing to work around Windows locking executable files that are still running. I just hadn't thought that on Posix executable don't have an extension, and writing the executable file might happen because the output file is actually a directory.
Comment 3 github-bugzilla 2015-06-15 21:09:20 UTC
Commits pushed to master at https://github.com/D-Programming-Language/tools

https://github.com/D-Programming-Language/tools/commit/7b655a13ce020232b625fabaaea5918fad18fcc2
fix Issue 13758 - RDMD renames directory if -ofNAME is the name of a directory

https://github.com/D-Programming-Language/tools/commit/55e5dc6312edbf947cbd775ad34cd25104184c2a
Merge pull request #167 from CyberShadow/pull-20150501-053027-13758

fix Issue 13758 - RDMD renames directory if -ofNAME is the name of a dir...
Comment 4 github-bugzilla 2015-06-18 16:54:41 UTC
Commits pushed to stable at https://github.com/D-Programming-Language/tools

https://github.com/D-Programming-Language/tools/commit/7b655a13ce020232b625fabaaea5918fad18fcc2
fix Issue 13758 - RDMD renames directory if -ofNAME is the name of a directory

https://github.com/D-Programming-Language/tools/commit/55e5dc6312edbf947cbd775ad34cd25104184c2a
Merge pull request #167 from CyberShadow/pull-20150501-053027-13758