Opened 6 years ago

Closed 6 years ago

#4102 closed defect (fixed)

rt_grayscale fails on raspberrypi

Reported by: komzpa Owned by: Bborie Park
Priority: medium Milestone: PostGIS 2.5.0
Component: raster Version: master
Keywords: Cc:

Description

Raspbian / RPi3.

PostgreSQL 9.6.7 on armv7l-unknown-linux-gnueabihf, compiled by gcc (Raspbian 6.3.0-18+rpi1) 6.3.0 20170516, 32-bit
  Postgis 2.5.0beta1dev - r16605 - 2018-06-03 14:17:34
  scripts 2.5.0beta1dev r16605
  raster scripts 2.5.0beta1dev r16605
  GEOS: 3.5.1-CAPI-1.9.1 r4246
  PROJ: Rel. 4.9.3, 15 August 2016
  GDAL: GDAL 2.1.2, released 2016/10/24
--- rt_grayscale_expected       2018-06-03 13:17:05.334407610 +0000
+++ /tmp/pgis_reg/test_74_out   2018-06-03 22:10:55.755485552 +0000
@@ -8,17 +8,17 @@
 1|1|1|{{NULL,128},{254,255}}
 1|2|1|{{NULL,128},{254,255}}
 1|3|1|{{NULL,0},{254,254}}
-1|4|1|{{NULL,0},{254,254}}
+1|4|1|{{0,0},{254,254}}
 1|5|1|{{NULL,NULL},{128,128},{255,255}}
 2|1|1|{{NULL,128},{254,255}}
 2|2|1|{{NULL,128},{254,255}}
 2|3|1|{{NULL,0},{254,254}}
-2|4|1|{{NULL,0},{254,254}}
+2|4|1|{{0,0},{254,254}}
 2|5|1|{{NULL,NULL},{128,128},{255,255}}
 3|1|1|{{NULL,128},{254,255}}
 3|2|1|{{NULL,128},{254,255}}
 3|3|1|{{NULL,0},{254,254}}
-3|4|1|{{NULL,0},{254,254}}
+3|4|1|{{0,0},{254,254}}
 3|5|1|{{NULL,NULL},{128,128},{255,255}}
 BEGIN
 ERROR:  'rastbandargset' must have three bands for red, green and blue

Change History (4)

comment:1 by komzpa, 6 years ago

Same thing happens on ppc64el:

2018-07-05 13:58:41.641 UTC [7785] buildd@postgis_reg STATEMENT:  SELECT make_test_raster('big', 1, -12345678901234567890.0);
2018-07-05 13:58:41.642 UTC [7785] buildd@postgis_reg WARNING:  Unable to add constraint: 'scale_x'.  Skipping
2018-07-05 13:58:41.642 UTC [7785] buildd@postgis_reg CONTEXT:  PL/pgSQL function addrasterconstraints(name,name,name,text[]) line 113 at RAISE
2018-07-05 13:58:41.645 UTC [7785] buildd@postgis_reg ERROR:  new row for relation "test_raster_scale_small" violates check constraint "enforce_scaley_rast"
2018-07-05 13:58:41.645 UTC [7785] buildd@postgis_reg DETAIL:  Failing row contains (3, 0100000100F168E388B5F8E43E72C45A7C0A00F03F0000000000000000000000...).
2018-07-05 13:58:41.645 UTC [7785] buildd@postgis_reg CONTEXT:  SQL statement "INSERT INTO test_raster_scale_small VALUES ('3', '0100000100F168E388B5F8E43E72C45A7C0A00F03F00000000000000000000000000000000000000000000000000000000000000000000000002000200440001010101')"
	PL/pgSQL function make_test_raster(text,integer,double precision,double precision) line 16 at EXECUTE
2018-07-05 13:58:41.645 UTC [7785] buildd@postgis_reg STATEMENT:  SELECT make_test_raster('small', 3, 0.00001, 1.00001);
Dropping cluster 10/regress ...
 ### /tmp/pgis_reg/test_74_diff ###
--- rt_grayscale_expected	2018-07-03 20:26:25.000000000 +0000
+++ /tmp/pgis_reg/test_74_out	2018-07-05 13:58:40.508123178 +0000
@@ -8,17 +8,17 @@
 1|1|1|{{NULL,128},{254,255}}
 1|2|1|{{NULL,128},{254,255}}
 1|3|1|{{NULL,0},{254,254}}
-1|4|1|{{NULL,0},{254,254}}
+1|4|1|{{0,0},{254,254}}
 1|5|1|{{NULL,NULL},{128,128},{255,255}}
 2|1|1|{{NULL,128},{254,255}}
 2|2|1|{{NULL,128},{254,255}}
 2|3|1|{{NULL,0},{254,254}}
-2|4|1|{{NULL,0},{254,254}}
+2|4|1|{{0,0},{254,254}}
 2|5|1|{{NULL,NULL},{128,128},{255,255}}
 3|1|1|{{NULL,128},{254,255}}
 3|2|1|{{NULL,128},{254,255}}
 3|3|1|{{NULL,0},{254,254}}
-3|4|1|{{NULL,0},{254,254}}
+3|4|1|{{0,0},{254,254}}
 3|5|1|{{NULL,NULL},{128,128},{255,255}}
 BEGIN
 ERROR:  'rastbandargset' must have three bands for red, green and blue
 ### end of log dumps ###
make[1]: *** [debian/rules:208: override_dh_auto_test] Error 2
make[1]: Leaving directory '/<<BUILDDIR>>/postgis-2.5.0~beta1+dfsg'
make: *** [debian/rules:119: build-arch] Error 2
dpkg-buildpackage: error: debian/rules build-arch subprocess returned exit status 2
--------------------------------------------------------------------------------
Build finished at 2018-07-05T13:58:46Z

comment:2 by komzpa, 6 years ago

#postgresql-apt@freenode:

[23:17] <Myon> https://buildd.debian.org/status/package.php?p=postgis&suite=experimental [23:18] <Myon> but the tests are disabled on quite a few archs, ifneq (,$(findstring $(DEB_BUILD_ARCH),"hurd-i386 mipsel armel hppa kfreebsd-i386 mips64el ppc64 alpha sparc64 s390x powerpc"))

comment:3 by komzpa, 6 years ago

NODATA value gets set to 0 for 16BSI and 32BSI rasters if it was negative, on raspi:

postgis_reg=# SELECT ST_BandNoDataValue(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 1, -1, 0, 0, 0), 1, '16BSI', 0, -1000),1) AS rast;
 rast 
------
    0
(1 row)

postgis_reg=# SELECT ST_BandNoDataValue(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 1, -1, 0, 0, 0), 1, '16BSI', 0, 1000),1) AS rast;
 rast 
------
 1000
(1 row)

postgis_reg=# SELECT ST_BandNoDataValue(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 1, -1, 0, 0, 0), 1, '8BSI', 0, -10),1) AS rast;
 rast 
------
  -10
(1 row)

postgis_reg=# SELECT ST_BandNoDataValue(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 1, -1, 0, 0, 0), 1, '32BSI', 0, -10),1) AS rast;
 rast 
------
    0
(1 row)

comment:4 by komzpa, 6 years ago

Resolution: fixed
Status: newclosed

In 16661:

Fix raster regression on Raspberry Pi.

A signed NODATA value was assigned to unsigned variable.
On Intel that was reversible, on ARM and PPC it replaced all negatives with 0.

Thanks to Alina Dolgikh for supporting me: https://www.patreon.com/komzpa

Closes #4102
Closes https://github.com/postgis/postgis/pull/276

Note: See TracTickets for help on using tickets.