From owner-svn-src-stable-10@freebsd.org Sat Jul 1 13:03:04 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 424ACD8904D; Sat, 1 Jul 2017 13:03:04 +0000 (UTC) (envelope-from jilles@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 mx1.freebsd.org (Postfix) with ESMTPS id 1078284D48; Sat, 1 Jul 2017 13:03:03 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v61D33ca013853; Sat, 1 Jul 2017 13:03:03 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v61D33bg013851; Sat, 1 Jul 2017 13:03:03 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201707011303.v61D33bg013851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 1 Jul 2017 13:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r320532 - in stable/10/usr.bin/compress: . tests X-SVN-Group: stable-10 X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: in stable/10/usr.bin/compress: . tests X-SVN-Commit-Revision: 320532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jul 2017 13:03:04 -0000 Author: jilles Date: Sat Jul 1 13:03:02 2017 New Revision: 320532 URL: https://svnweb.freebsd.org/changeset/base/320532 Log: MFC r318592: compress: Allow uncompress -c with multiple pathnames, as required by POSIX. Per POSIX, allow passing multiple pathnames to uncompress -c, concatenating the uncompressed data. Passing multiple pathnames to compress -c remains disallowed, since the result cannot be decompressed. PR: 219387 Modified: stable/10/usr.bin/compress/compress.c stable/10/usr.bin/compress/tests/compress_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/compress/compress.c ============================================================================== --- stable/10/usr.bin/compress/compress.c Sat Jul 1 12:57:00 2017 (r320531) +++ stable/10/usr.bin/compress/compress.c Sat Jul 1 13:03:02 2017 (r320532) @@ -128,7 +128,7 @@ main(int argc, char *argv[]) exit (eval); } - if (cat == 1 && argc > 1) + if (cat == 1 && style == COMPRESS && argc > 1) errx(1, "the -c option permits only a single file argument"); for (; *argv; ++argv) Modified: stable/10/usr.bin/compress/tests/compress_test.sh ============================================================================== --- stable/10/usr.bin/compress/tests/compress_test.sh Sat Jul 1 12:57:00 2017 (r320531) +++ stable/10/usr.bin/compress/tests/compress_test.sh Sat Jul 1 13:03:02 2017 (r320532) @@ -161,6 +161,27 @@ compress_uncompress_file_2_body() atf_check cmp file2 expectfile2 } +atf_test_case compress_uncompress_file_minusc_1 +compress_uncompress_file_minusc_1_head() +{ + atf_set "descr" \ + "Test compressing and uncompressing some data, passing two filenames to uncompress -c" +} +compress_uncompress_file_minusc_1_body() +{ + printf '%01000d\n' 7 8 >expectfile1 + printf '%01000d\n' 8 7 >expectfile2 + cp expectfile1 file1 + cp expectfile2 file2 + atf_check compress file1 file2 + atf_check -s exit:1 cmp -s file1.Z expectfile1 + atf_check -s exit:1 cmp -s file2.Z expectfile2 + atf_check -s exit:1 cmp -s file1.Z file2.Z + atf_check -x 'uncompress -c file1.Z file2.Z >all' + atf_check -x 'cat expectfile1 expectfile2 >expectall' + atf_check cmp all expectall +} + atf_init_test_cases() { atf_add_test_case uncompress_file_1 @@ -171,4 +192,5 @@ atf_init_test_cases() atf_add_test_case compress_uncompress_minusc_1 atf_add_test_case compress_uncompress_file_1 atf_add_test_case compress_uncompress_file_2 + atf_add_test_case compress_uncompress_file_minusc_1 }