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

Michael Herndon commented on LUCENENET-454:
-------------------------------------------

Jira comments wouldn't work from my phone....

Let me know if you need any help. I've debating on creating custom
build tasks for clean and such since it does not handle folders and its
harder to script preventative measures than it should be. Powershell
would have been easier, build the scripts need to work with mono as
well.

Sent from my Windows Phone From: Christopher Currens (Created) (JIRA)
Sent: Saturday, November 05, 2011 10:01 PM
To: lucene-net-dev@lucene.apache.org
Subject: [Lucene.Net] [jira] [Created] (LUCENENET-454) MSBuild may wipe
entire root drive if bad parameters are passed to build.targets
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

                
> 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

        

Reply via email to