From patchwork Tue Jan 7 14:41:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Mendoza X-Patchwork-Id: 13929135 Received: from mx0b-00311301.pphosted.com (mx0b-00311301.pphosted.com [148.163.142.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F4331F1905 for ; Tue, 7 Jan 2025 14:58:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.142.143 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736261914; cv=fail; b=j4JJFEnfxV3aVY89/a9TFu5zjvLWJr6PWnEgo50lOdZsldAzVqxLl2j/QMCMPpg1qqG6n4YxS3bFW0/gsXJw51OM1MG+VTnCWk+5iLX9I43PzIzExWCvNy/4vd/FO1uaqXnvwPLAhN9CQIw7y5Sr9fqKL9HcOfLrD5HTfzZgFdo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736261914; c=relaxed/simple; bh=vqY5XRbF69N8MgM7NSBZz0GT4o1ovTT0RZ694VM2Blo=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=gW56XtCG4bOSBx720t7QNvFG99+dNG86Bi835MbC3GZQuyWXA51Ict4NJ74HZT+J0a6iWDOh2pdgXDI+wSNQVQXN0FycsO+Km6i+DoYsigCCAgCF/n1kBHt1Krq+TdTy6EBZR0TdQ7oVJDW27XsV1VSubtJPolO4T1IAXWudJC0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=beyondtrust.com; spf=pass smtp.mailfrom=beyondtrust.com; dkim=pass (2048-bit key) header.d=beyondtrust.com header.i=@beyondtrust.com header.b=wc9Kef+4; arc=fail smtp.client-ip=148.163.142.143 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=beyondtrust.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=beyondtrust.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=beyondtrust.com header.i=@beyondtrust.com header.b="wc9Kef+4" Received: from pps.filterd (m0148117.ppops.net [127.0.0.1]) by mx0b-00311301.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 506NMJKa013809 for ; Tue, 7 Jan 2025 06:41:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beyondtrust.com; h=content-type:date:from:message-id:mime-version:subject:to; s= PPS; bh=knwIdXPbVkx8ZnK+IZxcBwZNOrn+Ntje352U1xCTZ5g=; b=wc9Kef+4 o4QMeSe/MVOh5CEiGklu/b5DaRquFLd5o/x267AWpV55ImTlOERAoJpp70r+f/sT lM1NOYxmmJb46xk2jwu/OUqamsSTTzZiw4RaQ7oZ34g69jJui+fsJxnF+gN6c/Jz 5b8riJYdZAQwEW7y/tO4NLIQtBqE7CJX5O5MRJ6/Wiw8AAw02n7Y+jhx6aJ87wQ+ xmmroaSPr6T3ozMVjZKb5daKA8k+uL40OX0iPfKA4CUzpZkWZKvGMZMuBXc4EU0v lr8PJ+ZFqSg6BNxfIWAarWzjThxYj2mhcJ5tCShohsCAJeACjezjoiQDqI8zFYQX 9905h2CGJOsu5Q== Received: from ch4pr04cu002.outbound.protection.outlook.com (mail-northcentralusazlp17013060.outbound.protection.outlook.com [40.93.20.60]) by mx0b-00311301.pphosted.com (PPS) with ESMTPS id 43y3b0v62q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 07 Jan 2025 06:41:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fv+gH2lbHmpmOxXWNjuSoa79p/eug1dRg3jjdFNzzqTxbMlZlUu2nPSNvUzUAKmQrP0PGJJPm4TXHXhXv/AmZ7z+xFdz2YoWXR/T18HvYN5jdLtU/Ou+uRpTg99S59/99rEp9aKFLgzf4lo7JF784ctywdZIO+tvUcCjnuUtti6GeMZaSnq6EV7rqv07cBkTaGfmumQUclDqQO6eqD6ud0A07ibbISo/iZnM79lsQZJhGfBIDLSvsVDPeB3FZVbc2pHpHigfIjJd2iI8vmy0HwDikkn9cw9xj4miKMXlA0M2k1ynalKtoeaM4+B5tUkmsccPPTAQGnHZd+YPdT+p5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=knwIdXPbVkx8ZnK+IZxcBwZNOrn+Ntje352U1xCTZ5g=; b=elh6flYhsSJzhxXbzq8F3tFfS5kFPBovvdEUAUJPFhcPt+EemuwXPq8gwT0UScK0eWI/UQ4IJIuzbdv4+8t5bIMQcs6rFI8yW98nlpfkITi3Zsn6QY627yCnANt0eYKsOBaQN+T0K/IFL/erWOSdoeaFbk/seOTcygfyq9QaI0C55vJAMC+z2B1lTZYF+yasvxybzNSETnJ9+zSXxV5PgIQTxZPGeO1xAah6JFz7yD4lYajd+s8/UzT1CQLyetUzgNOL3R/KV2zTy6Xm46VCQW0sNClsGjfNPuFlrlO0ySsIlEP4BLR6+LfvCl1DXsQTS+L2feUjBNS4z68+6w/hOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=beyondtrust.com; dmarc=pass action=none header.from=beyondtrust.com; dkim=pass header.d=beyondtrust.com; arc=none Received: from DM8PR02MB7942.namprd02.prod.outlook.com (2603:10b6:8:13::8) by SJ0PR02MB8402.namprd02.prod.outlook.com (2603:10b6:a03:3f2::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 14:41:40 +0000 Received: from DM8PR02MB7942.namprd02.prod.outlook.com ([fe80::443a:e98c:3129:b12]) by DM8PR02MB7942.namprd02.prod.outlook.com ([fe80::443a:e98c:3129:b12%4]) with mapi id 15.20.8314.015; Tue, 7 Jan 2025 14:41:39 +0000 From: Keith Mendoza To: "git@vger.kernel.org" Subject: git restore --staged -p on merge conflict causes crash Thread-Topic: git restore --staged -p on merge conflict causes crash Thread-Index: AdthEiJJD91DndapTpWQotl3/tqJlQ== Date: Tue, 7 Jan 2025 14:41:39 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-xink-handled: Yes x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM8PR02MB7942:EE_|SJ0PR02MB8402:EE_ x-ms-office365-filtering-correlation-id: c3d96897-dc88-49e8-5858-08dd2f296565 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|1800799024|38070700018; x-microsoft-antispam-message-info: k3V4+a2q7JPyjEmk88TAwMGk5+0s+nVN4H37qO2boBQwpj6RIVyWbR7Zmfk0cTzcK6AstLOwFoKsnDfrZrC6QTVjtqFxSpnzzZ4twNSDY+VFy63Wzl0pIjE2Glhq97KlSmOwyHQsLN9E+0yseeo0EjxLGUQ8w9UQvtbYFaXvZwKyzA7FfbshavAEFKZwMA1DFHX+Zzti93odZGHbYqd85xoKuTfNMcN+92YCHqic9pwkESiZzMfvsKxE60pT1ZlwLajh6ZH1I4WmTXpbqMjLh16/wKtqMHXnqokQSeFkhK5I7Z7MOTGU1+6Y5Z6XOYRyHL9gD5iIK7Kepvu//eMXFCdNVGSquYs8UiI5o19d0hSc1K6v0D6+SUTeQQCsSDAMcWQqjkeBcT/3sthUZ3Bir1vxpjx8RO6m7AyOPR/pt+YAqzQPlMci1e0ANBQ5M8aioCtlIoC+HvpnDLUiF+M9te86GS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od.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(38070700018);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: gElaLdnBCZQVKYw86vxJXNeYTvCvI4v0D1BtRuq5uPhWWd0wW/uzi8W+g8Wd8Sok/WfrFgQDreQNhU1bRnC5MdkPWQwfkfD6NTklqp8fJZK6Av+QHLevKogk679YTpvIOktSc4kDpVUP3eZT7LZKkU1gnmJxAcCy8eqnpwhpwX5oDpiQwjnEub5Vv3u4AZb4yKGrcIXpZV2+GxvrhAGGZxHm98cnyVoS/h1cX+537Bqtan+b2kF+Q48m+I3fRxp3iJdQLiTG4jD6bB2wMW9vO1vCM16aDN9JOMirrQ4DkwzxKezhPUnxRMlGcIXG2sj8A87aai1Xe0NDVRY3XiwotSbNbAjewQsXqvatltr9fm9WRBtgpFcaL26Kbf4Z63SGXiXR7jcUQ1oZyQm59QEAoGQBjKu/HXShzMG4RcT+iWahG2/RJdEWwU9c86M2ZaaQ7CrfOAvROmzxUhvHpcib/t9cEZISZ1llc3tCcj0ju6CsZQrHvr3X4sAF0nTbFzwJN9LB9iPLlkqjAdYPEE2hZ3FTsUiiq7j/JRhQUxev+6Yd8BfMQoN9htp66Rulfvs7uv4fSXyj9GMB5Pc3dQKzP6VD9WLcw1RR/PKv1NacIzynRxCOU4sOGzcX6Dr3Qq6+qz/jJjbkfYcGRRs/iriHL5MIDysqqKvgyBRfJEhEv4ivR5k+uUu5uppH9wYvtw5yPX5ScITxq7HLBAYZm5xD4za3DVdFYQ0G/R7G7Zb4YeKiH90WRPtLzMegNyFAljOUhVsg7R2vp7//6qS5YEJED/FocGxKe2y1jScsqMl1B+sOk+Gh8jTWqa5RyEzwkyoz+ky7HeVhLo8m7DHoMekkeSOzY56qslMFo9YM9+AvRLiQe7vfOvMFHyqO6R/yCdLicW7xJSUR+qw69HaVg07hH6j9ia5EkBn3hdYQKDFG8qRczRjymwmbZ01KHeathaTwYc4x+Q2Hnh1nfOjwrGMD4jY9J134yzVtsL2/lEB2hI8pWrP/DCKArLgnvYbWSVSHzee6RKQavsyoxN+JsozLO//ZI1nIezKK5abSFFjd0YXVEzkq0EeCQ9JTaT3GRYHKKiv9pUuYSg4/qS3b4me36jbrTzruj5w/IIFRhmc01W78ErdFn6/9d0TAqWqWb7vAR8eI/67fpFN4FvmOszOwjS2CVhF7Cbdf2nYkxGcc5MhPIbbbe2veQkUYQF5j9LFesubcYlAf0b5znUMeDYYzc7i3J06QvJrzxDziRfKZ0ICzFb5ryYGNrLls4JW2qDpRAvyuxFc5vJDbckR3Urf9s6n2vLXSdbEVjAQYSNI2f5BYB9t0vP1GSjYmxMZUo3Zc6TOcb7Xf7Oq+oxCXIuUPl/6UmT9T9Wr5cpXt6ibhcZss3E+z0VSdETTcKAKrvQJ6jF2BkGvp/i91+1rrRBcJ8MN5D1KIefXyu1bs5mQ/v6k6T+lywRMf8HZzK3zhO4XF+d2Bea2V0k8UriIYnJ3SU3eyLGRLgIuy2dZWLZo8Ja4KKBr4rK028ueiS2OGBRIynkMcZmNpZlQr38QlqeYraE/eTJcRmN4hFI8+Vb/1d88TyCQqu6yhSSmyjdHXCDwE Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: beyondtrust.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR02MB7942.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3d96897-dc88-49e8-5858-08dd2f296565 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2025 14:41:39.7377 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5683fad6-d462-468d-9daa-809d2d98368e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nR7p8qER6HC3a4zC+Mt/0jhzyvsbDddfTPEf1ljRwY3d116SAyN579hce/i2DZOPNfyrkOaxjDjPSrTfvob74uIETUmgKEKFbIbmV5v7fCM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB8402 X-Proofpoint-ORIG-GUID: rKElzYafAE7iFf3OpiyBq-PDrahaTIjT X-Proofpoint-GUID: rKElzYafAE7iFf3OpiyBq-PDrahaTIjT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-07_03,2025-01-06_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 bulkscore=0 clxscore=1011 mlxscore=0 suspectscore=0 impostorscore=0 mlxlogscore=918 adultscore=0 phishscore=0 malwarescore=0 priorityscore=1501 classifier=scan_limit adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501070123 What did you do before the bug happened? (Steps to reproduce your issue) 1. Start with a main branch 1. Add a new file (test.yaml) 1. git checkout --no-track -b branch-1 1. Commit a change to test.yaml 1. git checkout main 1. Commit a change to the same lines in test.yaml that was updated in branch-1 1. git checkout branch-1 1. git merge main 1. git restore --staged -p test.yaml What did you expect to happen? (Expected behavior) Be able to select which updates to restore What happened instead? (Actual behavior) The following is displayed on the console ``` BUG: add-patch.c:497: diff starts with unexpected line: * Unmerged path test.yaml Aborted (core dumped) ``` What's different between what you expected and what actually happened? git crashed and generated a core dump. Anything else you want to add: Here's the output of git diff after the `git merge main` ``` +++ b/test.yaml @@@ -1,7 -1,7 +1,13 @@@ job: ++<<<<<<< HEAD + newfield: + field1: blah + field2: blah-blah ++======= + conflict-field: + blah1: blah-blah + blah2: blah-blah-blah ++>>>>>>> main something: required: true other: 1 ``` The generated core dump is attached. Please review the rest of the bug report below. You can delete any lines you don't wish to share. [System Info] git version: git version 2.39.5 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 compiler info: gnuc: 12.2 libc info: glibc: 2.36 $SHELL (typically, interactive shell): /bin/bash [Enabled Hooks] diff --cc test.yaml index 26bf81a,46282a7..0000000 --- a/test.yaml