[GRASS-dev] [grass-code I][446] Illegal filename. Character <'> not allowed.

Markus Neteler neteler at itc.it
Sun Jul 15 08:45:59 EDT 2007


For now, I have changed 
- r.mode
- r.median 
- r.statistics
- r.rescale.eq
- r.rescale

to use escaped double quotes instead of single quotes.

Markus


grass-codei wrote:
> 
> code I item #446, was opened at 2007-07-15 10:20
> Status: Open
> Priority: 3
> Submitted By: Markus Neteler (markusn)
> Assigned to: Nobody (None)
> Summary: Illegal filename. Character <'> not allowed.  
> Issue type: None
> Issue status: None
> GRASS version: None
> GRASS component: None
> Operating system: None
> Operating system version: 
> GRASS CVS checkout date, if applies (YYMMDD): 
> 
> 
> Initial Comment:
> In winQGIS/GRASS, this problem happens for a couple of commands (but eg
> r.average works, see also https://svn.qgis.org/trac/ticket/736):
> 
> r.median base=CEA_cat at CEA_dati cover=CEA_aspect at CEA_dati
> output=aspect_median
> Illegal filename. Character <'> not allowed. 
> 
> ##########################
> Glynn Clements answered:
> r.median invokes r.stats via system(), using a single quote:
> 
>     strcpy (command, "r.stats -a '");
>     strcat (command, G_fully_qualified_name (basemap, base_mapset));
>     strcat (command, ",");
>     strcat (command, G_fully_qualified_name (covermap, cover_mapset));
>     strcat (command, "'");
> 
> /* strcpy (command,"cat /tmp/t"); */
>     stats_fd = popen (command, "r");
> 
>     sprintf (command, "r.reclass i='%s' o='%s'",
>         G_fully_qualified_name (basemap, base_mapset), outmap);
> 
> system() uses the platform's shell: /bin/sh on Unix, cmd.exe on
> Windows NT/2K/XP, command.com on 95/98/ME. Single quotes won't work
> with the Windows shells.
> 
> r.average doesn't quote the map names, and uses double quotes around
> the output filename:
> 
>     sprintf (command, "%s -anC input=%s,%s fs=space > \"%s\"",
>         STATS, basemap->answer, covermap->answer, tempfile1);
> 
> Using double quotes should suffice so long as the map name doesn't
> contain $ or ` (a double quote would also be problematic, but isn't
> legal in map names).
> 
> Ultimately, we need a Windows implementation of G_spawn_ex(), so that
> we can avoid the shell altogether. 
> 
> ----------------------------------------------------------------------
> 
> You can respond by visiting: 
> http://wald.intevation.org/tracker/?func=detail&atid=204&aid=446&group_id=21
> 
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
> 
> 

-- 
View this message in context: http://www.nabble.com/-grass-code-I--446--Illegal-filename.-Character-%3C%27%3E-not-allowed.-tf4081449.html#a11602107
Sent from the Grass - Dev mailing list archive at Nabble.com.




More information about the grass-dev mailing list