[Xastir] ESRI shapefiles and dbfawk

Tom Russo russo at bogodyn.org
Thu Dec 16 00:18:25 EST 2004


On Wed, Dec 15, 2004 at 09:58:56PM -0700, we recorded a bogon-computron collision of the <jewen at shaw.ca> flavor, containing:
> > > I did try running testawk on my ROADSEG.dbfawk file and got a nice 
> > > segmentation fault.
> > 
> > Sigh.  Please send me a copy of this dbfawk file that causes 
> > a segfault, and I'll see if I can't bulletproof testawk a little.  
> 
> That's easy, any file I try and run it on causes a segmentation fault. Even
> the one you made.

> Perhaps you might tell me what I'm supposed to do with testawk.
> 
> Do you run testawk with the .dbfawk file as an argument? Do you run testawk
> against the .dbf file? Do you run it with both as arguments?
> 
> testawk ROADSEG.dbf
> testawk ROADSEG.dbfawk
> testawk ROADSEG.dbf ROADSEG.dbfawk
> testawk ROADSEG.dbfawk ROADSEG.dbf

Ah.  There's the problem.   All of these segfault for me, too.  Looks like 
testawk doesn't do any sanity checking of its command line arguments before
it blazes off and starts trying to process.  I'll have to look at what
that program does at the front-end and see if I can add such checking.

At the least, README.MAPS can be made clearer, for sure.  I'll do that 
tonight.

> What options are available? I've seen an example with -D and -d in it... 

As far as I can tell in order to get testawk to do anything at all of 
value, you need both a -D and -d argument:

testawk -D . -d ROADSEG.dbf

This is just what's in README.MAPS as the example, and I always just crib off
of that every time I need testawk.  This is the command line you want.

-D tells it where to look for dbfawk files with matching signatures, -d tells 
it to parse ROADSEG.dbf.

Another option that works is:

testawk -f ROADSEG.dbfawk -d ROADSEG.dbf

That tells testawk to skip the scan for matching signatures and use 
ROADSEG.dbfawk directly.

The only other thing that does work is 

 testawk --help

which prints out the following:

 Usage: testawk [-f file.awk| -D dir] [-d file.dbf] arg...
  -D for dir containing *.dbfawk files.
  or -f for file containing awk rules.
  -d for dbf file to parse [default dbf args on cmdline]

As far as I can tell, the behavior of testawk when "-d file.dbf" is omitted
is only partly implemented.  I can't tell from a quick read of the code 
exactly what was intended by this.  It looks like it tries to take the entire 
contents of "arg..." and use it as a dbfawk program. 

-- 
Tom Russo    KM5VY     SAR502  DM64ux         http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://www.qsl.net/~km5vy/
 "That which does not kill me is better than that which does."
    --Irving Nietzche, lesser known of the famous Nietzche twins



More information about the Xastir mailing list