Bug 995869 - shp2pgsql is not working
shp2pgsql is not working
Product: OpenShift Origin
Classification: Red Hat
Component: Containers (Show other bugs)
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Adam Miller
libra bugs
Depends On:
  Show dependency treegraph
Reported: 2013-08-11 12:46 EDT by Steven Citron-Pousty
Modified: 2015-05-14 19:12 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-08-14 17:48:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Steven Citron-Pousty 2013-08-11 12:46:39 EDT
Description of problem:
With the latest postgis install one of the vital binaries it includes is not working. Shp2pgsql is a utility to convert from shapefile to postgis format. It is probably the most common way to import a shapefile (the universal interchange format in the GIS world)

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. on a machine upload run the following command:

shp2pgsql --help

Watch the errors appear

Actual results:

[postgis-test.example.com spatial]\> shp2pgsql --help
mkdir: cannot create directory ‘/bin/.libs’: Permission denied
/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
gcc: error: ../liblwgeom/.libs/liblwgeom.so: No such file or directoryn

Expected results:

The help is displayed

Additional info:

I have not even tried to import a file yet but I will try that next
Comment 1 Steven Citron-Pousty 2013-08-11 13:14:13 EDT
my instructions are not clear:

1) ssh into a gear that has postgresql 9.2 installed and the bits for postgis 2.0.x. Postgis does not have to have be added to your postgresql db

2) then run
shp2pgsql --help

that should produce the error.
Comment 2 Hiro Asari 2013-08-12 13:07:43 EDT
Did `shp2pgsql` ever work?

I am a bit puzzled how you are executing /bin/shp2pgsql. On devenv, there is /usr/bin/shp2pgsql belonging to postgis-1.5.3 package, and /opt/rh/postgresql92/root/usr/bin/shp2pgsql belonging to postgresql92-postgis-2.0.3. Where did /bin/shp2pgsql come from?

No matter how it came about, the error is such that shp2pgsql is trying to eval this command:

relink_command="(cd /builddir/build/BUILD/postgis-2.0.3/loader; LIBRARY_PATH=/opt/rh/postgresql92/root/usr/lib64; export LIBRARY_PATH; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=/opt/rh/postgresql92/root/usr/lib64; export LD_LIBRARY_PATH; PATH=/opt/rh/postgresql92/root/usr/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/root/bin:/usr/local/sbin; export PATH; gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC -DPIC -Wall -Wmissing-prototypes shpopen.o dbfopen.o getopt.o shpcommon.o safileio.o shp2pgsql-core.o shp2pgsql-cli.o -o \$progdir/\$file  ../liblwgeom/.libs/liblwgeom.so -lc -Wl,-rpath -Wl,/builddir/build/BUILD/postgis-2.0.3/liblwgeom/.libs -Wl,-rpath -Wl,/opt/rh/postgresql92/root/usr/lib64)"

and it's failing.

It is not clear to me how this script came to be, but it appears to me that it was generated when postgis was packaged.

I'm assigning this to Adam for review.
Comment 3 Hiro Asari 2013-08-14 11:05:17 EDT
For the record: Steve is testing it on OpenShift Origin on Fedora, so I suspect that /bin/shp2pgsql is probably how postgis is packaged on Fedora. Assuming it is, that part of this ticket is a packaging problem for that environment.

Having said that, the error still exists on devenv, as documented above. (Note that there is also /usr/bin/shp2pgsql exists, and it works.)
Comment 4 Adam Miller 2013-08-14 17:48:19 EDT
This is fixed as of postgresql92-postgis-2.0.3-4.el6oso for OpenShift Online, we'll upload the packages to the Origin dependencies mirrors once they pass QE.

This issue was also present in the upstream Fedora PostGIS package, I've filed a BZ against postgis in Fedora and provided patch for the spec file in the BZ below:


Note You need to log in before you can comment on or make changes to this bug.