From nobody Fri May 19 08:10:29 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 4QMzzn4x4Zz4BdfX; Fri, 19 May 2023 08:10:29 +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 4QMzzn4Lsrz4CM3; Fri, 19 May 2023 08:10:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684483829; 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=waGlwCeJ1IVYQZBNfznQvbgX95V1/Uz5m3sQr9FgWVc=; b=KKWkwQusd2Y09GFJYfXO/Ba3/ylr/0k9MFsT43znlwtCGDuQ0vO0m1bkenDpb7LIDl6cpN vshGlWKvhAZYoaHPDisAlDt2jhEouDHLlu0pPKTQThzKRYS47MVxEPtDrtfTEpIV2P80qA aRt5ZKrNf5RXQFB4zgZfD2+AxYumhLE/0hKMon6bwjefNdQbkJjZssAZkv0IJpD8uFomlY BrMCYz40xpxZscf/M019at8pNaN5TUzQ/ByTxW7rDpgmcy9sskfuoONuZt4DTE62a1z0db A8FnipHMbbSmgBGSawLJumsWO+drtcF7wZrH4c4s27ek6vXrllpyRHsp52OX+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684483829; 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=waGlwCeJ1IVYQZBNfznQvbgX95V1/Uz5m3sQr9FgWVc=; b=GUIP83lXYsZR05GzRDYGbeScFHOZ5zx4oi8LwleelLmmQ9krybS4aVJ4iiJpD48JNPEcTm MRyf64NbQ/UIPVfJ9jYgAJ3BMQ7/0nMO5qODwNHiD+ABUcIpWtdn4v9pAhGQIr9acLJqvV 2hUkjuXf/lVA1EynFtVPNx27eOEdYyNByAlZTcvYBKk5URhbB7yfQ4JBBU3yFPQB3KBlk3 IZ7anSzVJysG12ikeANzdOUgfBF7OHaKD6ftN4AaYz1ioJcO3Iu4f8o71iZ/Mlr4iAVgPK uoo855/SfoUv71yFzsa9gD2RiBnE4czfSHWtuwavog1piMJzQysAAaXGY6Jv3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684483829; a=rsa-sha256; cv=none; b=EBvxZirDJKq3GvAjDEu7nfC/eRf4JMubnfagfn1xH7cWGDvibhjjaDoE4grMWI/aXczo9k I65yKNDGxjnbyJkiRk3V4zlTEOvdBDtSWUuGUFkQUKuanVqIt96MZJfLzUE37HR7hJIt1L qpDW73uLb+rEqr0geMlgadKTShvft94h8RQ3RjkWIAt5S95c7lawlVtLvEimfJxsqgTl2p 6f4OCLh79l7DX3LerZKVpnmgsQmLYd4EXj3VeTVRY21B7a6R304wsLaehunOXRE9CDLghP YLMjBzbdry/FZ+fcKbeNRzzQpUkVNKt1a4r8Y+LKXCz+eqyvjYkDJYgBzNRLTg== 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 4QMzzn3Ml9zL4q; Fri, 19 May 2023 08:10:29 +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 34J8ATQZ009853; Fri, 19 May 2023 08:10:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34J8ATtX009852; Fri, 19 May 2023 08:10:29 GMT (envelope-from git) Date: Fri, 19 May 2023 08:10:29 GMT Message-Id: <202305190810.34J8ATtX009852@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 0edfc2a92c80 - stable/13 - sh(1): fix history file write checking 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: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0edfc2a92c80650c2b9ea8d8572752d0a1e6e8eb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=0edfc2a92c80650c2b9ea8d8572752d0a1e6e8eb commit 0edfc2a92c80650c2b9ea8d8572752d0a1e6e8eb Author: Daniel Kolesa AuthorDate: 2023-03-20 16:42:59 +0000 Commit: Baptiste Daroussin CommitDate: 2023-05-19 08:07:37 +0000 sh(1): fix history file write checking We cannot just compare histsizeval() against 0, since that returns a string pointer, which is always non-zero (non-null). The logic in sethistsize() initializes the history size to 100 with values that are non-number, and an empty string counts as that. Therefore, the only time we want to not write into history with HISTSIZE val set is when it's explicitly 0. MFC after: 2 weeks (cherry picked from commit 3ce64010f8ce3accc64eff312f31dc0d3c0fc9d1) --- bin/sh/histedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index b9af20e6e9ab..dc4bff469d3f 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -90,7 +90,7 @@ get_histfile(void) const char *histfile; /* don't try to save if the history size is 0 */ - if (hist == NULL || histsizeval() == 0) + if (hist == NULL || !strcmp(histsizeval(), "0")) return (NULL); histfile = expandstr("${HISTFILE-${HOME-}/.sh_history}");