You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Christopher Currens (Commented) (JIRA)" <ji...@apache.org> on 2011/11/06 03:06:51 UTC

[Lucene.Net] [jira] [Commented] (LUCENENET-454) MSBuild may wipe entire root drive if bad parameters are passed to build.targets

    [ https://issues.apache.org/jira/browse/LUCENENET-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144887#comment-13144887 ] 

Christopher Currens commented on LUCENENET-454:
-----------------------------------------------

I should add that this bug was actually found when trying to run the Build.cmd script, which would accidentally pass "all" (with quotes) to to the "Area" property that MSBuild would expect.  This caused the above behavior when no project was imported that defined "ArtifactsFolder"  However, this bug extends past this, since a bad area can easily be typed by mistake into a command window.
                
> MSBuild may wipe entire root drive if bad parameters are passed to build.targets
> --------------------------------------------------------------------------------
>
>                 Key: LUCENENET-454
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-454
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Build Automation
>            Reporter: Christopher Currens
>            Priority: Critical
>
> If the Area variable is passed to MSBuild and includes quotes or doesn't match a valid target area, MSBuild populates the "CleanFiles" ItemGroup with every file on the local harddrive.  When the clean step is run, all files on the drive will be deleted!
> This can be reproduced with the following command (I do not recommend reproducing this unless you've taken precautions to protect your data).
> MSBuild.exe build.targets /t:all /p:Area=invalidareaname
> The causes "ArtifactsFolder" to never be populated.  "CleanFiles" then gathers a list of files from "\**\*.*" instead of "valid\path\**\*.*" which, at least on windows computers, evaluates out to "D:\**\*.*", or all files on my local hard drive.
> One solution would be to force MSBuild to throw an error if "ArtifactsFolder" is empty during the clean target.  In fact, we should make a note to check every place we're calling the Delete task, and make sure we do sanity checks on the variables involved in gathering the files to delete.
> I'm testing a fix for it right now, and if it seems to work, I'll be committing it tonight.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira