Bug 997191

Summary: shp2pgsql does not work
Product: [Fedora] Fedora Reporter: Adam Miller <admiller>
Component: postgisAssignee: Jozef Mlich <jmlich>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: admiller, devrim, hhorak, jmlich, kms, p.kwarts
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1323025 (view as bug list) Environment:
Last Closed: 2014-11-10 19:57:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1323025    

Description Adam Miller 2013-08-14 21:32:50 UTC
Description of problem:
For some reason upstream changed the loader/shp2pgsql to be the libtool script and landed the binary in loader/.libs/shp2pgsql and as a side effect it doesn't currently work in Fedora


Version-Release number of selected component (if applicable):
postgis-2.0.3-1.fc19.x86_64


How reproducible:
Every time


Steps to Reproduce:
1. yum install postgis
2. shp2pgsql

Actual results:
$ shp2pgsql
mkdir: cannot create directory ‘/usr/bin/.libs’: Permission denied
/usr/bin/shp2pgsql: line 202: cd: /builddir/build/BUILD/postgis-2.0.3/loader: No such file or directory
gcc: error: shpopen.o: No such file or directory
gcc: error: dbfopen.o: No such file or directory
gcc: error: getopt.o: No such file or directory
gcc: error: shpcommon.o: No such file or directory
gcc: error: safileio.o: No such file or directory
gcc: error: shp2pgsql-core.o: No such file or directory
gcc: error: shp2pgsql-cli.o: No such file or directory



Expected results:
$ shp2pgsql
RELEASE: 2.0.3 (r11128)
USAGE: shp2pgsql [<options>] <shapefile> [[<schema>.]<table>]
OPTIONS:
  -s [<from>:]<srid> Set the SRID field. Defaults to 0.
      Optionally reprojects from given SRID (cannot be used with -D).
 (-d|a|c|p) These are mutually exclusive options:
     -d  Drops the table, then recreates it and populates
         it with current shape file data.
     -a  Appends shape file into current table, must be
         exactly the same table schema.
     -c  Creates a new table and populates it, this is the
         default if you do not specify any options.
     -p  Prepare mode, only creates the table.
  -g <geocolumn> Specify the name of the geometry/geography column
      (mostly useful in append mode).
  -D  Use postgresql dump format (defaults to SQL insert statements).
  -e  Execute each statement individually, do not use a transaction.
      Not compatible with -D.
  -G  Use geography type (requires lon/lat data or -s to reproject).
  -k  Keep postgresql identifiers case.
  -i  Use int4 type for all integer dbf fields.
  -I  Create a spatial index on the geocolumn.
  -S  Generate simple geometries instead of MULTI geometries.
  -t <dimensionality> Force geometry to be one of '2D', '3DZ', '3DM', or '4D'
  -w  Output WKT instead of WKB.  Note that this can result in
      coordinate drift.
  -W <encoding> Specify the character encoding of Shape's
      attribute column. (default: "UTF-8")
  -N <policy> NULL geometries handling policy (insert*,skip,abort).
  -n  Only import DBF file.
  -T <tablespace> Specify the tablespace for the new table.
      Note that indexes will still use the default tablespace unless the
      -X flag is also used.
  -X <tablespace> Specify the tablespace for the table's indexes.
      This applies to the primary key, and the spatial index if
      the -I flag is used.
  -?  Display this help screen.



Additional info:

It's a simple fix for the spec file, here's the diff:

diff --git a/postgis.spec b/postgis.spec
index 9fbd8b7..c928a22 100644
--- a/postgis.spec
+++ b/postgis.spec
@@ -101,7 +101,7 @@ install -d %{buildroot}%{_libdir}/pgsql/
 install -d %{buildroot}%{_bindir}/
 install -d  %{buildroot}%{_datadir}/pgsql/contrib/
 install -m 644 *.sql %{buildroot}%{_datadir}/pgsql/contrib/
-install -m 755 loader/shp2pgsql loader/shp2pgsql-gui %{buildroot}%{_bindir}/
+install -m 755 loader/.libs/shp2pgsql loader/.libs/shp2pgsql-gui %{buildroot}%{_bindir}/
 rm -f  %{buildroot}%{_datadir}/*.sql
 
 if [ "%{_libdir}" = "/usr/lib64" ] ; then

Comment 1 Keith Sharp 2013-10-07 14:11:19 UTC
I can confirm that the patch in comment #1 fixes this issue for me on Fedora 19, with postgis-2.0.3.

Comment 2 Jozef Mlich 2014-06-26 13:22:12 UTC
The problem seems to be solved in fedora 20. Can you try to reproduce it?