Nmap Development mailing list archives

Re: make install error - nselib/data/psexec - Potential Fix


From: Tom Sellers <nmap () fadedcode net>
Date: Fri, 13 Nov 2009 23:34:24 -0600

Corey Chandler wrote:
Ron wrote:
David Fifield wrote:
I made a mistake in the above commands. That still try to install
directories, but it happens to work because the for loop isolates the
error from make. This is better:

     $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
     $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data/psexec
for f in `find nselib/data -name .svn -prune -o -type f -print`; do \
         $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
     done

David Fifield


Well, another solution is to get rid of the 'psexec' folder in the data
directory and put all its files in 'data', but they're pretty specific
so it probably doesn't make sense.

I'll go with whatever solution you think is best. I'm not really a
Makefile expert, so I'll trust your capable hands.

Ron

Ok, I think I have this fixed.  Based on my reading of the problem the error message,

        /usr/bin/install: omitting directory `nselib/data/psexec'
        make: *** [install-nse] Error 1

is due to the following line using a wildcard whose results include a directory "psexec":

        $(INSTALL) -c -m 644 $(NSE_LIB_DATA_FILES) $(DESTDIR)$(nmapdatadir)/nselib/data

Interestingly, there was a chance of this happening before, two lines up, where the
"nselib" directory contents are handled.  In that case the NSE_LIB_LUA_FILES variable
specifies *.lua, avoiding the issue by not processing the directory "data".  Since the
"data" folder contains files with various extensions and some without this would not
work.

I figure that it would be unlikely that we would change all of the file names in nselib/data
to include some extension and that if we did, it would just break later.

So I took David's code above as an example and modified it to process the "nselib/data"
directory twice, once to create directories, then again to copy the files.

The benefit of this process is that if further directories created under nselib/data
they will automatically be picked up.  The downside is that some undesirable files,
such as *.c and *.vcproj, will get moved as well.

If that is a problem, I can rewrite the patch.

Perhaps someone with stronger shell-fu could craft an if like that checks $f to see
if it includes .c or .vcproj and skips this files during the file processing loop.

At one point I had a single loop parsing nselib/data that skipped subdirectories
and then manually processed the psexec folder.  The downside is that if new folders
are added to "nselib/data" then the Makefile.in file will need to be edited again.



I have attached both a diff and a complete copy of the Makefile.in file.

I have tested the file on Ubuntu linux.  This change likely needs a couple test runs
on other *nix based OSes.

I suggest deleting the directory where nmap's shared files are installed prior to
testing.  In my case the directory is /usr/local/share/nmap.

Thanks much,

Tom

Attachment: Makefile.in
Description:

Attachment: makefile.in.patch
Description:

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

Current thread: