From: Usman Akinyemi <usmanakinyemi202@gmail.com>
To: phillip.wood@dunelm.org.uk
Cc: Patrick Steinhardt <ps@pks.im>,
Usman Akinyemi via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH v2 2/3] merge: replace atoi() with strtol_i() for marker size validation
Date: Thu, 31 Oct 2024 12:21:15 +0000 [thread overview]
Message-ID: <CAPSxiM8u8CdeipatHRJ8Fq_8hKHDqyTm8OCh7sR49_Bh6Ps8uQ@mail.gmail.com> (raw)
In-Reply-To: <3c081d3c-3f6f-45ff-b254-09f1cd6b7de5@gmail.com>
On Thu, Oct 31, 2024 at 9:58 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
>
> Hi Usman
>
> On 30/10/2024 16:19, Usman Akinyemi wrote:
> > On Wed, Oct 30, 2024 at 3:20 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
> >> On 21/10/2024 13:20, Patrick Steinhardt wrote:
> >>> On Fri, Oct 18, 2024 at 01:52:59PM +0000, Usman Akinyemi via GitGitGadget wrote:
> >>>> From: Usman Akinyemi <usmanakinyemi202@gmail.com>
> >>> These are a bit curious. As your test demonstrates, we retrieve the
> >>> values from the "gitattributes" file. And given that the file tends to be
> >>> checked into the repository, you can now basically break somebody elses
> >>> commands by having an invalid value in there.
> >>>
> >>> That makes me think that we likely shouldn't die here. We may print a
> >>> warning, but other than that we should likely continue and use the
> >>> DEFAULT_CONFLICT_MARKER_SIZE.
> >>
> >> I think using a warning here is a good idea, we should probably fix the
> >> whitespace attributes to do the same. If you have
> >>
> >> * whitespace=indent-with-non-tab,tab-in-indent
> >>
> >> in .gitattributes then "git diff" dies with
> >>
> >> fatal: cannot enforce both tab-in-indent and indent-with-non-tab
> >>
> >> Anyway that's not really related to this series but I thought I'd add it
> >> as #leftoverbits for future reference.
> >>
> >> Thanks for working on this Usman, what is queued in next looks good to me.
> >
> > I just checked it. I will be glad to work on it.
>
> If you want to work on this that's great, but please don't feel any
> obligation to do so.
>
> > I also noticed that the test used for testing used a different
> > approach(test_must_fail) compared to the one I wrote which used
> > test_grep. Should I change the test also ?
>
> I'm not sure which test you are looking at but I assume it is using
> test_must_fail because the command being tested is expected to die. If
> we change the code to print a warning instead then we'd need to capture
> stderr and use test_grep or test_cmp. Note that we only want to print a
> warning when parsing .gitattributes, the other callers of
> parse_whitespace_rule() still want to die. Also we should decide what
> value to use when the user provides both - neither indent-with-non-tab
> or tab-in-indent are on by default so it's not clear exactly what we
> should do.
Hi Philip,
I understand, we will have to pick one if we are to use a warning in this case,
indent-with-non-tab seems to be a good candidate as it is not excluded
by default.
We can have something like this
if (rule & WS_TAB_IN_INDENT && rule & WS_INDENT_WITH_NON_TAB) {
warning(_("cannot enforce both tab-in-indent and
indent-with-non-tab, removing tab-in-indent"));
rule &= ~WS_TAB_IN_INDENT;
}
and this for default
#define WS_DEFAULT_RULE (WS_TRAILING_SPACE | WS_SPACE_BEFORE_TAB |
WS_INDENT_WITH_NON_TAB | 8)
or just leave the WS_DEFAULT_RULE as it is and remove WS_TAB_IN_INDENT
in case both are set.
what do you think ?
Thank you.
Usman
>
> > Also, when should someone redirect a warning/failure into a file then
> > use test_grep or just used test_must_fail ?
>
> You must use test_must_fail if you expect a git command to fail, if you
> expect the command to print a warning but exit successfully you should
> not use test_must_fail. So if you expect a command to fail and print an
> error or warning then you'd do
>
> test_must_fail git my failing command 2>err &&
> test_grep "error message" err
>
> test_must_fail checks that the command fails, but reports an error if
> the command is killed by a signal such as SIGSEV.
Thanks for the explanation. I understand it well now.
>
> Best Wishes
>
> Phillip
>
> > Thank you
> > Usman Akinyemi
> >>
> >> Best Wishes
> >>
> >> Phillip
> >>
> >>
> >>> Patrick
> >>>
> >>
> >
>
next prev parent reply other threads:[~2024-10-31 12:21 UTC|newest]
Thread overview: 94+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 23:09 [PATCH 0/3] R atoi Usman Akinyemi via GitGitGadget
2024-10-12 23:09 ` [PATCH 1/3] t3404: avoid losing exit status with focus on `git show` and `git cat-file` Usman Akinyemi via GitGitGadget
2024-10-14 21:29 ` Taylor Blau
2024-10-12 23:09 ` [PATCH 2/3] t3404: replace test with test_line_count() Usman Akinyemi via GitGitGadget
2024-10-14 21:35 ` Taylor Blau
2024-10-12 23:09 ` [PATCH 3/3] parse: replace atoi() with strtoul_ui() and strtol_i() Usman Akinyemi via GitGitGadget
2024-10-13 9:42 ` Usman Akinyemi
2024-10-14 9:00 ` Phillip Wood
2024-10-14 15:56 ` Usman Akinyemi
2024-10-14 10:53 ` Patrick Steinhardt
2024-10-14 13:57 ` Phillip Wood
2024-10-14 14:00 ` Patrick Steinhardt
2024-10-14 14:55 ` Phillip Wood
2024-10-14 16:13 ` Usman Akinyemi
2024-10-14 16:26 ` Usman Akinyemi
2024-10-14 18:36 ` phillip.wood123
2024-10-15 15:17 ` Usman Akinyemi
2024-10-15 16:19 ` Taylor Blau
2024-10-16 17:58 ` Usman Akinyemi
2024-10-15 18:28 ` phillip.wood123
2024-10-16 9:20 ` Phillip Wood
2024-10-16 18:00 ` Usman Akinyemi
2024-10-17 11:56 ` Usman Akinyemi
2024-10-17 12:02 ` Patrick Steinhardt
2024-10-17 12:13 ` Usman Akinyemi
2024-10-14 16:03 ` Usman Akinyemi
2024-10-14 9:49 ` Phillip Wood
2024-10-14 10:06 ` Kristoffer Haugsbakk
2024-10-14 13:48 ` Phillip Wood
2024-10-14 18:20 ` Usman Akinyemi
2024-10-14 18:30 ` phillip.wood123
2024-10-17 11:16 ` Usman Akinyemi
2024-10-18 13:52 ` [PATCH v2 0/3] " Usman Akinyemi via GitGitGadget
2024-10-18 13:52 ` [PATCH v2 1/3] daemon: " Usman Akinyemi via GitGitGadget
2024-10-21 12:20 ` Patrick Steinhardt
2024-10-21 13:43 ` Usman Akinyemi
2024-10-21 16:24 ` Taylor Blau
2024-10-21 16:34 ` Usman Akinyemi
2024-10-18 13:52 ` [PATCH v2 2/3] merge: replace atoi() with strtol_i() for marker size validation Usman Akinyemi via GitGitGadget
2024-10-21 12:20 ` Patrick Steinhardt
2024-10-21 14:24 ` Usman Akinyemi
2024-10-21 16:34 ` Taylor Blau
2024-10-21 16:39 ` Usman Akinyemi
2024-10-21 18:00 ` Usman Akinyemi
2024-10-21 19:56 ` Taylor Blau
2024-10-30 15:20 ` Phillip Wood
2024-10-30 16:19 ` Usman Akinyemi
2024-10-31 9:58 ` Phillip Wood
2024-10-31 12:21 ` Usman Akinyemi [this message]
2024-11-06 6:05 ` Usman Akinyemi
2024-11-06 16:03 ` phillip.wood123
2024-10-18 13:53 ` [PATCH v2 3/3] imap: replace atoi() with strtol_i() for UIDVALIDITY and UIDNEXT parsing Usman Akinyemi via GitGitGadget
2024-10-21 12:20 ` Patrick Steinhardt
2024-10-21 12:27 ` Usman Akinyemi
2024-10-21 12:34 ` Patrick Steinhardt
2024-10-21 14:38 ` Usman Akinyemi
2024-10-21 16:35 ` Taylor Blau
2024-10-21 16:36 ` Usman Akinyemi
2024-10-22 13:43 ` Usman Akinyemi
2024-10-18 21:21 ` [PATCH v2 0/3] parse: replace atoi() with strtoul_ui() and strtol_i() Taylor Blau
2024-10-18 21:29 ` Usman Akinyemi
2024-10-18 21:35 ` Taylor Blau
2024-10-18 21:43 ` Usman Akinyemi
2024-10-22 5:23 ` [PATCH v3 " Usman Akinyemi via GitGitGadget
2024-10-22 5:23 ` [PATCH v3 1/3] daemon: " Usman Akinyemi via GitGitGadget
2024-10-22 16:21 ` Taylor Blau
2024-10-22 22:06 ` Usman Akinyemi
2024-10-22 5:23 ` [PATCH v3 2/3] merge: replace atoi() with strtol_i() for marker size validation Usman Akinyemi via GitGitGadget
2024-10-22 5:23 ` [PATCH v3 3/3] imap: replace atoi() with strtol_i() for UIDVALIDITY and UIDNEXT parsing Usman Akinyemi via GitGitGadget
2024-10-22 22:08 ` [PATCH v4 0/3] parse: replace atoi() with strtoul_ui() and strtol_i() Usman Akinyemi via GitGitGadget
2024-10-22 22:08 ` [PATCH v4 1/3] daemon: " Usman Akinyemi via GitGitGadget
2024-10-22 22:08 ` [PATCH v4 2/3] merge: replace atoi() with strtol_i() for marker size validation Usman Akinyemi via GitGitGadget
2024-10-22 22:08 ` [PATCH v4 3/3] imap: replace atoi() with strtol_i() for UIDVALIDITY and UIDNEXT parsing Usman Akinyemi via GitGitGadget
2024-10-23 6:05 ` Patrick Steinhardt
2024-10-23 7:40 ` Usman Akinyemi
2024-10-23 7:40 ` [PATCH v5 0/3] parse: replace atoi() with strtoul_ui() and strtol_i() Usman Akinyemi via GitGitGadget
2024-10-23 7:40 ` [PATCH v5 1/3] daemon: " Usman Akinyemi via GitGitGadget
2024-10-23 20:31 ` Taylor Blau
2024-10-24 0:23 ` Usman Akinyemi
2024-10-23 7:40 ` [PATCH v5 2/3] merge: replace atoi() with strtol_i() for marker size validation Usman Akinyemi via GitGitGadget
2024-10-23 20:32 ` Taylor Blau
2024-10-24 0:23 ` Usman Akinyemi
2024-10-23 7:40 ` [PATCH v5 3/3] imap: replace atoi() with strtol_i() for UIDVALIDITY and UIDNEXT parsing Usman Akinyemi via GitGitGadget
2024-10-23 8:52 ` [PATCH v5 0/3] parse: replace atoi() with strtoul_ui() and strtol_i() Patrick Steinhardt
2024-10-23 20:33 ` Taylor Blau
2024-10-24 0:25 ` Usman Akinyemi
2024-10-24 0:24 ` [PATCH v6 " Usman Akinyemi via GitGitGadget
2024-10-24 0:24 ` [PATCH v6 1/3] daemon: " Usman Akinyemi via GitGitGadget
2024-10-24 0:24 ` [PATCH v6 2/3] merge: replace atoi() with strtol_i() for marker size validation Usman Akinyemi via GitGitGadget
2024-10-24 0:24 ` [PATCH v6 3/3] imap: replace atoi() with strtol_i() for UIDVALIDITY and UIDNEXT parsing Usman Akinyemi via GitGitGadget
2024-10-24 18:03 ` [PATCH v6 0/3] parse: replace atoi() with strtoul_ui() and strtol_i() Taylor Blau
2024-10-25 5:06 ` Patrick Steinhardt
2024-10-25 6:11 ` Usman Akinyemi
2024-10-25 14:44 ` Taylor Blau
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPSxiM8u8CdeipatHRJ8Fq_8hKHDqyTm8OCh7sR49_Bh6Ps8uQ@mail.gmail.com \
--to=usmanakinyemi202@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
/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.
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 NNTP newsgroup(s).