[GRASS-dev] [GRASS GIS] #2156: Parser does not honor the dash (-) means stdout convention
GRASS GIS
trac at osgeo.org
Sat Jan 4 16:08:04 PST 2014
#2156: Parser does not honor the dash (-) means stdout convention
------------------------------------------+---------------------------------
Reporter: wenzeslaus | Owner: grass-dev@…
Type: defect | Status: new
Priority: trivial | Milestone: 7.0.0
Component: Parser | Version: svn-trunk
Keywords: stdout, r.colors.out, m.proj | Platform: Unspecified
Cpu: Unspecified |
------------------------------------------+---------------------------------
I cannot run `r.colors.out` with `rules=-` when I have file named `-` in
the current directory:
{{{
#!sh
# create a file named -
# touch - does not work for me
$ touch testfile && mv testfile -
# try to output rules
$ r.colors.out map=elevation rules=-
ERROR: option <rules>: <-> exists.
# now remove the file named - and try again
$ rm -
$ r.colors.out map=elevation at PERMANENT rules=-
55.5788 0:191:191
75.729 0:255:0
95.8792 255:255:0
116.029 255:127:0
136.18 191:127:63
156.33 20:20:20
nv 255:255:255
default 255:255:255
}}}
Well, I'm not sure what should be the right behavior of the parser, this
current one is bit confusing, so I think that it should be at least
reported. What puzzles me, is how the `-` file actually appeared in the
directory. It already happened to me at least two times (in past moths)
that `r.colors.out` (or something I used together with it), created the
`-` file. I used some other way and haven't reported the issue at that
time, now I'm not able to reproduce it (from command line and GUI).
According to the short note I made at that time it seems that it was
pretty clear that `r.colors.out` is the cause.
Nevertheless, the behavior of parser is confusing when the module supports
"`-` (dash, minus) means standard output" convention and current directory
contains file named `-`. Affected modules are at least G7:r.colors.out and
G7:m.proj. Probably the number of modules supporting `-` as a placeholder
for stdout, the preferred interpretation of `-` and safety are the factors
influencing how parser behave.
To be complete, for standard input, no support is needed in parser, test
for G7:r.color:
{{{
#!sh
$ touch testfile && mv testfile -
$ r.colors map=elevation rules=-
Enter rules, "end" when done, "help" if you need it.
fp: Data range is 55.5787925720215 to 156.329864501953
> (and prompts for input)
# for both existing (empty) and not existing files
$ r.colors map=elevation rules=testfile
ERROR: Unable to load rules file <testfile>
}}}
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2156>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list