Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
infof: clearly indicate truncation #3216
It was reported off-list that very large error messages garbled the output due to
The internal buffer in
This appends a
Also include a unittest covering
The internal buffer in infof() is limited to 2048 bytes of payload plus an additional byte for NULL termination. Servers with very long error messages can however cause truncation of the string, which currently isn't very clear, and leads to badly formatted output. This appends a "..." marker to the end of the string to clearly show that it has been truncated, and adds a mandatory newline. There are cases when infof() input doesn't require a newline, but when there is truncation of the input is probably not one of them so forcibly add it to avoid breaking the output. Also include a unittest covering infof() to try and catch any bugs introduced in this quite important function.
I was thinking that there are no legitimate usecases of a truncated string not having a trailing