[GRASS-dev] [GRASS GIS] #2984: i.colors.enhance crash when input map(s) not existing

#2984: i.colors.enhance crash when input map(s) not existing
-----------------------------------------------+---------------------------
Reporter: neteler | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.4
Component: Python | Version: svn-
                                               | releasebranch70
Keywords: i.colors.enhance, multiprocessing | CPU: All
Platform: All |
-----------------------------------------------+---------------------------
An error catch is needed:

{{{
GRASS 7.0.4svn (utm21S-sentinel-2-buenos-aires):~ > i.colors.enhance
b=S2A_USER_MSI_L2A_TL_SGS__20151211T193047_A002452_B03_10m_mosaik
g=S2A_USER_MSI_L2A_TL_SGS__20151211T193047_A002452_B04_10m_mosaik
r=S2A_USER_MSI_L2A_TL_SGS__20151211T193047_A002452_B8A_10m_mosaik
Processing...
FEHLER: Rasterkarte
         <S2A_USER_MSI_L2A_TL_SGS__20151211T193047_A002452_B8A_10m_mosaik>
         wurde nicht gefunden.
Process Process-1:
Traceback (most recent call last):
   File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in
_bootstrap
     self.run()
   File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
     self._target(*self._args, **self._kwargs)
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/scripts/i.colors.enhance", line 103, in get_percentile_mp
     result = get_percentile(map, percentiles)
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/scripts/i.colors.enhance", line 89, in get_percentile
     percentiles = values, quiet = True)
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/etc/python/grass/script/core.py", line 446, in read_command
     return handle_errors(returncode, stdout, args, kwargs)
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/etc/python/grass/script/core.py", line 313, in handle_errors
     returncode=returncode)
CalledModuleError: Module run None ['r.quantile', '--q',
'input=S2A_USER_MSI_L2A_TL_SGS__20151211T193047_A002452_B8A_10m_mosaik',
'percentiles=2,98'] ended with error
Process ended with non-zero return code 1. See errors in the (error)
output.
^CTraceback (most recent call last):
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/scripts/i.colors.enhance", line 226, in <module>
     Process Process-2:
Process Process-3:
main()
Traceback (most recent call last):
Traceback (most recent call last):
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/scripts/i.colors.enhance", line 165, in main
   File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in
_bootstrap
   File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in
_bootstrap
     (v0, v1) = input_pipe.recv()
KeyboardInterrupt
     self.run()
     self.run()
   File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
   File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
     self._target(*self._args, **self._kwargs)
     self._target(*self._args, **self._kwargs)
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/scripts/i.colors.enhance", line 103, in get_percentile_mp
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/scripts/i.colors.enhance", line 103, in get_percentile_mp
     result = get_percentile(map, percentiles)
     result = get_percentile(map, percentiles)
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/scripts/i.colors.enhance", line 89, in get_percentile
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/scripts/i.colors.enhance", line 89, in get_percentile
     percentiles = values, quiet = True)
     percentiles = values, quiet = True)
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/etc/python/grass/script/core.py", line 444, in read_command
   File "/home/mundialis/software/grass70_svn/dist.x86_64-pc-linux-
gnu/etc/python/grass/script/core.py", line 444, in read_command
     stdout, unused = process.communicate()
     stdout, unused = process.communicate()
   File "/usr/lib64/python2.7/subprocess.py", line 791, in communicate
   File "/usr/lib64/python2.7/subprocess.py", line 791, in communicate
     stdout = _eintr_retry_call(self.stdout.read)
     stdout = _eintr_retry_call(self.stdout.read)
   File "/usr/lib64/python2.7/subprocess.py", line 476, in
_eintr_retry_call
     return func(*args)
   File "/usr/lib64/python2.7/subprocess.py", line 476, in
_eintr_retry_call
KeyboardInterrupt
     return func(*args)
KeyboardInterrupt
}}}

To replicate:
{{{
i.colors.enhance b=bla g=blu r=blo
...
}}}

Perhaps an is-input-existing-or-not test should (also) be added to the
respective lib/python/ library?

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

#2984: i.colors.enhance crash when input map(s) not existing
----------------------+-----------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.7
Component: Python | Version: svn-releasebranch70
Resolution: | Keywords: i.colors.enhance, multiprocessing
       CPU: All | Platform: All
----------------------+-----------------------------------------------

Comment (by lucadelu):

In [changeset:"73423" 73423]:
{{{
#!CommitTicketReference repository="" revision="73423"
i.colors.enhance: check for not existing maps, see #2984
}}}

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

#2984: i.colors.enhance crash when input map(s) not existing
----------------------+-----------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.7
Component: Python | Version: svn-releasebranch70
Resolution: | Keywords: i.colors.enhance, multiprocessing
       CPU: All | Platform: All
----------------------+-----------------------------------------------

Comment (by lucadelu):

In [changeset:"73424" 73424]:
{{{
#!CommitTicketReference repository="" revision="73424"
i.colors.enhance: check for not existing maps, see #2984
}}}

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

#2984: i.colors.enhance crash when input map(s) not existing
----------------------+-----------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.7
Component: Python | Version: svn-releasebranch70
Resolution: | Keywords: i.colors.enhance, multiprocessing
       CPU: All | Platform: All
----------------------+-----------------------------------------------

Comment (by lucadelu):

In [changeset:"73425" 73425]:
{{{
#!CommitTicketReference repository="" revision="73425"
i.colors.enhance: check for not existing maps, see #2984
}}}

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

#2984: i.colors.enhance crash when input map(s) not existing
----------------------+-----------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.7
Component: Python | Version: svn-releasebranch70
Resolution: | Keywords: i.colors.enhance, multiprocessing
       CPU: All | Platform: All
----------------------+-----------------------------------------------

Comment (by lucadelu):

In [changeset:"73426" 73426]:
{{{
#!CommitTicketReference repository="" revision="73426"
i.colors.enhance: check for not existing maps, see #2984
}}}

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

#2984: i.colors.enhance crash when input map(s) not existing
----------------------+-----------------------------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.2.4
Component: Python | Version: svn-releasebranch70
Resolution: fixed | Keywords: i.colors.enhance, multiprocessing
       CPU: All | Platform: All
----------------------+-----------------------------------------------
Changes (by lucadelu):

* status: new => closed
* resolution: => fixed
* milestone: 7.0.7 => 7.2.4

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