Skip to content

Commit

Permalink
Update parse.c
Browse files Browse the repository at this point in the history
Chop leading and trailing white spaces from column names
  • Loading branch information
metzm committed Mar 18, 2020
1 parent 928ba6d commit feecd4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vector/v.to.db/parse.c
Expand Up @@ -168,7 +168,7 @@ int parse_command_line(int argc, char *argv[])
options.col[2] = NULL;
options.col[3] = NULL;
while (parms.col->answers && parms.col->answers[ncols]) {
options.col[ncols] = G_store(parms.col->answers[ncols]);
options.col[ncols] = G_store(G_chop(parms.col->answers[ncols]));
ncols++;
}

Expand Down

1 comment on commit feecd4b

@HuidaeCho
Copy link
Member

@HuidaeCho HuidaeCho commented on feecd4b Mar 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit causes inconsistency in handling white spaces in other modules. For example, g.remove type=vector name="vector1, vector2" (with a space) fails with

WARNING: Illegal filename < vector2>. Character < > not allowed.
ERROR: Illegal filenames not allowed in the name or ignore option.

Then, would it be a good idea to always remove white spaces from lib/gis/parser.c to make this effect global and consistent? I don't think so because some modules may need trailing white spaces (e.g., column values). I believe that this specific issue should be treated as a user error without code changes.

Please sign in to comment.