From owner-svn-src-all@freebsd.org Thu Aug 6 18:17:20 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B59B3A8277; Thu, 6 Aug 2020 18:17:20 +0000 (UTC) (envelope-from kevans@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BMxXw2jWdz4R68; Thu, 6 Aug 2020 18:17:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C112AE64; Thu, 6 Aug 2020 18:17:20 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 076IHK4T021726; Thu, 6 Aug 2020 18:17:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076IHKe8021725; Thu, 6 Aug 2020 18:17:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008061817.076IHKe8021725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 6 Aug 2020 18:17:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363974 - stable/12/usr.bin/diff/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/usr.bin/diff/tests X-SVN-Commit-Revision: 363974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 18:17:20 -0000 Author: kevans Date: Thu Aug 6 18:17:19 2020 New Revision: 363974 URL: https://svnweb.freebsd.org/changeset/base/363974 Log: MFC r363692: diff: fix side_by_side It's currently unclear to me how this could have worked previously; \n here is not a literal newline but actual '\' 'n', and was getting passed to the underlying regex engine as such. regex(3) does not translate this to a newline, and this became an error because we don't really allow escaping of arbitrary ordinary characters anymore. Run the pattern strings through printf to make sure we're dealing with real newlines before passing them through to atf_check, which ultimately feeds them directly to regcomp(3). This fix is different than that will be needed for sed, in that this is the proper way to inject newlines into search strings as long as regex(3) won't combine \ + n as folks might expect. Modified: stable/12/usr.bin/diff/tests/diff_test.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/diff/tests/diff_test.sh ============================================================================== --- stable/12/usr.bin/diff/tests/diff_test.sh Thu Aug 6 18:13:45 2020 (r363973) +++ stable/12/usr.bin/diff/tests/diff_test.sh Thu Aug 6 18:17:19 2020 (r363974) @@ -106,8 +106,8 @@ side_by_side_body() atf_check -o save:A printf "A\nB\nC\n" atf_check -o save:B printf "D\nB\nE\n" - exp_output="A[[:space:]]+|[[:space:]]+D\nB[[:space:]]+B\nC[[:space:]]+|[[:space:]]+E" - exp_output_suppressed="A[[:space:]]+|[[:space:]]+D\nC[[:space:]]+|[[:space:]]+E" + exp_output=$(printf "A[[:space:]]+|[[:space:]]+D\nB[[:space:]]+B\nC[[:space:]]+|[[:space:]]+E") + exp_output_suppressed=$(printf "A[[:space:]]+|[[:space:]]+D\nC[[:space:]]+|[[:space:]]+E") atf_check -o match:"$exp_output" -s exit:1 \ diff --side-by-side A B