Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
util: ignore invalid format specifiers#13674
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
In util.format, if a percent sign without a known type is encountered, just print it instead of silently ignoring it and the next character. Fixes: nodejs#13665
| // Invalid format specifiers | ||
| assert.strictEqual(util.format('a% b','x'),'a% b x'); | ||
| assert.strictEqual(util.format('percent: %d%, fraction: %d',10,0.1), | ||
| 'percent: 10%, fraction: 0.1'); |
TimothyGuJun 14, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also test a % at the end of a string?
joyeecheung commented Jun 14, 2017
benjamingr commented Jun 14, 2017
+1 on actual changes. Why did you change your mind from the initial suggestion of |
jasnell commented Jun 14, 2017
Defensively marking this as a semver-major. While this change is definitely the right thing to do, the change in behavior could potentially break code written to depend on the old behavior (as unlikely as that may be) |
targos commented Jun 14, 2017
This is actually restoring the old behavior (that was lost in #12407) so I would consider this semver-patch. |
mcollina left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
joyeecheung commented Jun 15, 2017
+1 to semver-patch since the old behavior only changed in 8.x |
jasnell commented Jun 15, 2017
If there are no objections to landing as semver-patch then I'm good with that |
jasnell commented Jun 15, 2017
/cc @nodejs/ctc ... we have several CTC signoffs already, just want to make sure there are no objections to landing this as a patch. |
jasnell commented Jun 16, 2017
Landing... |
In util.format, if a percent sign without a known type is encountered, just print it instead of silently ignoring it and the next character. PR-URL: #13674Fixes: #13665 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]>
jasnell commented Jun 16, 2017
Landed in 00aac57 |
In util.format, if a percent sign without a known type is encountered, just print it instead of silently ignoring it and the next character. PR-URL: #13674Fixes: #13665 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]>
In util.format, if a percent sign without a known type is encountered, just print it instead of silently ignoring it and the next character. PR-URL: #13674Fixes: #13665 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]>
In util.format, if a percent sign without a known type is encountered,
just print it instead of silently ignoring it and the next character.
Fixes: #13665
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
util