[GRASS-dev] [GRASS GIS] #2872: "r.info -e" output not compliant with eval

#2872: "r.info -e" output not compliant with eval
---------------------------+-------------------------
Reporter: andbal | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone:
Component: Shell Scripts | Version: svn-trunk
Keywords: shell, r.info | CPU: x86-64
Platform: Linux |
---------------------------+-------------------------
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.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2872&gt;
GRASS GIS <https://grass.osgeo.org>

#2872: "r.info -e" output not compliant with eval
----------------------------+---------------------------
  Reporter: andbal | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Shell Scripts | Version: svn-trunk
Resolution: | Keywords: shell, r.info
       CPU: x86-64 | Platform: Linux
----------------------------+---------------------------

Comment (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.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2872#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#2872: "r.info -e" output not compliant with eval
----------------------------+---------------------------
  Reporter: andbal | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.3
Component: Shell Scripts | Version: svn-trunk
Resolution: | Keywords: shell, r.info
       CPU: x86-64 | Platform: Linux
----------------------------+---------------------------
Changes (by neteler):

* milestone: => 7.0.3

Comment:

Replying to [comment:1 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?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2872#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#2872: "r.info -e" output not compliant with eval
----------------------------+---------------------------
  Reporter: andbal | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.7
Component: Shell Scripts | Version: svn-trunk
Resolution: worksforme | Keywords: shell, r.info
       CPU: x86-64 | Platform: Linux
----------------------------+---------------------------
Changes (by martinl):

* status: new => closed
* resolution: => worksforme

Comment:

Unable to reproduce with GRASS 7.6.0.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2872#comment:8&gt;
GRASS GIS <https://grass.osgeo.org>