[PATCH GnuPG] Use more helpful error when missing newline at EOF
Erik Paulson
epaulson10 at gmail.com
Thu Nov 3 05:04:04 CET 2022
Currently, if the sshcontrol file does not have a newline at the end,
the agent will return the error "Line too long". This is confusing since
to the eyes of the user, the line is the correct length. This patch
checks for this case and instead returns "Incomplete line", which is a
more accurate description of the user's error.
Signed-off-by: Erik Paulson <epaulson10 at gmail.com>
---
I discovered this while setting up SSH agent support on a new machine
where my editor is not yet configured to add missing EOF newlines. Grep
shows me that this line-reading pattern is in several other files. If
the maintainers agree with this patch, I would be happy to submit a V2
updating those files as well.
agent/command-ssh.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index f237f9355..f02bc8613 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -953,7 +953,7 @@ read_control_file_item (ssh_control_file_t cf)
/* Eat until end of line */
while ((c = es_getc (cf->fp)) != EOF && c != '\n')
;
- return gpg_error (*line? GPG_ERR_LINE_TOO_LONG
+ return gpg_error ((*line && c != EOF)? GPG_ERR_LINE_TOO_LONG
: GPG_ERR_INCOMPLETE_LINE);
}
--
2.38.1
More information about the Gnupg-devel
mailing list