-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix printing of GAP strings containing null characters (skip them instead of truncating the string) #5546
Fix printing of GAP strings containing null characters (skip them instead of truncating the string) #5546
Conversation
This definately improves things. I notice there are other cases in that function which have the same issue (stopping parsing strings at null), but I'm not sure if those are easy for users to call. |
I think I'd prefer this if the printed output included the \0 character, I.e. so that the output was the same as that of ViewObj but without the ". This'd be less astonishing in my opinion. |
Same thing. Noticed that %G and %S got quite similar logic, but it seems like it's not a problem for the end user. |
In terms of printing out \0, I'm not opposed to this, but we already silently swallow many unprintable characters (we just send them for printing, and nothing gets displayed), it's just that |
Regarding other format specifiers:
Emit( "%c = MakeString( \"%C\" );\n", string, str);
...
Emit( "NameFunc[%d] = MakeImmString(\"%G\");\n", i, n ); The latter two are specifically used to sanitize valid GAP strings into a format that can then be re-read by a C compiler... and looking at it, I don't think either is implemented correctly (or alternatively: neither is suitable for what 'gac' uses it). So instead we should probably only retain Assuming we "fix" Actually there are more pitfalls there: one could e.g. define a unary function Anyway, this all goes way beyond this PR. I'll submit a PR of my own addressing some of these. |
I've now made PR #5556 motivated by this one here. |
Thanks, @nskeip ! |
Fixes #4120.
Print function used to have a problem: if a GAP string contained a null character, then the string was printed only up to the null character (which is an expected behavior for traditional C strings). Now a GAP string conaining a null character would be printed from start to end and the null character would be skipped.
Text for release notes
See title.