From nobody Thu Mar 16 15:37:07 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 4Pcrwg3YnGz3yFdh; Thu, 16 Mar 2023 15:37:07 +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 4Pcrwg2sMqz3R1b; Thu, 16 Mar 2023 15:37:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678981027; 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=idgElQ7JZvip3V1EVYC0Z+6p6xN/XQ1xUAW7JLFLWlA=; b=hhymNmIoi2qdqWjjwMF2HwupEW9rtGxOVGTSe5xpF+Tn3YgF4RDLTfYbwj3rdzh6RKinWs 5TlEMFTffgUKOuOG8m4kV+c1BlIUf2ADYvN+FB++UEgBu6yFNfEEMk99WzP5ZHYfTNg5ml dfZFXP58dab7SJuoUaciAADbb0YrV4JRTDeEWWZ+Nc4BTRXqqrZ5BfBK0r+a8wPVfKJP6o +pPemaOT+x1maTptaLN2DodVfRRfoaDIPoI9hkehGvcP7pFb/Oi15F29bYrGj4pubOzGMF hATb10XlQwbHPyjfk2tvaBVnDXkSQAEqE4566c+J4pr2sZLvHGwlevGILWv3ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678981027; 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=idgElQ7JZvip3V1EVYC0Z+6p6xN/XQ1xUAW7JLFLWlA=; b=wJ4V64e3guKHzRBriD1VQmAGbuc0aiFn6TZtRV688Mlbx9xxBi8lvKD4Mo5cZXxCk6aloM 58oQ8slhaaYTEV7EPJzZKQs2YnS3T94y7n/SklQxLeh21Qku8YI7ZBR9bztVvxP5X3ywtz G+/VWV5CXQMOC0kZyUvTc9x/UK8xj1epKhKODmhcvgdSN/vTEH2LD0Rvq2KpBNQc+3F+xz ySU0kqMysKF7Q19jS9bCYx1cMO7YSIHxCKjWgPbPwcZwk5CObLjGEk50jsmkmw5hCsV6M3 WLtA1h/RmLBejH4ihne1bfYI217TpZKCwLTAjU8NKQ9Au60mVV2SToEmVYbxAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678981027; a=rsa-sha256; cv=none; b=HsKTxnZuUBr6QsWMeHc+1gYzjnYceUDjxQrXCKhWlRp/rLUeWHqfC++uNv4/3kt5cbJP2m Q7JP1KtJYncfFEITlAX1UBmZHgMolfqpjTXmAJ9JMMV0L/3Fn7H3qDnnPFCvl0hmQ/yS6m oFp4/Zn8MG3YI+PueOkAAa6EM8YZRDXTkk9e79DYZ02XATaKyzDVmm42JV5xEwtngihoe7 zg0qzFk+r2RGp9dbXdZKbeH6WxctDBqXTtVOK0B8uERXWLVhTVGZDpSYl3mEDjJj4c2Inu GIP7KlBV7G/YVTzUKZcRh/EUF/LopLECNF6Usq00qFUqFHXWtO6ej8qQ087+fA== 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 4Pcrwg1nsgzpTC; Thu, 16 Mar 2023 15:37:07 +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 32GFb7lF007277; Thu, 16 Mar 2023 15:37:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32GFb71e007276; Thu, 16 Mar 2023 15:37:07 GMT (envelope-from git) Date: Thu, 16 Mar 2023 15:37:07 GMT Message-Id: <202303161537.32GFb71e007276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: fa3af3ce5010 - main - tail: Verify correct behavior when input does not end in a newline. 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: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa3af3ce5010740f28faed22e0a1e819491f26b4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=fa3af3ce5010740f28faed22e0a1e819491f26b4 commit fa3af3ce5010740f28faed22e0a1e819491f26b4 Author: Dag-Erling Smørgrav AuthorDate: 2023-03-16 15:36:49 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-03-16 15:37:02 +0000 tail: Verify correct behavior when input does not end in a newline. Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D39116 --- usr.bin/tail/tests/tail_test.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/usr.bin/tail/tests/tail_test.sh b/usr.bin/tail/tests/tail_test.sh index e8263864f28c..36d6cdb68692 100755 --- a/usr.bin/tail/tests/tail_test.sh +++ b/usr.bin/tail/tests/tail_test.sh @@ -392,6 +392,19 @@ si_number_body() { atf_check cmp outfile expectfile } +atf_test_case no_lf_at_eof +no_lf_at_eof_head() +{ + atf_set "descr" "File does not end in newline" +} +no_lf_at_eof_body() +{ + printf "a\nb\nc" >infile + atf_check -o inline:"c" tail -1 infile + atf_check -o inline:"b\nc" tail -2 infile + atf_check -o inline:"a\nb\nc" tail -3 infile + atf_check -o inline:"a\nb\nc" tail -4 infile +} atf_init_test_cases() { @@ -416,4 +429,5 @@ atf_init_test_cases() atf_add_test_case silent_header atf_add_test_case verbose_header atf_add_test_case si_number + atf_add_test_case no_lf_at_eof }