Opened 8 years ago

Closed 8 years ago

#6061 closed defect (fixed)

/vsistdin reading only the first 1024 characters of VRT string

Reported by: lpinner Owned by: warmerdam
Priority: normal Milestone: 2.0.1
Component: default Version: 1.11.1
Severity: normal Keywords: VSISTDIN
Cc:

Description

To avoid temporary files when warping to VRT and compressing with gdal_translate, I tried piping gdalwarp VRT output to gdal_translate. This did not work on Windows (7) or Linux (Ubuntu 14.04).

Command:

gdalwarp -q -t_srs EPSG:32611 -of vrt byte.tif /vsistdout/ | gdal_translate -co compress=lzw  /vsistdin/ byte_wgs84.tif

byte.tif is from the autotest suite - https://svn.osgeo.org/gdal/trunk/autotest/gcore/data/byte.tif

Error message (Windows):

ERROR 1: Parse error at EOF, not all elements have been closed,
starting with Co

GDALOpen failed - 1
Parse error at EOF, not all elements have been closed,
starting with Co

The linux error is similar with "ColorInte" instead of "Co". The difference in the win->linux output is caused by \r\n and \n linebreaks respectively.

Redirecting stdout to a file outputs the entire VRT string as expected.

Just as a sanity check I tried redirecting stdin from a file with correct VRT xml. The same error is shown.

gdalwarp -t_srs EPSG:32611 -of vrt byte.tif byte_wgs84.vrt
Creating output file that is 20P x 20L.
Processing input file byte.tif.

#Read STDIN - fail
gdal_translate /vsistdin/ byte_wgs84.tif < byte_wgs84.vrt
ERROR 1: Parse error at EOF, not all elements have been closed,
starting with ColorInte

GDALOpen failed - 1
Parse error at EOF, not all elements have been closed,
starting with ColorInte

#Read VRT file - success
gdal_translate byte_wgs84.vrt byte_wgs84.tif
Input file size is 20, 20
0...10...20...30...40...50...60...70...80...90...100 - done.

It appears /vsistdin is only reading the first 1024 bytes/characters of the output.

Change History (1)

comment:1 by Even Rouault, 8 years ago

Milestone: 2.0.1
Resolution: fixed
Status: newclosed

trunk r29615, branches/2.0 r29616 "/vsistdin/: fix caching of first 1MB / VRT driver: read XML content from /vsistdin/ in a streaming compatible way (#6061)"

Note: See TracTickets for help on using tickets.