git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rubén Justo" <rjusto@gmail.com>
To: Kristoffer Haugsbakk <code@khaugsbakk.name>, git@vger.kernel.org
Cc: Tiago Pascoal <tiago@pascoal.net>,
	Chris Torek <chris.torek@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2] column: disallow negative padding
Date: Mon, 12 Feb 2024 22:28:57 +0100	[thread overview]
Message-ID: <effd06fb-8344-4476-b5d5-dcb9f6fff692@gmail.com> (raw)
In-Reply-To: <09b1ab48-b58f-458c-89f5-0c419d92f61a@app.fastmail.com>

On 12-feb-2024 17:50:54, Kristoffer Haugsbakk wrote:
> On Sun, Feb 11, 2024, at 23:47, Rubén Justo wrote:
> > While we're here, I wonder if silently ignoring a negative value in
> > .padding is the right thing to do.
> >
> > There are several callers of print_columns():
> >
> > builtin/branch.c:           print_columns(&output, colopts, NULL);
> > builtin/clean.c:    print_columns(&list, colopts, &copts);
> > builtin/clean.c:    print_columns(menu_list, local_colopts, &copts);
> > builtin/column.c:    print_columns(&list, colopts, &copts);
> > help.c:     print_columns(&list, colopts, &copts);
> > wt-status.c:       print_columns(&output, s->colopts, &copts);
> >
> > I haven't checked it thoroughly but it seems we don't need to add the
> > check we're adding to builtin/column.c, to any of the other callers.
> > However, it is possible that these or other new callers may need it in
> > the future.  If so, we should consider doing something like:
> >
> > diff --git a/column.c b/column.c
> > index c723428bc7..4f870c725f 100644
> > --- a/column.c
> > +++ b/column.c
> > @@ -186,6 +186,9 @@ void print_columns(const struct string_list *list,
> > unsigned int colopts,
> >                 return;
> >         assert((colopts & COL_ENABLE_MASK) != COL_AUTO);
> >
> > +       if (opts && (0 > opts->padding))

;-) (fixed)

> > +               BUG("padding must be non-negative");
> > +
> 
> Sure, I could add a `BUG` for `0 > opts->padding` in v3.

Thank you for considering it.

  reply	other threads:[~2024-02-12 21:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 14:21 git column fails (or crashes) if padding is negative Tiago Pascoal
2024-02-09 16:27 ` Kristoffer Haugsbakk
2024-02-09 17:57   ` Junio C Hamano
2024-02-11 17:08     ` Kristoffer Haugsbakk
2024-02-12 16:37       ` Junio C Hamano
2024-02-09 17:52 ` [PATCH] column: disallow negative padding Kristoffer Haugsbakk
2024-02-09 18:26   ` Kristoffer Haugsbakk
2024-02-10  9:48     ` Chris Torek
2024-02-11 17:10       ` Kristoffer Haugsbakk
2024-02-11 17:55         ` Junio C Hamano
2024-02-11 18:18           ` Kristoffer Haugsbakk
2024-02-11 19:27   ` [PATCH v2] " Kristoffer Haugsbakk
2024-02-11 22:47     ` Rubén Justo
2024-02-11 23:50       ` Rubén Justo
2024-02-12  7:05       ` Kristoffer Haugsbakk
2024-02-12 16:50       ` Kristoffer Haugsbakk
2024-02-12 21:28         ` Rubén Justo [this message]
2024-02-13 16:01     ` [PATCH v3 0/2] " Kristoffer Haugsbakk
2024-02-13 16:01       ` [PATCH v3 1/2] " Kristoffer Haugsbakk
2024-02-13 16:01       ` [PATCH v3 2/2] column: guard against " Kristoffer Haugsbakk
2024-02-13 17:06         ` Junio C Hamano
2024-02-13 18:39           ` Rubén Justo
2024-02-13 19:39             ` Junio C Hamano
2024-02-13 19:56               ` Rubén Justo
2024-02-13 20:35                 ` Kristoffer Haugsbakk
2024-02-13 20:59                   ` Junio C Hamano
2024-02-13 23:25               ` Rubén Justo
2024-02-13 23:36                 ` [PATCH] tag: error when git-column fails Rubén Justo
2024-02-14  1:35                   ` Junio C Hamano
2024-02-13 19:27       ` [PATCH v3 0/2] column: disallow negative padding Rubén Justo
2024-02-13 20:32         ` Kristoffer Haugsbakk
2024-02-13 20:58           ` Junio C Hamano

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=effd06fb-8344-4476-b5d5-dcb9f6fff692@gmail.com \
    --to=rjusto@gmail.com \
    --cc=chris.torek@gmail.com \
    --cc=code@khaugsbakk.name \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tiago@pascoal.net \
    /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).