Ticket #1533 (closed defect: fixed)
[raster] regression failure due to non-POSIX sed usage (with patch)
|Reported by:||gdt||Owned by:||pracine|
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.
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