From nobody Thu Feb 16 03:34:49 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PHLDB15rJz3s0wb; Thu, 16 Feb 2023 03:34:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PHLD95MSNz4M82; Thu, 16 Feb 2023 03:34:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676518489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NGbgfurNTbGyTmLE2C+iuHiZ2GMVEnYrTVNEz9owRzc=; b=eDgVVZKECcDSYBEc0fba5f9KN6LBB8CarLNFNgApQsrbaIhlMHFF+KpjF8nswruAoK4FBa wSKxvnk7nuCc2tJtQk1mHF8cMjwb/2HkBS+NdqwWbbgGFsdNkwalfRC6RmbpMvbnmK8kWG G+Ko3YGRzyqi6ZYxO15OmVrxTNl+z9agVzm9nhPai+OAuRVTNGHYCRzdYb0mk7J4qvWG76 eYfPU/zT7S/38E43ERBQwwj4hIpOCV/q1Yb7BwubNbmXmoWN5sSBs6aPMeY7Tln0nBG2zO EEjpt4bDtewDjF24GSUcO5WHxfxm8wG5kpMdB5EJEZRrIr88k8C97KNPmQN6+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676518489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NGbgfurNTbGyTmLE2C+iuHiZ2GMVEnYrTVNEz9owRzc=; b=MM3lxlQYgfg5QYE+XUrCrB5fy0/b8NgYzC/gfHxB1Lr/xqKorb6VJpqDsjGXl8NQFguqbb vbWoHnMVOcS1uDLzljsJOlN57E3FC4XXkaCG9rX2XTnq3X9GtaslFCmn17yx/3r/b7vHKY FY97ahmDroeaOxThVbaw0J2Vt+V41KkH1fM0KxN4tCC7jEKvIfOi3NUOLZXZoUk+GrSZdM VzI9OzxCAwDTklM7MQZoR0j2W6ujwicn5nL663mx4vZd1fLWyOV2NQ4hF+Kk5NaR4+pMAa 6fK/DE11NbhHTa1ITXJh6SSAgQHMiiyS7IbB1GjLJB+5X35/Uq+tyfbPlNnDAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676518489; a=rsa-sha256; cv=none; b=luKFU5NCj05q0tpjXOQbCbzBgfE+zvOpvM1sM93YBmV6I36cSb8jZNrjxqWgMVLQXxqyKS PwFThNHgIeow4F/2MuuHLUS3Y3gmiv3vVg4/d9VnYPotM+ftKUFfkty4cuHLxCOFYWrJhQ s5ymsMxKILvsMgfPw2NxPWbwPbxu6OR4q2+tUG9thoax8uZxuGXTojIROuY9i/8WDQcV69 9sBOmUTnnouZ72RB/XJbAILRWKqlsbvEGri8lKug2AA3p8z7rdfDVoXaTxpkMQ3o/V2p13 VOW3da81fRLikI1nfWKd25TfuRD2Z52Th50TBbEc+N36hRzAC2GAhK44Khtszg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PHLD94RH7zpWg; Thu, 16 Feb 2023 03:34:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31G3Ynuw042981; Thu, 16 Feb 2023 03:34:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31G3YnYn042980; Thu, 16 Feb 2023 03:34:49 GMT (envelope-from git) Date: Thu, 16 Feb 2023 03:34:49 GMT Message-Id: <202302160334.31G3YnYn042980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: dfdc3b2e6541 - stable/13 - patch: omit filename if the prompt was ignored List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dfdc3b2e6541c941b51edd5e5ec575411e5be143 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=dfdc3b2e6541c941b51edd5e5ec575411e5be143 commit dfdc3b2e6541c941b51edd5e5ec575411e5be143 Author: Kyle Evans AuthorDate: 2023-01-24 16:46:01 +0000 Commit: Kyle Evans CommitDate: 2023-02-16 03:29:40 +0000 patch: omit filename if the prompt was ignored When a file is missing, patch(1) will prompt for a filename to try and patch it. If we're doing a dry-run, we'll output that the patch to the source file was either ignored/failed. If you ignore the prompt in a dry-run (i.e. just hit enter), we'll output: X out of X hunks ignored while patching (null) Let's improve the aesthetics a bit and just omit the last part if the prompt was ignored: X out of X hunks ignored Unfortunately we can't really test this without expect(1) because both force and batch mode will use the first best guess, which is wiped out by the "File to patch:" prompt. We could record the initially derived bestguess there and use *that*, but given that this is only possible in an interactive session I think it's fine to just omit the filename rather than adding a fair amount of complexity (which could also break other scenarios I haven't considered yet).. Reviewed by: des Sponsored by: Klara, Inc. (cherry picked from commit 7e688ed493482c5346d969e7667856d8ced8d87a) --- usr.bin/patch/patch.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index a23fc82d3d90..48d3bd37fe5b 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -463,9 +463,13 @@ main(int argc, char *argv[]) if (!check_only) say("%d out of %d hunks %s--saving rejects to %s\n", failed, hunk, skip_rest_of_patch ? "ignored" : "failed", rejname); - else + else if (filearg[0] != NULL) say("%d out of %d hunks %s while patching %s\n", failed, hunk, skip_rest_of_patch ? "ignored" : "failed", filearg[0]); + else + /* File prompt ignored, just note # hunks. */ + say("%d out of %d hunks %s\n", + failed, hunk, skip_rest_of_patch ? "ignored" : "failed"); if (!check_only && move_file(TMPREJNAME, rejname) < 0) trejkeep = true; }