From: "Rubén Justo" <rjusto@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Kristoffer Haugsbakk <code@khaugsbakk.name>, git@vger.kernel.org
Subject: Re: [PATCH v3 2/2] column: guard against negative padding
Date: Wed, 14 Feb 2024 00:25:46 +0100 [thread overview]
Message-ID: <8acde766-e2cd-4901-b665-f677cd15295d@gmail.com> (raw)
In-Reply-To: <xmqqle7o5f34.fsf@gitster.g>
On 13-feb-2024 11:39:11, Junio C Hamano wrote:
> Rubén Justo <rjusto@gmail.com> writes:
>
> >> This one happens to be safe currently because "git tag" passes 2 in
> >> opts->padding, but I do not think this is needed.
> >
> > At first glance, I also thought this was not necessary.
> >
> > However, callers of run_column_filter() might forget to check the return
> > value, and the BUG() triggered by the underlying process could be buried
> > and ignored. Having the BUG() here, in the same process, makes it more
> > noticeable.
>
> The point of BUG() is to help developers catch the silly breakage
> before it excapes from the lab, and we can expect these careless
> developers to ignore the return value. But "column --padding=-1"
> invoked as a subprocess will show a human-readable error message
> to such a developer, so it is less important than the BUG() in the
> other place.
Thinking again about this; you are right. That BUG() in
run_column_filter() does not make sense in this series.
It is addressing a different error, and perhaps a solution could be:
--- >8 ---
Subject: [PATCH] tag: error when git-column fails
If the user asks for the list of tags to be displayed in columns
("--columns"), a child git-column process is used to format the output
as expected.
In a rare situation where we encounter a problem spawning that child
process, we will work erroneously.
Make noticeable we're having a problem executing git-column, so the user
can act accordingly.
Signed-off-by: Rubén Justo <rjusto@gmail.com>
---
builtin/tag.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/tag.c b/builtin/tag.c
index 37473ac21f..30532b76d5 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -530,7 +530,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
struct column_options copts;
memset(&copts, 0, sizeof(copts));
copts.padding = 2;
- run_column_filter(colopts, &copts);
+ if (run_column_filter(colopts, &copts))
+ die(_("could not start 'git column'")
}
filter.name_patterns = argv;
ret = list_tags(&filter, sorting, &format);
--
2.43.0
next prev parent reply other threads:[~2024-02-13 23:25 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
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 [this message]
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=8acde766-e2cd-4901-b665-f677cd15295d@gmail.com \
--to=rjusto@gmail.com \
--cc=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
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).