git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: 'BUG' in builtin add -p (was :Re: [ANNOUNCE] Git v2.40.0-rc2)
Date: Wed, 8 Mar 2023 15:51:31 -0500	[thread overview]
Message-ID: <bff58f23-6188-9b1e-b23a-fc3d94e9f72f@gmail.com> (raw)
In-Reply-To: <xmqqy1o8wdgi.fsf@gitster.g>

Hi Dscho,

Le 2023-03-07 à 14:47, Junio C Hamano a écrit :
> A release candidate Git v2.40.0-rc2 is now available for testing at
> the usual places.  It is comprised of 461 non-merge commits since
> v2.39.0, contributed by 78 people, 30 of which are new faces [*].
> 

> ----------------------------------------------------------------
> 
> Git v2.40 Release Notes (draft)
> ===============================
> 

>  * Finally retire the scripted "git add -p/-i" implementation and have
>    everybody use the one reimplemented in C.

I just hit a 'BUG' in the builtin add -p, I'll try to write a reproducer later but
wanted to send a heads up now in case you can reproduced easily on your own with the below info.
Note that this is not new in 2.40-rc2, I'm still on 2.39.1.

Basically I have an unmerged path from a conflicted 'git checkout $branch -m'. I resolved
the conflict, but did not run 'git add'. And then I ran (in the 'doc' directory of the repository)
'git restore -S -p ../doc/path/to/file' and got:

```
BUG: add-patch.c:498: diff starts with unexpected line:
* Unmerged path doc/path/to/file

Aborted (core dumped)

```

and the backtrace from the core dump is the below:


```
Reading symbols from /home/me/bin/git...
[New LWP 4172500]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `git restore -S -p path/to/file'.
Program terminated with signal SIGABRT, Aborted.
#0  0x000014d138b0b7ff in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x000014d138b0b7ff in raise () from /lib64/libc.so.6
#1  0x000014d138af5c35 in abort () from /lib64/libc.so.6
#2  0x0000000000703b75 in BUG_vfl (file=0x779d41 "add-patch.c", line=498, fmt=0x779d50 "diff starts with unexpected line:\n%.*s\n", params=0x7ffdd37529f0) at usage.c:320
#3  0x0000000000703c39 in BUG_fl (file=0x779d41 "add-patch.c", line=498, fmt=0x779d50 "diff starts with unexpected line:\n%.*s\n") at usage.c:330
#4  0x000000000051089a in parse_diff (s=0x7ffdd3752d90, ps=0x7ffdd3753910) at add-patch.c:497
#5  0x0000000000515339 in run_add_p (r=0xa5b3a0 <the_repo>, mode=ADD_P_RESET, revision=0xec35e0 "HEAD", ps=0x7ffdd3753910) at add-patch.c:1758
#6  0x0000000000408511 in run_add_interactive (revision=0xec35e0 "HEAD", patch_mode=0x74119d "--patch=reset", pathspec=0x7ffdd3753910) at builtin/add.c:273
#7  0x0000000000427f4b in checkout_paths (opts=0x7ffdd3753600, new_branch_info=0x7ffdd37533a0) at builtin/checkout.c:528
#8  0x000000000042c24d in checkout_main (argc=1, argv=0x7ffdd3753d40, prefix=0xebe58b "doc/", opts=0x7ffdd3753600, options=0xec0d80, usagestr=0xa342c0 <restore_usage>, new_branch_info=0x7ffdd37533a0)
    at builtin/checkout.c:1820
#9  0x000000000042cd1e in cmd_restore (argc=4, argv=0x7ffdd3753d40, prefix=0xebe58b "doc/") at builtin/checkout.c:1953
#10 0x0000000000406a83 in run_builtin (p=0xa371d8 <commands+2520>, argc=4, argv=0x7ffdd3753d40) at git.c:466
#11 0x0000000000406e68 in handle_builtin (argc=4, argv=0x7ffdd3753d40) at git.c:721
#12 0x00000000004070b6 in run_argv (argcp=0x7ffdd3753bcc, argv=0x7ffdd3753bc0) at git.c:788
#13 0x00000000004075cf in cmd_main (argc=4, argv=0x7ffdd3753d40) at git.c:926
#14 0x000000000050a80b in main (argc=5, argv=0x7ffdd3753d38) at common-main.c:57

```

Hope this helps,

Philippe.

  reply	other threads:[~2023-03-08 20:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 19:47 [ANNOUNCE] Git v2.40.0-rc2 Junio C Hamano
2023-03-08 20:51 ` Philippe Blain [this message]
2023-03-09  8:58   ` [PATCH] add-patch: handle "* Unmerged path" lines Jeff King
2023-03-09 18:05     ` Junio C Hamano
2023-03-10  9:29       ` Jeff King

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=bff58f23-6188-9b1e-b23a-fc3d94e9f72f@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /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).