From nobody Mon Mar 20 16:57:09 2023 X-Original-To: dev-commits-src-main@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 4PgLW92TL8z3yyKL; Mon, 20 Mar 2023 16:57:09 +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 4PgLW9221gz4JMW; Mon, 20 Mar 2023 16:57:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679331429; 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=d4VeVkAmGCYMyaaCZI5USENnJXB7a1LU/95dhPL8S3g=; b=dweH0Mmdqh8ZplpYdWir6CC2zhmpdNkGFhP8a6WwJOMHduRA0tkiMOPV/DUE7BdBCnuXP/ ZdggP+eK2eCtbsja5Lmk/nT4RMcNkXJeTVSr9rV8sf0RYY1xpg0KekG2Rg2SYBpHvGeiKg LTmAMr4tTk6fR1zfsh1eweEBIdxEBoghXDA8yYOqfZxc+YxVN8wwGcXNoj2JIFrRzSH6HT IzWnAH1AUibeibT0d6+hLHlJG+VykLuOACfAdWiUPHi1Wk/kxW0Z9cWmrZVWqv58EoiDgk yAHK+6NOYOSnfpPp5deEnzv3dzm1j2GInXobDCPI1KDmApcA1O8rdDD/kJXpKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679331429; 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=d4VeVkAmGCYMyaaCZI5USENnJXB7a1LU/95dhPL8S3g=; b=n4aDloTz65dVJXFGEGytWDP4nikoOI9Qe7Yk1R3gXUMbQEY3Tj/I/kVFV6vLSgjX0zdjQi yRPkdVKpQho/+zWWO1yKYMzCFVllWgyXsJfxraHcJUUc+U8V85KLJbf57rv/4ub7VD3uvA IltLiRO7rr7ct3n7m5xtB15JkXCcdNw1Ohn6uMva8euQkx0TZuBzOVNhdXaARqvP2w/5vE a2iUJO5lQ1qJbNVAXkBeOs1mpxNYE5vquzyNGgWcoCc0C8RYXFbhlJYm7xnghOjpphX0bv 3ULdi2KTbni0NZ+VgJFAfPGaip2v0NejFO8WOriEH79L5k37N9SY+m4nVlAR2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679331429; a=rsa-sha256; cv=none; b=HZr0gGAcU6R22lvMKvrRKOxY3bFAqbG9PhIeEYyhoD0YlAEYOGifXcoZhRwz/XLJcqRHzg EgwYMV5qQqAWqedJqCM97nT6LveXkbXQXEQH10obEZvcVJiAV6PT8uYsbzWWa4FE0wBoLh lrLKxbdojbb596fo5n6waqNqwi/igyzRuwc7mRMhbR3yKCeYn4I3YTR0/KR5bw/9FdhzgE g0uT6Li2wzzjTmh0OR5XQJvDkZ6dZpAM2T4JaZfl1/UXvEpSJoNvZhrrQK+uXMBAXgnNIb o7Yj2U0N0QMFgpyUmAVbTR1Ht2j5WwdaGkRN6+UWd7/xg9S878KdFi24TQdNbA== 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 4PgLW915JLzdWj; Mon, 20 Mar 2023 16:57:09 +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 32KGv9Dr003733; Mon, 20 Mar 2023 16:57:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KGv9Bu003732; Mon, 20 Mar 2023 16:57:09 GMT (envelope-from git) Date: Mon, 20 Mar 2023 16:57:09 GMT Message-Id: <202303201657.32KGv9Bu003732@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 3ce64010f8ce - main - sh(1): fix history file write checking List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 3ce64010f8ce3accc64eff312f31dc0d3c0fc9d1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=3ce64010f8ce3accc64eff312f31dc0d3c0fc9d1 commit 3ce64010f8ce3accc64eff312f31dc0d3c0fc9d1 Author: Daniel Kolesa AuthorDate: 2023-03-20 16:42:59 +0000 Commit: Baptiste Daroussin CommitDate: 2023-03-20 16:56:56 +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 --- 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 0eb8c6c1784f..db3b8bcfc1da 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}");