You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dave <da...@gmail.com> on 2009/02/26 18:28:11 UTC

Delete task should be failing for UNC path that does not exist

The following reduced test case shows the problem. I've tested this with Ant
1.7.1 and JDK 1.4.2_19
=======================
<project name="delete-UNC-test">
    <property name="out.parent.dir"
value="\\my-unc-path-that-does-not-exist\tmp"/>
    <delete dir="${out.parent.dir}" verbose="true"/>
</project>
=======================

Can anyone help me with this?

-- 
"A lot of people are afraid of heights. Not me, I'm afraid of widths."

Re: Delete task should be failing for UNC path that does not exist

Posted by Dave <da...@gmail.com>.
It doesn't fail when the directory exists or does not exist.
However, when the directory does exist, it is not deleted.
It should either succeed and deleted the directory, or fail if it can't
delete the directory or the directory does not exist.
However, it's succeeding for all cases.

On Thu, Feb 26, 2009 at 5:56 PM, David Weintraub <qa...@gmail.com> wrote:

> Does it fail when the directory does exist?
>
> Try printing out "out.parent.dir" and see what it is equal to:
>
> <echo message="out.parent.dir = &quot;${out.parent.dir}&quot;"/>
>
> Maybe the backslashes are being misinterpreted somehow.
>
> Another possibility has to do with the way UNC paths work. Ant may not
> be playing so friendly with them. It could be that Ant is receiving
> the message that the path exists before it tries a delete, but then
> when it tries a delete, it gets the deletion failed message. I am not
> a Windows developer, so I can't say for certain what is going on.
>
> You might want to try the <available> command to test for the
> directory before doing the delete as a workaround.
>
>
> On Thu, Feb 26, 2009 at 12:28 PM, Dave <da...@gmail.com> wrote:
> > The following reduced test case shows the problem. I've tested this with
> Ant
> > 1.7.1 and JDK 1.4.2_19
> > =======================
> > <project name="delete-UNC-test">
> >    <property name="out.parent.dir"
> > value="\\my-unc-path-that-does-not-exist\tmp"/>
> >    <delete dir="${out.parent.dir}" verbose="true"/>
> > </project>
> > =======================
> >
> > Can anyone help me with this?
> >
> > --
> > "A lot of people are afraid of heights. Not me, I'm afraid of widths."
> >
>
>
>
> --
> --
> David Weintraub
> qazwart@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
"A lot of people are afraid of heights. Not me, I'm afraid of widths."

Re: Delete task should be failing for UNC path that does not exist

Posted by David Weintraub <qa...@gmail.com>.
Does it fail when the directory does exist?

Try printing out "out.parent.dir" and see what it is equal to:

<echo message="out.parent.dir = &quot;${out.parent.dir}&quot;"/>

Maybe the backslashes are being misinterpreted somehow.

Another possibility has to do with the way UNC paths work. Ant may not
be playing so friendly with them. It could be that Ant is receiving
the message that the path exists before it tries a delete, but then
when it tries a delete, it gets the deletion failed message. I am not
a Windows developer, so I can't say for certain what is going on.

You might want to try the <available> command to test for the
directory before doing the delete as a workaround.


On Thu, Feb 26, 2009 at 12:28 PM, Dave <da...@gmail.com> wrote:
> The following reduced test case shows the problem. I've tested this with Ant
> 1.7.1 and JDK 1.4.2_19
> =======================
> <project name="delete-UNC-test">
>    <property name="out.parent.dir"
> value="\\my-unc-path-that-does-not-exist\tmp"/>
>    <delete dir="${out.parent.dir}" verbose="true"/>
> </project>
> =======================
>
> Can anyone help me with this?
>
> --
> "A lot of people are afraid of heights. Not me, I'm afraid of widths."
>



-- 
--
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Delete task should be failing for UNC path that does not exist

Posted by Dominique Devienne <dd...@gmail.com>.
On Thu, Feb 26, 2009 at 12:57 PM, Dave <da...@gmail.com> wrote:
> Going by the first line of this, Ant should fail if the specified file or
> directory does not exist, no?

The manual is right, and my memory is faulty, that's all ;-) I think I
always use quiet="true"... --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Delete task should be failing for UNC path that does not exist

Posted by Dave <da...@gmail.com>.
According to the Ant Manual,
In relation to the quiet attribute of the delete task..

"If the specified file or directory does not exist, do not display a
diagnostic message (unless Ant has been invoked with the -verbose or
-debugswitches) or modify the exit status to reflect an error. When
set to "true",
if a file or directory cannot be deleted, no error is reported. This setting
emulates the -f option to the Unix *rm* command. Setting this to "true"
implies setting failonerror to "false". "

Going by the first line of this, Ant should fail if the specified file or
directory does not exist, no?

On Thu, Feb 26, 2009 at 6:48 PM, Dominique Devienne <dd...@gmail.com>wrote:

> On Thu, Feb 26, 2009 at 12:09 PM, Dave <da...@gmail.com> wrote:
> > However, I'm still curious as to why delete is silent when the UNC path
> > passed to it does not exist?
>
> I think that's true of any dir, not just UNC ones. --DD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
"A lot of people are afraid of heights. Not me, I'm afraid of widths."

Re: Delete task should be failing for UNC path that does not exist

Posted by Dominique Devienne <dd...@gmail.com>.
On Thu, Feb 26, 2009 at 12:09 PM, Dave <da...@gmail.com> wrote:
> However, I'm still curious as to why delete is silent when the UNC path
> passed to it does not exist?

I think that's true of any dir, not just UNC ones. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Delete task should be failing for UNC path that does not exist

Posted by David Weintraub <qa...@gmail.com>.
You need to set failonerror="true" to kill the build when the delete
fails. Of course, Ant is depending upon the OS to give it a "proper"
exit value from the delete command. I can't say for certain whether
UNC paths might be cause problems in this respect.

BTW, why are you using UNC anyway. Normally, you don't do things in
Ant outside of the ${basedir}.

On Thu, Feb 26, 2009 at 1:09 PM, Dave <da...@gmail.com> wrote:
> However, I'm still curious as to why delete is silent when the UNC path
> passed to it does not exist?



-- 
--
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Delete task should be failing for UNC path that does not exist

Posted by Dave <da...@gmail.com>.
Hey guys,
I had made a mistake in my test script to see if it failed when trying to
deleted a directory that does exist.
It does indeed fail, likely due to access permissions, as I cannot delete
the file through explorer either.
However, I'm still curious as to why delete is silent when the UNC path
passed to it does not exist?

On Thu, Feb 26, 2009 at 6:02 PM, Dominique Devienne <dd...@gmail.com>wrote:

> On Thu, Feb 26, 2009 at 11:28 AM, Dave <da...@gmail.com> wrote:
> > The following reduced test case shows the problem. I've tested this with
> Ant
> > 1.7.1 and JDK 1.4.2_19
> > =======================
> > <project name="delete-UNC-test">
> >    <property name="out.parent.dir"
> > value="\\my-unc-path-that-does-not-exist\tmp"/>
> >    <delete dir="${out.parent.dir}" verbose="true"/>
> > </project>
> > =======================
> >
> > Can anyone help me with this?
>
> UNC paths are so troublesome...
>
> You could try with <property location=""> instead of using the value
> attribute.
> If that doesn't work, you could force the script user(s) to map it to
> a drive letter.
> If that doesn't work, resort to <exec> using the DOS "cmd" shell as
> executable and using a DOS command to delete the dir (if you use
> absolute UNC paths, you're likely Windows only, no? If not, the os
> attribute of Exec can restrict the <exec> for a specific OS like
> windows).
>
> --DD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
"A lot of people are afraid of heights. Not me, I'm afraid of widths."

Re: Delete task should be failing for UNC path that does not exist

Posted by Dominique Devienne <dd...@gmail.com>.
On Thu, Feb 26, 2009 at 11:28 AM, Dave <da...@gmail.com> wrote:
> The following reduced test case shows the problem. I've tested this with Ant
> 1.7.1 and JDK 1.4.2_19
> =======================
> <project name="delete-UNC-test">
>    <property name="out.parent.dir"
> value="\\my-unc-path-that-does-not-exist\tmp"/>
>    <delete dir="${out.parent.dir}" verbose="true"/>
> </project>
> =======================
>
> Can anyone help me with this?

UNC paths are so troublesome...

You could try with <property location=""> instead of using the value attribute.
If that doesn't work, you could force the script user(s) to map it to
a drive letter.
If that doesn't work, resort to <exec> using the DOS "cmd" shell as
executable and using a DOS command to delete the dir (if you use
absolute UNC paths, you're likely Windows only, no? If not, the os
attribute of Exec can restrict the <exec> for a specific OS like
windows).

--DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org