From owner-svn-src-head@freebsd.org Sat Sep 2 01:26:03 2017 Return-Path: Delivered-To: svn-src-head@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 B3323E148B1; Sat, 2 Sep 2017 01:26:03 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C4496C6D2; Sat, 2 Sep 2017 01:26:03 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x242.google.com with SMTP id 63so1060621pgc.1; Fri, 01 Sep 2017 18:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ajG8meDZhfb3kdKY+lZLebXhwoxekojrAng2bhndjjE=; b=F3rTeIvEcfpLTM5yWwtlmsynIWuPbIm8okxR1e+9ifbm97CPWNPisI+aES3iNwcl2R 3bA2nGF8+QRrwKsOOujwR/1mjOcVapsDWPs7VmwpRiExmEE4tpEDFWnrsBYT5OvmEU0p Kan7R8+5HP/bskjg5g1VD3QwqitchkEWgTcZp7aszIlNuM2MYSUphRZFt6zl0KOUHrmG 9FJY7l21U0E1H+IjyUsyBv1UmB9SHHskjOFVwpLQOKhjUcbwMX3j25Xm+5mrChQA+pGn G4NLlQTlQsOc+1aFrEFMoaxUNTjjePkwt9qvqHZdTutj28lXuU5DP0jbfGkwNP2FitAG 5K4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ajG8meDZhfb3kdKY+lZLebXhwoxekojrAng2bhndjjE=; b=P5kDIPzhSzcG5hJnulD9FZcBIQt56epOwPAEI8g34IXulS5zDuw8TE61KCyTA6o7F3 UERm1+No+roLFBO+Xd5qmN7aEviRgnf/Z9XcXoWTRFkTZeKVIAxtuW3mquD0xn68DS0p ecAjf8emumfQTHougsMEbXbIffQviCEMisNYMGreW3yDo7oEFE032Iy4M053dutxgk39 QUcjjVHO0a+BdAkeYInHpsQZnhv3NOMDI5PJigZvsVu3mxHtpqwEpzQyTOSlk974EKC5 p7KU15rI3C2t5gN70XUi3FdwvwLDy5zVni+s4xoR9GVklA2mPAIL6IW61pKbNh0vTmHg MGlQ== X-Gm-Message-State: AHPjjUhIMDTWKLZa+VQwfH7BHEk+NcJUQGkGKt9OKVDVJkbgmUTZpjr6 AkRQN+KbBqo+9LOGzhM= X-Google-Smtp-Source: ADKCNb5AqzFsOILALEFBc3rcmP03tJY66D1XHhCAUE0rfhY5Xt07GTHsrEUcNBuRjZ5nvxyV41r0lw== X-Received: by 10.84.224.142 with SMTP id s14mr4695738plj.323.1504315562736; Fri, 01 Sep 2017 18:26:02 -0700 (PDT) Received: from ?IPv6:2607:fb90:834f:1d8b:74eb:367e:d781:1430? ([2607:fb90:834f:1d8b:74eb:367e:d781:1430]) by smtp.gmail.com with ESMTPSA id c11sm2132957pfl.17.2017.09.01.18.26.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Sep 2017 18:26:01 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r323123 - in head/usr.bin/tail: . tests From: Ngie Cooper X-Mailer: iPhone Mail (14G60) In-Reply-To: <201709012237.v81Mbnp3049853@repo.freebsd.org> Date: Fri, 1 Sep 2017 18:26:00 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201709012237.v81Mbnp3049853@repo.freebsd.org> To: Conrad Meyer X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Sep 2017 01:26:03 -0000 > On Sep 1, 2017, at 15:37, Conrad Meyer wrote: >=20 > Author: cem > Date: Fri Sep 1 22:37:49 2017 > New Revision: 323123 > URL: https://svnweb.freebsd.org/changeset/base/323123 >=20 > Log: > tail(1): Do not print bogus errno string >=20 > In the case where write(2) does not return -1, it does not initialize err= no. > This can happen when a broken pipe causes a short write. >=20 > I attempted to adapt the submitted test case to ATF but could not figure o= ut > how to make the test run in the ATF environment. So the aborted test is > left disabled, in case someone would like to run it manually or fix it. >=20 > PR: 221976 > Submitted by: (earlier version) > Sponsored by: Dell EMC Isilon >=20 > Modified: > head/usr.bin/tail/extern.h > head/usr.bin/tail/tests/tail_test.sh >=20 > Modified: head/usr.bin/tail/extern.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/usr.bin/tail/extern.h Fri Sep 1 22:04:45 2017 (r323122) > +++ head/usr.bin/tail/extern.h Fri Sep 1 22:37:49 2017 (r323123) > @@ -32,9 +32,15 @@ > */ >=20 > #define WR(p, size) do { \ > - if (write(STDOUT_FILENO, p, size) !=3D (ssize_t)size) \ > - oerr(); \ > - } while(0) > + ssize_t res; \ > + res =3D write(STDOUT_FILENO, p, size); \ > + if (res !=3D (ssize_t)size) { \ > + if (res =3D=3D -1) \ > + oerr(); \ > + else \ > + errx(1, "stdout"); \ > + } \ > +} while (0) >=20 > #define TAILMAPLEN (4<<20) >=20 >=20 > Modified: head/usr.bin/tail/tests/tail_test.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/usr.bin/tail/tests/tail_test.sh Fri Sep 1 22:04:45 2017 (r= 323122) > +++ head/usr.bin/tail/tests/tail_test.sh Fri Sep 1 22:37:49 2017 (r= 323123) > @@ -215,7 +215,20 @@ longfile_rn2500_body() > atf_check cmp expectfile outpipe > } >=20 > +atf_test_case broken_pipe > +broken_pipe_head() > +{ > + atf_set "descr" "Do not print bogus errno based output on short write= s" > +} > +broken_pipe_body() > +{ > + atf_expect_fail "Can't seem to get testcase to work in test environme= nt. Reproduces easily in interactive shell." >=20 > + seq -f '%128g' 1 1000 > ints > + atf_check -s exit:1 -o ignore -e "inline:tail: stdout" tail -n 856 in= ts | awk '{ exit }' Use need to use -x to run the command through the shell, e.g. atf_check ... -x 'tail 856 ints| awk "{exit}"' What the original pattern does is pipes atf_check to awk--which probably isn= 't what you want. Seems like it could be written to not use a temporary file too.. I'll have t= o think about this. -Ngie=