[postgis-devel] [PostGIS] #1533: [raster] regression failure due to non-POSIX sed usage (with patch)

PostGIS trac at osgeo.org
Thu Feb 2 19:25:03 PST 2012


#1533: [raster] regression failure due to non-POSIX sed usage (with patch)
--------------------+-------------------------------------------------------
 Reporter:  gdt     |       Owner:  pracine      
     Type:  defect  |      Status:  new          
 Priority:  medium  |   Milestone:  PostGIS 2.0.0
Component:  raster  |     Version:  trunk        
 Keywords:          |  
--------------------+-------------------------------------------------------
 In raster, make check fails because the upgrade script still has CREATE
 TYPE raster, on NetBSD, and this causes an error due to the already-
 existing type.  The cause is that the sed that is invoked is traditional
 sed rather than GNU sed, and the regular expressions use \| as an
 alternative, when basic regular expressions clearly state that | is not
 special.  BSD sed correctly does not treat | as special, but GNU sed
 interprets it as a special character.

 http://pubs.opengroup.org/onlinepubs/007908799/xcu/sed.html
 http://pubs.opengroup.org/onlinepubs/007908799/xbd/re.html

 The following patch changes the preparation of the upgrade sql script to
 use extended regular expressions rather than basic regular expressions.
 While POSIX sed does not require extended REs, BSD sed and GNU sed both
 support extended REs and thus this should be widely portable.  In
 addition, an inexplicably quoted ; is no longer quoted; POSIX says ; is
 not special.

 It has been tested with NetBSD sed, which documents -E for extended REs,
 and GNU sed 4.2.1, which supports -E but does not document it.

 {{{
 Index: raster/rt_pg/Makefile.in
 ===================================================================
 --- raster/rt_pg/Makefile.in    (revision 9013)
 +++ raster/rt_pg/Makefile.in    (working copy)
 @@ -96,9 +96,13 @@
  $(SQL_OBJS): ../../postgis/sqldefines.h

  #remove all create object types since these can't be done cleanly in an
 upgrade
 +
 +# Use extended regular expressions, because | is not supported in
 +# basic regular expressions.
 +# Use -E, the traditional switch, because it is also supported by GNU
 sed.
  rtpostgis_upgrade.sql: rtpostgis.sql
 -                sed -e '/^\(CREATE\|ALTER\)
 \(CAST\|OPERATOR\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\).*;/d' \
 -                -e '/^\(CREATE\|ALTER\)
 \(CAST\|OPERATOR\|TYPE\|TABLE\|SCHEMA\|DOMAIN\|TRIGGER\)/,/\;/d' \
 +                sed -E -e '/^(CREATE|ALTER)
 (CAST|OPERATOR|TYPE|TABLE|SCHEMA|DOMAIN|TRIGGER).*;/d' \
 +                -e '/^(CREATE|ALTER)
 (CAST|OPERATOR|TYPE|TABLE|SCHEMA|DOMAIN|TRIGGER)/,/;/d' \
                  $< > $@

  rtpostgis_upgrade_20_minor.sql: rtpostgis_drop.sql
 rtpostgis_upgrade_cleanup.sql rtpostgis_upgrade.sql
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1533>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list