Opened 4 years ago

Closed 15 months ago

#2872 closed defect (worksforme)

"r.info -e" output not compliant with eval

Reported by: andbal Owned by: grass-dev@…
Priority: normal Milestone: 7.0.7
Component: Shell Scripts Version: svn-trunk
Keywords: shell, r.info Cc:
CPU: x86-64 Platform: Linux

Description

I've got an error using the command eval `r.info -e <map_name>`. This is the output:

GRASS 7.1.svn (---):~ > eval `r.info -e map=soilheatflux.dos4`
bash: unexpected EOF while looking for matching `"'
bash: syntax error: unexpected end of file

The error is likely to be correlated to the flags -e because with other flag (like -r for example), the command eval works well.

Change History (8)

comment:1 Changed 4 years ago by andbal

I add the output of r.info -e executed outside eval

GRASS 7.1.svn (L5_Papk):~ > r.info -e map=soilheatflux.dos4 
map=soilheatflux.dos4
mapset=L5
location=L5_Papk
database=/home/andrea/GIS-software-data/GRASS-data
date="Thu Jan 21 09:06:28 2016"
creator="andrea"
title=" (soilheatflux.dos4)"
timestamp="none"
units="none"
vdatum="none"
source1=""
source2=""
description="generato da i.eb.soilheatflux"
comments="i.eb.soilheatflux albedo="albedo.dos4" ndvi="ndvi.dos4" temperature=\"toa_temp.6" netradiation="rad.M1" localutctime="overpass_utc" outpu\t="soilheatflux.dos4""

Another person suggest me that maybe is a quotes problem in the comments field.

comment:2 in reply to:  1 Changed 4 years ago by neteler

Milestone: 7.0.3

Replying to andbal:

I add the output of r.info -e executed outside eval

...
comments="i.eb.soilheatflux albedo="albedo.dos4" ndvi="ndvi.dos4" temperature=\"toa_temp.6" netradiation="rad.M1" localutctime="overpass_utc" outpu\t="soilheatflux.dos4""

The issue is that the inner quotes " need to be escaped when fprintf'ing the comment:

https://trac.osgeo.org/grass/browser/grass/trunk/raster/r.info/main.c#L392

I suppose that there is already a function for that?

comment:3 Changed 4 years ago by neteler

Milestone: 7.0.3

Ticket retargeted after milestone closed

comment:4 Changed 4 years ago by neteler

Milestone: 7.0.4

Ticket retargeted after 7.0.3 milestone closed

comment:5 Changed 4 years ago by martinl

Milestone: 7.0.47.0.5

comment:6 Changed 4 years ago by neteler

Milestone: 7.0.57.0.6

comment:7 Changed 2 years ago by neteler

Milestone: 7.0.67.0.7

comment:8 Changed 15 months ago by martinl

Resolution: worksforme
Status: newclosed

Unable to reproduce with GRASS 7.6.0.

Note: See TracTickets for help on using tickets.