Removing smbolic links

View: New views
3 Messages — Rating Filter:   Alert me  

Removing smbolic links

by aha-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello All,
  Sometimes when I execute my clean target it fails because files can't be deleted. For example, if I have a build file that looks as follows:

<?xml version="1.0"?>
<project name="sym" default="build" basedir=".">
  <target name="build">
    <touch file="foo.so" />
    <exec program="/bin/ln">
      <arg line="-s /home/aha/devel/nant/foo.so foo.so.0" />
    </exec>
  </target>
  <target name="clean">
    <delete file="/home/aha/devel/nant/foo.so" />
    <delete file="/home/aha/devel/nant/foo.so.0" />
  </target>
</project>

And then execute it as follows:

[aha@charm nant]$ nant
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///home/aha/devel/nant/sym.build
Target framework: Mono 2.0 Profile
Target(s) specified: build


build:


BUILD SUCCEEDED

Total time: 0.1 seconds.

[aha@charm nant]$ ls
foo.so  foo.so.0  sym.build  sym.build~

and finally execute the clean target:

[aha@charm nant]$ nant clean
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///home/aha/devel/nant/sym.build
Target framework: Mono 2.0 Profile
Target(s) specified: clean


clean:

   [delete] Deleting file /home/aha/devel/nant/foo.so.
   [delete] Deleting file /home/aha/devel/nant/foo.so.0.

BUILD FAILED

/home/aha/devel/nant/sym.build(11,6):
Cannot delete file '/home/aha/devel/nant/foo.so.0'.
    Could not find file "/home/aha/devel/nant/foo.so.0"

Total time: 0 seconds.

Now I know that Windows does not support symbolic links, and from looking at the source code the problem is that
System.IO.FileInfo.Exsits is false for symbolic links. And DeleteTask.cs contains the line of code:

if (!deleteInfo.Exists) {
   return;
}

Which causes the function to exit before actually deleting the file, I didn't follow the trail any farther than that, but I was wondering if anyone new if NAnt 0.86 supports the deletion of symbolic links?

I've been thinking about a couple of implementations using Mono, however, it requires the use of a Library that is not Standard in the .NET Framework, namely Mono.Unix.Native (yes I know it's been deprecated).  Anyway, I am just wondering what others have tried.

--
Aquil H. Abdullah
aquil.abdullah@...

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
NAnt-users@...
https://lists.sourceforge.net/lists/listinfo/nant-users

Re: Removing smbolic links

by gertdriesen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Aquil,

 

This should work using a recent version of Mono (built from SVN HEAD).

 

Gert

 

From: nant-users-bounces@... [mailto:nant-users-bounces@...] On Behalf Of Aquil H. Abdullah
Sent: woensdag 23 juli 2008 19:48
To: nant-users@...
Subject: [NAnt-users] Removing smbolic links

 

Hello All,
  Sometimes when I execute my clean target it fails because files can't be deleted. For example, if I have a build file that looks as follows:

<?xml version="1.0"?>
<project name="sym" default="build" basedir=".">
  <target name="build">
    <touch file="foo.so" />
    <exec program="/bin/ln">
      <arg line="-s /home/aha/devel/nant/foo.so foo.so.0" />
    </exec>
  </target>
  <target name="clean">
    <delete file="/home/aha/devel/nant/foo.so" />
    <delete file="/home/aha/devel/nant/foo.so.0" />
  </target>
</project>

And then execute it as follows:

[aha@charm nant]$ nant
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///home/aha/devel/nant/sym.build
Target framework: Mono 2.0 Profile
Target(s) specified: build


build:


BUILD SUCCEEDED

Total time: 0.1 seconds.

[aha@charm nant]$ ls
foo.so  foo.so.0  sym.build  sym.build~

and finally execute the clean target:

[aha@charm nant]$ nant clean
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///home/aha/devel/nant/sym.build
Target framework: Mono 2.0 Profile
Target(s) specified: clean


clean:

   [delete] Deleting file /home/aha/devel/nant/foo.so.
   [delete] Deleting file /home/aha/devel/nant/foo.so.0.

BUILD FAILED

/home/aha/devel/nant/sym.build(11,6):
Cannot delete file '/home/aha/devel/nant/foo.so.0'.
    Could not find file "/home/aha/devel/nant/foo.so.0"

Total time: 0 seconds.

Now I know that Windows does not support symbolic links, and from looking at the source code the problem is that
System.IO.FileInfo.Exsits is false for symbolic links. And DeleteTask.cs contains the line of code:

if (!deleteInfo.Exists) {
   return;
}

Which causes the function to exit before actually deleting the file, I didn't follow the trail any farther than that, but I was wondering if anyone new if NAnt 0.86 supports the deletion of symbolic links?

I've been thinking about a couple of implementations using Mono, however, it requires the use of a Library that is not Standard in the .NET Framework, namely Mono.Unix.Native (yes I know it's been deprecated).  Anyway, I am just wondering what others have tried.

--
Aquil H. Abdullah
aquil.abdullah@...


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
NAnt-users@...
https://lists.sourceforge.net/lists/listinfo/nant-users

Parent Message unknown Re: Removing smbolic links

by aha-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks I'll give it a try.

On Wed, Jul 23, 2008 at 2:29 PM, Gert Driesen <gert.driesen@...> wrote:

Aquil,

 

This should work using a recent version of Mono (built from SVN HEAD).

 

Gert

 

From: nant-users-bounces@... [mailto:nant-users-bounces@...] On Behalf Of Aquil H. Abdullah
Sent: woensdag 23 juli 2008 19:48
To: nant-users@...
Subject: [NAnt-users] Removing smbolic links

 

Hello All,
  Sometimes when I execute my clean target it fails because files can't be deleted. For example, if I have a build file that looks as follows:

<?xml version="1.0"?>
<project name="sym" default="build" basedir=".">
  <target name="build">
    <touch file="foo.so" />
    <exec program="/bin/ln">
      <arg line="-s /home/aha/devel/nant/foo.so foo.so.0" />
    </exec>
  </target>
  <target name="clean">
    <delete file="/home/aha/devel/nant/foo.so" />
    <delete file="/home/aha/devel/nant/foo.so.0" />
  </target>
</project>

And then execute it as follows:

[aha@charm nant]$ nant
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///home/aha/devel/nant/sym.build
Target framework: Mono 2.0 Profile
Target(s) specified: build


build:


BUILD SUCCEEDED

Total time: 0.1 seconds.

[aha@charm nant]$ ls
foo.so  foo.so.0  sym.build  sym.build~

and finally execute the clean target:

[aha@charm nant]$ nant clean
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///home/aha/devel/nant/sym.build
Target framework: Mono 2.0 Profile
Target(s) specified: clean


clean:

   [delete] Deleting file /home/aha/devel/nant/foo.so.
   [delete] Deleting file /home/aha/devel/nant/foo.so.0.

BUILD FAILED

/home/aha/devel/nant/sym.build(11,6):
Cannot delete file '/home/aha/devel/nant/foo.so.0'.
    Could not find file "/home/aha/devel/nant/foo.so.0"

Total time: 0 seconds.

Now I know that Windows does not support symbolic links, and from looking at the source code the problem is that
System.IO.FileInfo.Exsits is false for symbolic links. And DeleteTask.cs contains the line of code:

if (!deleteInfo.Exists) {
   return;
}

Which causes the function to exit before actually deleting the file, I didn't follow the trail any farther than that, but I was wondering if anyone new if NAnt 0.86 supports the deletion of symbolic links?

I've been thinking about a couple of implementations using Mono, however, it requires the use of a Library that is not Standard in the .NET Framework, namely Mono.Unix.Native (yes I know it's been deprecated).  Anyway, I am just wondering what others have tried.

--
Aquil H. Abdullah
aquil.abdullah@...




--
Aquil H. Abdullah
aquil.abdullah@...

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
NAnt-users mailing list
NAnt-users@...
https://lists.sourceforge.net/lists/listinfo/nant-users
LightInTheBox - Buy quality products at wholesale price