[GRASS-dev] [GRASS GIS] #1912: g.mapset warns of illegal filename in mapset= but creates the mapset anyway.

#1912: g.mapset warns of illegal filename in mapset= but creates the mapset
anyway.
-------------------------+--------------------------------------------------
Reporter: torsti | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
See also ticket:1293

{{{
g.mapset -c mapset="möö"
WARNING: Illegal filename <möö>. Character <�> not allowed.
}}}

The mapset is created despite of the warning. You can also switch to
mapsets with illegal filenames.

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

#1912: g.mapset warns of illegal filename in mapset= but creates the mapset
anyway.
-------------------------+--------------------------------------------------
Reporter: torsti | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by torsti):

Looking at the source it seems the issue is that neither
'''general/g.mapset/main.c''' nor '''lib/gis/make_mapset.c''' include a
call to ''G_legal_name()'' and the mapset dir itself is created with
''G_mkdir()'' which is just a thin wrapper around ''mkdir()''.

So probably '''make_mapset.c''' is what should be patched.

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

#1912: g.mapset warns of illegal filename in mapset= but creates the mapset
anyway.
-------------------------+--------------------------------------------------
Reporter: torsti | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by martinl):

Replying to [comment:1 torsti]:
> Looking at the source it seems the issue is that neither
'''general/g.mapset/main.c''' nor '''lib/gis/make_mapset.c''' include a
call to ''G_legal_name()'' and the mapset dir itself is created with
''G_mkdir()'' which is just a thin wrapper around ''mkdir()''.
>
> So probably '''make_mapset.c''' is what should be patched.

The warning is printed by the parsers (which calls `G_find_file()`), I
disabled this check (file overwrite) for 'mapset' element in r55612. In
r55608 I added to `G_make_mapset()` check for name legality. Done only in
GRASS 7.

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

#1912: g.mapset warns of illegal filename in mapset= but creates the mapset
anyway.
-------------------------+--------------------------------------------------
Reporter: torsti | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: g.mapset | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by martinl):

  * keywords: => g.mapset

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1912#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1912: g.mapset warns of illegal filename in mapset= but creates the mapset
anyway.
-------------------------+--------------------------------------------------
Reporter: torsti | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: g.mapset | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by torsti):

g.mapset now (updated up to r55613) behaves as expected, but I noticed
there is a similar issue in make_loc.c and calling e.g. g.proj -c
location=illêgäl still works. Don't really want to open a new ticket,
because it's so similar an issue.

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

#1912: g.mapset warns of illegal filename in mapset= but creates the mapset
anyway.
-------------------------+--------------------------------------------------
Reporter: torsti | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: g.mapset | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by martinl):

Replying to [comment:4 torsti]:
> g.mapset now (updated up to r55613) behaves as expected, but I noticed
there is a similar issue in make_loc.c and calling e.g. g.proj -c
location=illêgäl still works. Don't really want to open a new ticket,
because it's so similar an issue.

please try out r55614.

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

#1912: g.mapset warns of illegal filename in mapset= but creates the mapset
anyway.
-------------------------+--------------------------------------------------
Reporter: torsti | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Keywords: g.mapset | Platform: Linux
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by torsti):

Seems to work, g.proj -c enforces valid location names. Great!

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

#1912: g.mapset warns of illegal filename in mapset= but creates the mapset
anyway.
----------------------+-----------------------------------------------------
  Reporter: torsti | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: Default | Version: svn-trunk
Resolution: fixed | Keywords: g.mapset
  Platform: Linux | Cpu: Unspecified
----------------------+-----------------------------------------------------
Changes (by neteler):

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

Comment:

Replying to [comment:6 torsti]:
> Seems to work, g.proj -c enforces valid location names. Great!

Closing.

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