Opened 10 years ago

Closed 7 years ago

#2447 closed defect (wontfix)

G_legal_filename: Special characters allowed in filenames

Reported by: hcho Owned by: grass-dev@…
Priority: normal Milestone: 7.2.3
Component: LibGIS Version: svn-trunk
Keywords: G_legal_filename Cc:
CPU: All Platform: All

Description

Currently, G_legal_filename is not filtering out some special characters including tab, newline, {, |, }, etc. Also, the description of the function is incorrect because '_' is a non-alphanumeric character allowed in filenames. I'm not sure exactly what special characters are really legal. This function should also check non-printable characters.

Change History (7)

in reply to:  description comment:1 by glynn, 10 years ago

Replying to hcho:

Currently, G_legal_filename is not filtering out some special characters including tab, newline, {, |, }, etc.

All control characters, including tab and newline are rejected by

... *s <= ' '

source:grass/trunk/lib/gis/legal_name.c#L44

Braces and vertical bar aren't considered invalid.

Which characters are invalid is somewhat arbitrary, although it has to include those which have a specific meaning to the parser (equals, comma), to the OS (slash) or within map names (at). Apart from those, space, single quote, double quote, asterisk, control characters and 8-bit characters are considered invalid, although there's no fundamental reason for these (some of these may have been added to avoid issues with code which used system() and/or popen(), but those functions should have been been eliminated in GRASS 7).

The set of invalid characters hasn't been updated to include all of those which are invalid on Windows, specifically backslash, colon, question mark, less than, greater than, vertical bar (asterisk, double quote and slash are also invalid but are already rejected). It's unlikely that any of these are likely to be used in existing data sets, with the possible exception of colon.

comment:2 by neteler, 8 years ago

Milestone: 7.1.07.2.0

Milestone renamed

comment:3 by mlennert, 8 years ago

It is not clear to me what needs to be done, here, if anything.

comment:4 by neteler, 8 years ago

Milestone: 7.2.07.2.1

Ticket retargeted after milestone closed

comment:5 by martinl, 7 years ago

Milestone: 7.2.17.2.2

comment:6 by neteler, 7 years ago

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:7 by martinl, 7 years ago

Resolution: wontfix
Status: newclosed

No activity last 3 years, closing. Feel free to reopen if needed.

Note: See TracTickets for help on using tickets.