Nmap Development mailing list archives

Re: [Patch] Forcibly copy scripts to overwrite .svn files


From: David Fifield <david () bamsoftware com>
Date: Sat, 19 May 2007 21:53:50 -0600

On Fri, May 18, 2007 at 09:46:57PM -0700, Fyodor wrote:
On Fri, May 18, 2007 at 01:57:18PM -0600, David Fifield wrote:

This patch just adds the -f flag to cp to force the overwriting of
the
files. The real solution is to keep from installing the .svn
directories, but this patch is probably desirable even in that case.

Hi David.  Good points.  But I agree with you that a better solution
is not to copy the .svn files in the first place.  We don't want a
bunch of .svn crap in the install directory.  Would you make a patch
which just copies the files we need instead of doing -f?  If you check
it into the soc07 tree and let us know on nmap-dev, I can merge it
into /nmap.  So that will be a good test for us of that process as
well.

I spent some time thinking of how to do this portably. This is what I
came up with:

install-nse: $(TARGET)
# If this is a Subversion working copy, export the scripts directory to
# avoid copying .svn directories. Otherwise, do a plain recursive copy.
        if test -d .svn; then \
                svn export --force scripts $(DESTDIR)$(nmapdatadir)/scripts; \
        else \  
                cp -rf scripts/ $(DESTDIR)$(nmapdatadir)/; \
        fi

I've committed this to /nmap-exp/soc07/nmap.

I found a few other solutions on the web involving rsync or trickery
with the tar or find commands, but they weren't portable to the Solaris
machine I tried them on. If a .svn directory exists, we can be
reasonably sure that the svn command is installed.

One potential problem with this approach is that if a developer creates
a new script and doesn't svn add it, it won't get installed because
export won't see it. I should also mention that it makes me uneasy to do
two different things depending on the type of distribution. Maybe it's
better to leave things like they were; I can live with .svn directories
when installing from Subversion, if it means avoiding subtle bugs in the
future.

Another possibility is to do the recursive copy and then delete all the
.svn directories from the installation directory.

If we don't really need a recursive copy (the scripts directory doesn't
contain any subdirectories; I don't know if that's going to change),
solving this could be as simple as

install-nse: $(TARGET)
        $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(nmapdatadir)/scripts
        cp scripts/* $(DESTDIR)$(nmapdatadir)/scripts/

David Fifield

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: