[CDRIVER-291] bson_json_reader_t does not work with trailing \n on files. Created: 01/Mar/14 Updated: 03/May/17 Resolved: 04/Mar/14 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Christian Hergert | Assignee: | Christian Hergert |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
| Comments |
| Comment by Christian Hergert [ 04/Mar/14 ] |
|
Merged, thanks! |
| Comment by Mira Carey [ 04/Mar/14 ] |
| Comment by Christian Hergert [ 03/Mar/14 ] |
|
I think we want to allow trailing whitespace. So just walk through the trailing utf-8 chars with bson_utf8_get_char()/next_char() and isspace(). The reasoning for allowing it is that anything created in say vim or emacs automatically gets a trailing \n. Same for running a mongo shell command and redirecting into a file. That case should be safe. |
| Comment by Mira Carey [ 03/Mar/14 ] |
|
This is actually the other way around. -n to echo omits the trailing newline. I've got the parser complaining about trailing garbage right now, which the trailing newline technically is. I could pretty easily check for that error and ignore trailing whitespace if you think it's worth it, but I think we should choke on trailing characters in general. |