You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jim Talbut <jt...@spudsoft.co.uk> on 2010/03/24 21:14:30 UTC
Building camel from source deletes C:\Temp\*
Hi,
Building camel from source on Windows (Vista 64 bit) deletes everything
in C:\Temp\*
I think it's one of the unit tests but a quick look hasn't shown up which.
That is a major bad thing for it to do - it's deleted lots of things
from my machine that I did not want to lose.
Jim
Re: Building camel from source deletes C:\Temp\*
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Mar 26, 2010 at 9:46 AM, Jim Talbut <jt...@spudsoft.co.uk> wrote:
> On 26/03/2010 08:12, Claus Ibsen wrote:
>>
>> Its your stupidity to store files you want to keep in the TEMP folder.
>>
>
> I don't see much point in hurling abuse about it: you accept that your code
> shouldn't delete files that it didn't create and I'll accept that I ought to
> organise my files better.
> Deal?
> At least I have a clean slate to work from now :)
>
>> The test is supposed to be run manually and the test was disabled. But
>> unfortunately JUnit is so lame that it fails if a Test class have no
>> testXXX method and thus a testDummy was added. Which causes it to run
>> the setup method. I have fixed that so it wont delete the TEMP folder.
>>
>
> Although it is much less likely to affect anyone your fix is still making
> assumptions and absolutely deleting a hardcoded path (and then not deleting
> the path it creates after its finished).
> You've also still got possible permissions problems because of the hardcoded
> path (though again, less likely to be affected because default permissions
> on Windows will allow you to create C:\Tmp even though they shouldn't).
> I prefer something like this:
>
> private String getUniqueTempDir( ) {
> try {
> File tempFile = java.io.File.createTempFile(
> "FileConsumerAbsoluteRootPathDefaultMoveTest", null );
> tempFile.delete();
> return tempFile.getAbsolutePath();
> } catch( Exception ex ) {
> return null;
> }
> }
>
> @Override
> protected void setUp() throws Exception {
> base = getUniqueTempDir();
> deleteDirectory(base);
> super.setUp();
> }
>
> @Override
> protected void tearDown() throws Exception {
> super.tearDown();
> deleteDirectory(base);
> }
>
> Jim
>
>
The test is a manual test to test issues on Windows about using absolute path.
The test is only supposed to be run manually when we got reports about
issues on Windows with the file component.
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: Building camel from source deletes C:\Temp\*
Posted by Jim Talbut <jt...@spudsoft.co.uk>.
On 26/03/2010 08:12, Claus Ibsen wrote:
> Its your stupidity to store files you want to keep in the TEMP folder.
>
I don't see much point in hurling abuse about it: you accept that your
code shouldn't delete files that it didn't create and I'll accept that I
ought to organise my files better.
Deal?
At least I have a clean slate to work from now :)
> The test is supposed to be run manually and the test was disabled. But
> unfortunately JUnit is so lame that it fails if a Test class have no
> testXXX method and thus a testDummy was added. Which causes it to run
> the setup method. I have fixed that so it wont delete the TEMP folder.
>
Although it is much less likely to affect anyone your fix is still
making assumptions and absolutely deleting a hardcoded path (and then
not deleting the path it creates after its finished).
You've also still got possible permissions problems because of the
hardcoded path (though again, less likely to be affected because default
permissions on Windows will allow you to create C:\Tmp even though they
shouldn't).
I prefer something like this:
private String getUniqueTempDir( ) {
try {
File tempFile = java.io.File.createTempFile(
"FileConsumerAbsoluteRootPathDefaultMoveTest", null );
tempFile.delete();
return tempFile.getAbsolutePath();
} catch( Exception ex ) {
return null;
}
}
@Override
protected void setUp() throws Exception {
base = getUniqueTempDir();
deleteDirectory(base);
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
deleteDirectory(base);
}
Jim
Re: Building camel from source deletes C:\Temp\*
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Mar 26, 2010 at 8:53 AM, Jim Talbut <jt...@spudsoft.co.uk> wrote:
> On 25/03/2010 08:02, Claus Ibsen wrote:
>>
>> Well the temp folder is there for a reason since its a temp folder. If
>> you want to keep stuff use a NON temp folder :)
>>
>
> That's just a joke isn't it - the folder C:\Temp is not %TMP% or %TEMP%;
> there is nothing giving an application permission to delete its contents;
> deleting files effecitvely at random can break other running processes.
> It's just plain bad.
> Rant over.
>
Its your stupidity to store files you want to keep in the TEMP folder.
> If you want the funny side, at first I checked out the camel sourcecode into
> C:\Temp - took me ages to work out why I'd got a self deleting source tree
> :)
>
>> You are welcome to search the unit tests to see if you can find the
>> tests which may delete that folder.
>>
>
> Searching didn't find it, I ran the whole set of unit tests under procmon
> and that found it: FileConsumerAbsoluteRootPathDefaultMoveTest.
>
> I've created a jira for it:
> https://issues.apache.org/activemq/browse/CAMEL-2578
>
>> Mind that its uses the Java temp folder as Unix machines uses /tmp
>>
>
> That's the problem, it doesn't, it just blindly assumes that it has the
> right to delete and recreate "/temp" (hardcoded).
>
> Anyway, I can provide a patch easily but I'm not sure what the test is
> supposed to be testing.
> The correct fix would be to base something off File.createTempFile(), but is
> the test trying to validate that a path such as "/temp" works in a platform
> agnostic way?
> Note though that "/temp" won't work as a normal user on most linux boxes, so
> I'd rather change it to use File.createTempFile().
>
> Your call...
>
> Jim
>
The test is supposed to be run manually and the test was disabled. But
unfortunately JUnit is so lame that it fails if a Test class have no
testXXX method and thus a testDummy was added. Which causes it to run
the setup method. I have fixed that so it wont delete the TEMP folder.
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: Building camel from source deletes C:\Temp\*
Posted by Jim Talbut <jt...@spudsoft.co.uk>.
On 25/03/2010 08:02, Claus Ibsen wrote:
> Well the temp folder is there for a reason since its a temp folder. If
> you want to keep stuff use a NON temp folder :)
>
That's just a joke isn't it - the folder C:\Temp is not %TMP% or %TEMP%;
there is nothing giving an application permission to delete its
contents; deleting files effecitvely at random can break other running
processes.
It's just plain bad.
Rant over.
If you want the funny side, at first I checked out the camel sourcecode
into C:\Temp - took me ages to work out why I'd got a self deleting
source tree :)
> You are welcome to search the unit tests to see if you can find the
> tests which may delete that folder.
>
Searching didn't find it, I ran the whole set of unit tests under
procmon and that found it: FileConsumerAbsoluteRootPathDefaultMoveTest.
I've created a jira for it:
https://issues.apache.org/activemq/browse/CAMEL-2578
> Mind that its uses the Java temp folder as Unix machines uses /tmp
>
That's the problem, it doesn't, it just blindly assumes that it has the
right to delete and recreate "/temp" (hardcoded).
Anyway, I can provide a patch easily but I'm not sure what the test is
supposed to be testing.
The correct fix would be to base something off File.createTempFile(),
but is the test trying to validate that a path such as "/temp" works in
a platform agnostic way?
Note though that "/temp" won't work as a normal user on most linux
boxes, so I'd rather change it to use File.createTempFile().
Your call...
Jim
Re: Building camel from source deletes C:\Temp\*
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Well the temp folder is there for a reason since its a temp folder. If
you want to keep stuff use a NON temp folder :)
You are welcome to search the unit tests to see if you can find the
tests which may delete that folder.
Mind that its uses the Java temp folder as Unix machines uses /tmp
On Wed, Mar 24, 2010 at 9:14 PM, Jim Talbut <jt...@spudsoft.co.uk> wrote:
> Hi,
>
> Building camel from source on Windows (Vista 64 bit) deletes everything in
> C:\Temp\*
> I think it's one of the unit tests but a quick look hasn't shown up which.
> That is a major bad thing for it to do - it's deleted lots of things from my
> machine that I did not want to lose.
>
> Jim
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus