From: Phillip Wood <phillip.wood@talktalk.net>
To: Eric Sunshine <sunshine@sunshineco.com>,
Phillip Wood <phillip.wood@dunelm.org.uk>
Cc: Git List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH v4 2/2] sequencer: fix quoting in write_author_script
Date: Tue, 7 Aug 2018 14:54:25 +0100 [thread overview]
Message-ID: <753b860e-c922-fd70-9d2d-0581976a6f37@talktalk.net> (raw)
In-Reply-To: <CAPig+cQkY1_qDu=fdbA0gVPH88B47bM5BpgbYY8ivsj1Y0QHTw@mail.gmail.com>
Hi Eric
On 07/08/18 11:23, Eric Sunshine wrote:
> On Tue, Aug 7, 2018 at 5:35 AM Phillip Wood <phillip.wood@talktalk.net> wrote:
>> - Reverted the implementation to v2 with more robust detection of the
>> missing "'" on the last line of the author script based on a
>> suggestion by Eric. This means that this series needs to progress
>> closely with Eric's series of fixes or the fallback code will never
>> be called.
>
> Thanks for working on this. I haven't read the patch closely yet, but
> one thing caught my attention as I ran my eye over it...
>
>> +static int quoting_is_broken(const char *s, size_t n)
>> +{
>> + /* Skip any empty lines in case the file was hand edited */
>> + while (n > 0 && s[--n] == '\n')
>> + ; /* empty */
>> + if (n > 0 && s[n] != '\'')
>> + return 1;
>
> To be "technically correct", I think the condition in the 'if'
> statement should be ">=". It should never happen in practice that the
> entire content of the file is a single character followed by zero or
> more newlines, but using the proper condition ">=" would save future
> readers of this code a "huh?" moment.
>
I'm not sure it is that simple. If the script consists solely of a
single quote then we should return 1, if it is a single character that
is not "'" then it should return 0. Currently it returns 0 in both those
cases so is technically broken when the script is "'". If it used ">="
instead then I think it would return 0 when it should return 1 and vice
versa. As you say this shouldn't happen in practice.
Best Wishes
Phillip
next prev parent reply other threads:[~2018-08-07 13:54 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 7:33 [PATCH v2 0/4] fix "rebase -i --root" corrupting root commit Eric Sunshine
2018-07-31 7:33 ` [PATCH v2 1/4] sequencer: fix "rebase -i --root" corrupting author header Eric Sunshine
2018-07-31 7:33 ` [PATCH v2 2/4] sequencer: fix "rebase -i --root" corrupting author header timezone Eric Sunshine
2018-07-31 9:50 ` Phillip Wood
2018-07-31 10:15 ` Eric Sunshine
2018-07-31 7:33 ` [PATCH v2 3/4] sequencer: fix "rebase -i --root" corrupting author header timestamp Eric Sunshine
2018-07-31 10:00 ` Phillip Wood
2018-07-31 10:30 ` Eric Sunshine
2018-07-31 7:33 ` [PATCH v2 4/4] sequencer: don't die() on bogus user-edited timestamp Eric Sunshine
2018-07-31 10:02 ` Phillip Wood
2018-07-31 10:38 ` Eric Sunshine
2018-07-31 10:05 ` [PATCH v2 0/4] fix "rebase -i --root" corrupting root commit Phillip Wood
2018-07-31 10:46 ` Eric Sunshine
2018-07-31 11:19 ` Phillip Wood
2018-07-31 11:27 ` Eric Sunshine
2018-07-31 11:15 ` [PATCH v2 0/2] Fix author script quoting Phillip Wood
2018-07-31 11:15 ` [PATCH v2 1/2] sequencer: handle errors in read_author_ident() Phillip Wood
2018-07-31 20:47 ` Eric Sunshine
2018-08-01 9:28 ` Phillip Wood
2018-07-31 11:15 ` [PATCH v2 2/2] sequencer: fix quoting in write_author_script Phillip Wood
2018-07-31 21:39 ` Eric Sunshine
2018-08-01 10:24 ` Phillip Wood
2018-08-01 15:22 ` Junio C Hamano
2018-08-01 15:50 ` Phillip Wood
2018-08-01 19:19 ` Eric Sunshine
2018-08-01 1:30 ` [PATCH v2 0/4] fix "rebase -i --root" corrupting root commit Hilco Wijbenga
2018-08-01 6:22 ` Eric Sunshine
2018-08-07 1:19 ` Hilco Wijbenga
2018-08-07 3:31 ` Eric Sunshine
2018-08-07 21:09 ` Junio C Hamano
2018-08-27 22:34 ` Johannes Schindelin
2018-08-01 23:25 ` brian m. carlson
2018-08-02 8:09 ` Eric Sunshine
2018-08-02 11:20 ` [PATCH v3 0/2] Fix author script quoting Phillip Wood
2018-08-02 11:20 ` [PATCH v3 1/2] sequencer: handle errors in read_author_ident() Phillip Wood
2018-08-03 7:09 ` Eric Sunshine
2018-08-03 15:53 ` Junio C Hamano
2018-08-02 11:20 ` [PATCH v3 2/2] sequencer: fix quoting in write_author_script Phillip Wood
2018-08-02 17:27 ` Junio C Hamano
2018-08-03 7:59 ` Eric Sunshine
2018-08-03 9:33 ` Phillip Wood
2018-08-03 10:02 ` Eric Sunshine
2018-08-03 14:12 ` Phillip Wood
2018-08-07 17:20 ` Junio C Hamano
2018-08-07 9:34 ` [PATCH v4 0/2] fix author-script quoting Phillip Wood
2018-08-07 9:34 ` [PATCH v4 1/2] sequencer: handle errors from read_author_ident() Phillip Wood
2018-08-08 9:43 ` Eric Sunshine
2018-08-07 9:34 ` [PATCH v4 2/2] sequencer: fix quoting in write_author_script Phillip Wood
2018-08-07 10:23 ` Eric Sunshine
2018-08-07 13:54 ` Phillip Wood [this message]
2018-08-08 8:43 ` Eric Sunshine
2018-08-08 16:01 ` Junio C Hamano
2018-08-09 10:06 ` Phillip Wood
2018-08-09 10:08 ` Phillip Wood
2018-08-08 9:39 ` Eric Sunshine
2018-08-09 10:11 ` Phillip Wood
2018-08-08 9:51 ` [PATCH v4 0/2] fix author-script quoting Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=753b860e-c922-fd70-9d2d-0581976a6f37@talktalk.net \
--to=phillip.wood@talktalk.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).