{"thread":{"id":"46966","subject":"[PATCH] sequencer.c: unify error messages","startedAt":"2017-10-13T17:52:08Z","lastAt":"2017-10-16T12:46:47Z","messageCount":9,"participants":["Ralf Thielow","René Scharfe","Johannes Schindelin","Junio C Hamano","Philip Oakley"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"330376","messageId":"20171013175157.13634-1-ralf.thielow@gmail.com","threadId":"46966","inReplyTo":null,"subject":"[PATCH] sequencer.c: unify error messages","fromName":"Ralf Thielow","fromEmail":"ralf.thielow@gmail.com","sentAt":"2017-10-13T17:51:57Z","receivedAt":"2017-10-13T17:52:08Z","isPatch":true,"sender":{"key":"ralf.thielow@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1275832?v=4"},"body":"When ftruncate() in rearrange_squash() fails, we write\nthat we couldn't finish the operation on the todo file.\nIt is more accurate to write that we couldn't truncate\nas we do in other calls of ftruncate().\n\nWhile at there, remove a full stop in another error message.\n\nSigned-off-by: Ralf Thielow <ralf.thielow@gmail.com>\n---\n sequencer.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex e258bb646..b0e6459a5 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2948,9 +2948,9 @@ int rearrange_squash(void)\n \t\tif (fd < 0)\n \t\t\tres = error_errno(_(\"could not open '%s'\"), todo_file);\n \t\telse if (write(fd, buf.buf, buf.len) < 0)\n-\t\t\tres = error_errno(_(\"could not read '%s'.\"), todo_file);\n+\t\t\tres = error_errno(_(\"could not read '%s'\"), todo_file);\n \t\telse if (ftruncate(fd, buf.len) < 0)\n-\t\t\tres = error_errno(_(\"could not finish '%s'\"),\n+\t\t\tres = error_errno(_(\"could not truncate '%s'\"),\n \t\t\t\t\t   todo_file);\n \t\tclose(fd);\n \t\tstrbuf_release(&buf);\n-- \n2.15.0.rc0.296.g7b26d72\n\n"},{"id":"330380","messageId":"58336f0d-366c-6636-1e94-22afbafdfe4c@web.de","threadId":"46966","inReplyTo":"20171013175157.13634-1-ralf.thielow@gmail.com","subject":"Re: [PATCH] sequencer.c: unify error messages","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2017-10-13T21:12:22Z","receivedAt":"2017-10-13T21:12:34Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 13.10.2017 um 19:51 schrieb Ralf Thielow:\n> When ftruncate() in rearrange_squash() fails, we write\n> that we couldn't finish the operation on the todo file.\n> It is more accurate to write that we couldn't truncate\n> as we do in other calls of ftruncate().\n\nWould it make sense to factor out rewriting the to-do file to avoid\ncode duplication in the first place?\n\n> While at there, remove a full stop in another error message.\n> \n> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>\n> ---\n>   sequencer.c | 4 ++--\n>   1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/sequencer.c b/sequencer.c\n> index e258bb646..b0e6459a5 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -2948,9 +2948,9 @@ int rearrange_squash(void)\n>   \t\tif (fd < 0)\n>   \t\t\tres = error_errno(_(\"could not open '%s'\"), todo_file);\n>   \t\telse if (write(fd, buf.buf, buf.len) < 0)\n> -\t\t\tres = error_errno(_(\"could not read '%s'.\"), todo_file);\n> +\t\t\tres = error_errno(_(\"could not read '%s'\"), todo_file);\n                                                       ^^^^\nThat should read \"write\", right?\n\n>   \t\telse if (ftruncate(fd, buf.len) < 0)\n> -\t\t\tres = error_errno(_(\"could not finish '%s'\"),\n> +\t\t\tres = error_errno(_(\"could not truncate '%s'\"),\n>   \t\t\t\t\t   todo_file);\n\nHmm, why call ftruncate(2) instead of opening the file with O_TRUNC?\n\n>   \t\tclose(fd);\n>   \t\tstrbuf_release(&buf);\n> \n"},{"id":"330403","messageId":"alpine.DEB.2.21.1.1710151724200.40514@virtualbox","threadId":"46966","inReplyTo":"20171013175157.13634-1-ralf.thielow@gmail.com","subject":"Re: [PATCH] sequencer.c: unify error messages","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-10-15T15:24:59Z","receivedAt":"2017-10-15T15:25:16Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ralf,\n\nOn Fri, 13 Oct 2017, Ralf Thielow wrote:\n\n> When ftruncate() in rearrange_squash() fails, we write\n> that we couldn't finish the operation on the todo file.\n> It is more accurate to write that we couldn't truncate\n> as we do in other calls of ftruncate().\n> \n> While at there, remove a full stop in another error message.\n\nThanks, looks good (maybe s/read/write/ as pointed out by René, though?).\n\nCiao,\nDscho"},{"id":"330408","messageId":"CAN0XMOKjhoi-_bWqOpF-uTtaF8YrmPfR_0RMDePZSzOxAi2bwQ@mail.gmail.com","threadId":"46966","inReplyTo":"58336f0d-366c-6636-1e94-22afbafdfe4c@web.de","subject":"Re: [PATCH] sequencer.c: unify error messages","fromName":"Ralf Thielow","fromEmail":"ralf.thielow@gmail.com","sentAt":"2017-10-15T17:07:11Z","receivedAt":"2017-10-15T17:07:17Z","isPatch":true,"sender":{"key":"ralf.thielow@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1275832?v=4"},"body":"2017-10-13 23:12 GMT+02:00 René Scharfe <l.s.r@web.de>:\n> Am 13.10.2017 um 19:51 schrieb Ralf Thielow:\n>> When ftruncate() in rearrange_squash() fails, we write\n>> that we couldn't finish the operation on the todo file.\n>> It is more accurate to write that we couldn't truncate\n>> as we do in other calls of ftruncate().\n>\n> Would it make sense to factor out rewriting the to-do file to avoid\n> code duplication in the first place?\n>\n>> While at there, remove a full stop in another error message.\n>>\n>> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>\n>> ---\n>>   sequencer.c | 4 ++--\n>>   1 file changed, 2 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/sequencer.c b/sequencer.c\n>> index e258bb646..b0e6459a5 100644\n>> --- a/sequencer.c\n>> +++ b/sequencer.c\n>> @@ -2948,9 +2948,9 @@ int rearrange_squash(void)\n>>               if (fd < 0)\n>>                       res = error_errno(_(\"could not open '%s'\"), todo_file);\n>>               else if (write(fd, buf.buf, buf.len) < 0)\n>> -                     res = error_errno(_(\"could not read '%s'.\"), todo_file);\n>> +                     res = error_errno(_(\"could not read '%s'\"), todo_file);\n>                                                        ^^^^\n> That should read \"write\", right?\n>\n\nSure. I'll send a new version of this patch to fix the messages. Maybe\nsomeone else picks up the other things. Thanks.\n\n>>               else if (ftruncate(fd, buf.len) < 0)\n>> -                     res = error_errno(_(\"could not finish '%s'\"),\n>> +                     res = error_errno(_(\"could not truncate '%s'\"),\n>>                                          todo_file);\n>\n> Hmm, why call ftruncate(2) instead of opening the file with O_TRUNC?\n>\n>>               close(fd);\n>>               strbuf_release(&buf);\n>>\n"},{"id":"330409","messageId":"20171015170742.8395-1-ralf.thielow@gmail.com","threadId":"46966","inReplyTo":"20171013175157.13634-1-ralf.thielow@gmail.com","subject":"[PATCH v2] sequencer.c: fix and unify error messages in rearrange_squash()","fromName":"Ralf Thielow","fromEmail":"ralf.thielow@gmail.com","sentAt":"2017-10-15T17:07:42Z","receivedAt":"2017-10-15T17:07:53Z","isPatch":true,"sender":{"key":"ralf.thielow@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1275832?v=4"},"body":"When the write opertion fails, we write that we could\nnot read. Change the error message to match the operation\nand remove the full stop at the end.\n\nWhen ftruncate() fails, we write that we couldn't finish\nthe operation on the todo file. It is more accurate to write\nthat we couldn't truncate as we do in other calls of ftruncate().\n\nSigned-off-by: Ralf Thielow <ralf.thielow@gmail.com>\n---\n sequencer.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex e258bb646..75f5356f6 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2948,9 +2948,9 @@ int rearrange_squash(void)\n \t\tif (fd < 0)\n \t\t\tres = error_errno(_(\"could not open '%s'\"), todo_file);\n \t\telse if (write(fd, buf.buf, buf.len) < 0)\n-\t\t\tres = error_errno(_(\"could not read '%s'.\"), todo_file);\n+\t\t\tres = error_errno(_(\"could not write '%s'\"), todo_file);\n \t\telse if (ftruncate(fd, buf.len) < 0)\n-\t\t\tres = error_errno(_(\"could not finish '%s'\"),\n+\t\t\tres = error_errno(_(\"could not truncate '%s'\"),\n \t\t\t\t\t   todo_file);\n \t\tclose(fd);\n \t\tstrbuf_release(&buf);\n-- \n2.15.0.rc0.296.g7b26d72\n\n"},{"id":"330439","messageId":"xmqqfuajuae8.fsf@gitster.mtv.corp.google.com","threadId":"46966","inReplyTo":"20171015170742.8395-1-ralf.thielow@gmail.com","subject":"Re: [PATCH v2] sequencer.c: fix and unify error messages in rearrange_squash()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-10-16T01:52:31Z","receivedAt":"2017-10-16T01:52:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ralf Thielow <ralf.thielow@gmail.com> writes:\n\n> When the write opertion fails, we write that we could\n> not read. Change the error message to match the operation\n> and remove the full stop at the end.\n>\n> When ftruncate() fails, we write that we couldn't finish\n> the operation on the todo file. It is more accurate to write\n> that we couldn't truncate as we do in other calls of ftruncate().\n\nWouldn't it be more accurate to say we couldn't ftruncate, though?\n\n>\n> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>\n> ---\n>  sequencer.c | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/sequencer.c b/sequencer.c\n> index e258bb646..75f5356f6 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -2948,9 +2948,9 @@ int rearrange_squash(void)\n>  \t\tif (fd < 0)\n>  \t\t\tres = error_errno(_(\"could not open '%s'\"), todo_file);\n>  \t\telse if (write(fd, buf.buf, buf.len) < 0)\n> -\t\t\tres = error_errno(_(\"could not read '%s'.\"), todo_file);\n> +\t\t\tres = error_errno(_(\"could not write '%s'\"), todo_file);\n>  \t\telse if (ftruncate(fd, buf.len) < 0)\n> -\t\t\tres = error_errno(_(\"could not finish '%s'\"),\n> +\t\t\tres = error_errno(_(\"could not truncate '%s'\"),\n>  \t\t\t\t\t   todo_file);\n>  \t\tclose(fd);\n>  \t\tstrbuf_release(&buf);\n"},{"id":"330451","messageId":"alpine.DEB.2.21.1.1710161331290.40514@virtualbox","threadId":"46966","inReplyTo":"xmqqfuajuae8.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2] sequencer.c: fix and unify error messages in rearrange_squash()","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-10-16T11:32:54Z","receivedAt":"2017-10-16T11:33:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Mon, 16 Oct 2017, Junio C Hamano wrote:\n\n> Ralf Thielow <ralf.thielow@gmail.com> writes:\n> \n> > When the write opertion fails, we write that we could\n> > not read. Change the error message to match the operation\n> > and remove the full stop at the end.\n> >\n> > When ftruncate() fails, we write that we couldn't finish\n> > the operation on the todo file. It is more accurate to write\n> > that we couldn't truncate as we do in other calls of ftruncate().\n> \n> Wouldn't it be more accurate to say we couldn't ftruncate, though?\n\nThis is an end-user facing error message, right? Should we not let users\nwho are happily oblivious of POSIX nomenclature remain happily oblivious?\n\nIn other words, I would be finer with \"truncate\" than with \"ftruncate...\nwait, huh? Is that even English?\"\n\nCiao,\nDscho\n"},{"id":"330453","messageId":"17346CCF8DEF41E790C96248408E07D2@PhilipOakley","threadId":"46966","inReplyTo":"alpine.DEB.2.21.1.1710161331290.40514@virtualbox","subject":"Re: [PATCH v2] sequencer.c: fix and unify error messages in rearrange_squash()","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2017-10-16T12:36:35Z","receivedAt":"2017-10-16T12:36:39Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Johannes Schindelin\" <Johannes.Schindelin@gmx.de>\n> On Mon, 16 Oct 2017, Junio C Hamano wrote:\n>\n>> Ralf Thielow <ralf.thielow@gmail.com> writes:\n>>\n>> > When the write opertion fails, we write that we could\n>> > not read. Change the error message to match the operation\n>> > and remove the full stop at the end.\n>> >\n>> > When ftruncate() fails, we write that we couldn't finish\n>> > the operation on the todo file. It is more accurate to write\n>> > that we couldn't truncate as we do in other calls of ftruncate().\n>>\n>> Wouldn't it be more accurate to say we couldn't ftruncate, though?\n>\n> This is an end-user facing error message, right? Should we not let users\n> who are happily oblivious of POSIX nomenclature remain happily oblivious?\n>\n> In other words, I would be finer with \"truncate\" than with \"ftruncate...\n> wait, huh? Is that even English?\"\n>\nHi, 'Truncate' is real English, but it is not that common in normal usage.\n\nMy dictionary suggests that it means 'cut off at the tip' such as a \ntruncated cone. However the thesaurus is far more relaxed about the common \nidioms that truncate at the tail such as: clip, crop, cut short, trim, \nabbreviate, curtail, etc.\n\nSo perhaps \"could not trim '%s'\".\n\n--\nPhilip\n\n"},{"id":"330454","messageId":"xmqqwp3vqmz4.fsf@gitster.mtv.corp.google.com","threadId":"46966","inReplyTo":"17346CCF8DEF41E790C96248408E07D2@PhilipOakley","subject":"Re: [PATCH v2] sequencer.c: fix and unify error messages in rearrange_squash()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-10-16T12:46:39Z","receivedAt":"2017-10-16T12:46:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philip Oakley\" <philipoakley@iee.org> writes:\n\n> Hi, 'Truncate' is real English, but it is not that common in normal usage.\n>\n> My dictionary suggests that it means 'cut off at the tip' such as a\n> truncated cone. However the thesaurus is far more relaxed about the\n> common idioms that truncate at the tail such as: clip, crop, cut\n> short, trim, abbreviate, curtail, etc.\n>\n> So perhaps \"could not trim '%s'\".\n\nTruncate is fine, as there is already another instance that barfs\nwith \"cannot truncate\" upon an error from ftruncate(), and the patch\nmerely matches the two error messages.\n"}]}