-
Notifications
You must be signed in to change notification settings - Fork 252
src/chgpasswd.c: fix handling of files without trailing newlines #1358
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
Conversation
Fix chgpasswd to properly handle input files that don't end with a newline, similar to how chpasswd handles this case. Previously, chgpasswd would incorrectly report "line too long" errors when processing the last line of a file that didn't end with a newline character. The fix adds proper end-of-file detection and long line handling logic consistent with chpasswd implementation. Signed-off-by: Iker Pedrosa <[email protected]>
I don't like handling files without a trailing newline. Those files are not POSIX conforming, and we should reject them. I strongly oppose this change, as it increases the complexity of the code unnecessarily. Instead files should be fixed to have a trailing line, which is simple to fix.
I want to remove that code, actually.
|
After reading this definition, I agree with you. I proceed to close the PR. |
Thanks! :-) |
Fix chgpasswd to properly handle input files that don't end with a newline, similar to how chpasswd handles this case. Previously, chgpasswd would incorrectly report "line too long" errors when processing the last line of a file that didn't end with a newline character.
The fix adds proper end-of-file detection and long line handling logic consistent with chpasswd implementation.
I discovered this issue while developing
test_chgpasswd__change_passwords_from_filefrom #1357.