{"thread":{"id":"2850","subject":"[PATCH] \\n usage in stderr output","startedAt":"2005-12-15T07:47:30Z","lastAt":"2005-12-15T08:57:05Z","messageCount":3,"participants":["Alex Riesen","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"13674","messageId":"81b0412b0512142347o6e9aaef8s227ad749f3e2a475@mail.gmail.com","threadId":"2850","inReplyTo":null,"subject":"[PATCH] \\n usage in stderr output","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-15T07:47:30Z","receivedAt":"2005-12-15T07:47:30Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"fprintf and die sometimes have missing/excessive \"\\n\" in their arguments,\ncorrect the strings where I think it would be appropriate.\n\nSigned-off-by: Alex Riesen <raa.lkml@gmail.com>\n\n---\n\nIt is always stderr, so I can hope I am not breaking anyones script...\n\n\nSubject: [PATCH] \\n usage in stderr output (fprintf and die), correct where appropriate\n\nSigned-off-by: Alex Riesen <ariesen@harmanbecker.com>\n\n\n---\n\n config.c       |    2 +-\n git.c          |    2 +-\n receive-pack.c |    2 +-\n sha1_file.c    |    8 ++++----\n show-branch.c  |    4 ++--\n 5 files changed, 9 insertions(+), 9 deletions(-)\n\nef105f6fe8c86d9191db8c25a70abdf272fa35db\ndiff --git a/config.c b/config.c\nindex 5b5a9a2..992e988 100644\n--- a/config.c\n+++ b/config.c\n@@ -487,7 +487,7 @@ int git_config_set_multivar(const char* \n \t\t\tstore.value_regex = (regex_t*)malloc(sizeof(regex_t));\n \t\t\tif (regcomp(store.value_regex, value_regex,\n \t\t\t\t\tREG_EXTENDED)) {\n-\t\t\t\tfprintf(stderr, \"Invalid pattern: %s\",\n+\t\t\t\tfprintf(stderr, \"Invalid pattern: %s\\n\",\n \t\t\t\t\tvalue_regex);\n \t\t\t\tfree(store.value_regex);\n \t\t\t\treturn 6;\ndiff --git a/git.c b/git.c\nindex c26cac6..5939edf 100644\n--- a/git.c\n+++ b/git.c\n@@ -264,7 +264,7 @@ int main(int argc, char **argv, char **e\n \tif (*exec_path != '/') {\n \t\tif (!getcwd(git_command, sizeof(git_command))) {\n \t\t\tfprintf(stderr,\n-\t\t\t\t\"git: cannot determine current directory\");\n+\t\t\t\t\"git: cannot determine current directory\\n\");\n \t\t\texit(1);\n \t\t}\n \t\tlen = strlen(git_command);\ndiff --git a/receive-pack.c b/receive-pack.c\nindex cbe37e7..92878ec 100644\n--- a/receive-pack.c\n+++ b/receive-pack.c\n@@ -79,7 +79,7 @@ static int run_update_hook(const char *r\n \tcase -ERR_RUN_COMMAND_WAITPID_WRONG_PID:\n \t\tdie(\"waitpid is confused\");\n \tcase -ERR_RUN_COMMAND_WAITPID_SIGNAL:\n-\t\tfprintf(stderr, \"%s died of signal\", update_hook);\n+\t\tfprintf(stderr, \"%s died of signal\\n\", update_hook);\n \t\treturn -1;\n \tcase -ERR_RUN_COMMAND_WAITPID_NOEXIT:\n \t\tdie(\"%s died strangely\", update_hook);\ndiff --git a/sha1_file.c b/sha1_file.c\nindex fa22e9c..8db5074 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1274,7 +1274,7 @@ int move_temp_to_file(const char *tmpfil\n \tunlink(tmpfile);\n \tif (ret) {\n \t\tif (ret != EEXIST) {\n-\t\t\tfprintf(stderr, \"unable to write sha1 filename %s: %s\", filename, strerror(ret));\n+\t\t\tfprintf(stderr, \"unable to write sha1 filename %s: %s\\n\", filename, strerror(ret));\n \t\t\treturn -1;\n \t\t}\n \t\t/* FIXME!!! Collision check here ? */\n@@ -1313,7 +1313,7 @@ int write_sha1_file(void *buf, unsigned \n \t}\n \n \tif (errno != ENOENT) {\n-\t\tfprintf(stderr, \"sha1 file %s: %s\", filename, strerror(errno));\n+\t\tfprintf(stderr, \"sha1 file %s: %s\\n\", filename, strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -1321,7 +1321,7 @@ int write_sha1_file(void *buf, unsigned \n \n \tfd = mkstemp(tmpfile);\n \tif (fd < 0) {\n-\t\tfprintf(stderr, \"unable to create temporary sha1 filename %s: %s\", tmpfile, strerror(errno));\n+\t\tfprintf(stderr, \"unable to create temporary sha1 filename %s: %s\\n\", tmpfile, strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -1410,7 +1410,7 @@ int write_sha1_to_fd(int fd, const unsig\n \t\tsize = write(fd, buf + posn, objsize - posn);\n \t\tif (size <= 0) {\n \t\t\tif (!size) {\n-\t\t\t\tfprintf(stderr, \"write closed\");\n+\t\t\t\tfprintf(stderr, \"write closed\\n\");\n \t\t\t} else {\n \t\t\t\tperror(\"write \");\n \t\t\t}\ndiff --git a/show-branch.c b/show-branch.c\nindex ab158eb..f3522b7 100644\n--- a/show-branch.c\n+++ b/show-branch.c\n@@ -303,7 +303,7 @@ static int append_ref(const char *refnam\n \t\treturn 0;\n \tif (MAX_REVS <= ref_name_cnt) {\n \t\tfprintf(stderr, \"warning: ignoring %s; \"\n-\t\t\t\"cannot handle more than %d refs\",\n+\t\t\t\"cannot handle more than %d refs\\n\",\n \t\t\trefname, MAX_REVS);\n \t\treturn 0;\n \t}\n@@ -535,7 +535,7 @@ int main(int ac, char **av)\n \t\tif (MAX_REVS <= num_rev)\n \t\t\tdie(\"cannot handle more than %d revs.\", MAX_REVS);\n \t\tif (get_sha1(ref_name[num_rev], revkey))\n-\t\t\tdie(\"'%s' is not a valid ref.\\n\", ref_name[num_rev]);\n+\t\t\tdie(\"'%s' is not a valid ref.\", ref_name[num_rev]);\n \t\tcommit = lookup_commit_reference(revkey);\n \t\tif (!commit)\n \t\t\tdie(\"cannot find commit %s (%s)\",\n-- \n0.99.9.GIT\n\n\n\n"},{"id":"13676","messageId":"20051215085242.GO22159@pasky.or.cz","threadId":"2850","inReplyTo":"81b0412b0512142347o6e9aaef8s227ad749f3e2a475@mail.gmail.com","subject":"Re: [PATCH] \\n usage in stderr output","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-12-15T08:52:42Z","receivedAt":"2005-12-15T08:52:42Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Dec 15, 2005 at 08:47:30AM CET, I got a letter\nwhere Alex Riesen <raa.lkml@gmail.com> said that...\n> fprintf and die sometimes have missing/excessive \"\\n\" in their arguments,\n> correct the strings where I think it would be appropriate.\n> \n> Signed-off-by: Alex Riesen <raa.lkml@gmail.com>\n\nWhy don't we just error() or die() at those places anyway?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nVI has two modes: the one in which it beeps and the one in which\nit doesn't.\n"},{"id":"13677","messageId":"81b0412b0512150057l6448a5f9x722917a64b0fdc0f@mail.gmail.com","threadId":"2850","inReplyTo":"20051215085242.GO22159@pasky.or.cz","subject":"Re: [PATCH] \\n usage in stderr output","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2005-12-15T08:57:05Z","receivedAt":"2005-12-15T08:57:05Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 12/15/05, Petr Baudis <pasky@suse.cz> wrote:\n> > fprintf and die sometimes have missing/excessive \"\\n\" in their arguments,\n> > correct the strings where I think it would be appropriate.\n>\n> Why don't we just error() or die() at those places anyway?\n>\nI don't know.\n"}]}