From unknown Fri Sep 05 09:29:44 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#24276 <24276@debbugs.gnu.org> To: bug#24276 <24276@debbugs.gnu.org> Subject: Status: head without pipline is not reading complete STDIN, resulting in unwilling and unexpected command execution Reply-To: bug#24276 <24276@debbugs.gnu.org> Date: Fri, 05 Sep 2025 16:29:44 +0000 retitle 24276 head without pipline is not reading complete STDIN, resulting= in unwilling and unexpected command execution reassign 24276 coreutils submitter 24276 Sebastian severity 24276 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 20 18:39:46 2016 Received: (at submit) by debbugs.gnu.org; 20 Aug 2016 22:39:46 +0000 Received: from localhost ([127.0.0.1]:35397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbEvZ-0002Pt-NL for submit@debbugs.gnu.org; Sat, 20 Aug 2016 18:39:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60227) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbDRY-00007s-Qs for submit@debbugs.gnu.org; Sat, 20 Aug 2016 17:04:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbDRS-0007S8-B9 for submit@debbugs.gnu.org; Sat, 20 Aug 2016 17:04:35 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbDRS-0007Ru-85 for submit@debbugs.gnu.org; Sat, 20 Aug 2016 17:04:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbDRQ-0004X9-0o for bug-coreutils@gnu.org; Sat, 20 Aug 2016 17:04:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bbDRK-0007QF-Jy for bug-coreutils@gnu.org; Sat, 20 Aug 2016 17:04:30 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::5]:13587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bbDRK-0007Py-9v for bug-coreutils@gnu.org; Sat, 20 Aug 2016 17:04:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1471727064; l=1079; s=domk; d=ifyouwantblood.de; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Date:Subject: From:To; bh=AU9fc0Dh5pKwJu9xF7eMlSSqtry8eCNA/j7fUyIBdro=; b=FwVmk6kYQRBRPS3yedVHB5J/OcDvOrxmHf2Jouu8+9w9FFGqwx3OVXgmcyaluBfrO+L t1CnxVfWMoClM28EHqhpsq9t7wJaVv7bAKiAGkdcu0TFE7Fs0qT4KkxmjtBqHsmVN5qX5 67GO3ss+pLRDfj49COv/hdsJLJXAmH9MmDM= X-RZG-AUTH: :P2kGdFO8cv4hv8ZwAC/8Qn4d40sYbVWMD9No5Xm0MnHzXURymfcQ+3OHtYOE0RkO2D1DLsttCw== X-RZG-CLASS-ID: mo00 Received: from [192.168.66.104] (ip5f5a954f.dynamic.kabel-deutschland.de [95.90.149.79]) by smtp.strato.de (RZmta 38.13 DYNA|AUTH) with ESMTPSA id v09a43s7KL18jEc (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate) for ; Sat, 20 Aug 2016 23:01:08 +0200 (CEST) To: bug-coreutils@gnu.org From: Sebastian Subject: head without pipline is not reading complete STDIN, resulting in unwilling and unexpected command execution Message-ID: Date: Sat, 20 Aug 2016 23:01:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 20 Aug 2016 18:39:44 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) hi, while comparing my rewrite in google go of coreutils i noticed that head without pipeline is not reading complete STDIN: > head -c 2 enter: > asdf press return this results in printing "as" and execution of the df command. thats highly unexpected and probably a good example for a variant of WYSINWYC (What you see is not what you copy)*. someone might even come up with a not harmful looking code, that is harmful (heredoc?). > head --version > head (GNU coreutils) 8.25 > bash --version > GNU bash, version 4.3.46(1)-release (x86_64-suse-linux-gnu) > uname -o > GNU/Linux > printfile /etc/os-release > NAME=openSUSE > VERSION="Tumbleweed" > VERSION_ID="20160811" > PRETTY_NAME="openSUSE Tumbleweed (20160811) (x86_64)" > ID=opensuse > ANSI_COLOR="0;32" > CPE_NAME="cpe:/o:opensuse:opensuse:20160811" > BUG_REPORT_URL="https://bugs.opensuse.org" > HOME_URL="https://www.opensuse.org/" * http://www.ush.it/team/ascii/hack-tricks_253C_CCC2008/wysinwyc/what_you_see_is_not_what_you_copy.txt -- Sebastian Kratz @ProhtMeyhet From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 20 20:12:46 2016 Received: (at 24276-done) by debbugs.gnu.org; 21 Aug 2016 00:12:46 +0000 Received: from localhost ([127.0.0.1]:35411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbGNa-0004ZW-Dn for submit@debbugs.gnu.org; Sat, 20 Aug 2016 20:12:46 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:45836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bbGNY-0004ZI-L0 for 24276-done@debbugs.gnu.org; Sat, 20 Aug 2016 20:12:45 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C5239161225; Sat, 20 Aug 2016 17:12:37 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id w1Y8TBV1AhOi; Sat, 20 Aug 2016 17:12:36 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D0803161227; Sat, 20 Aug 2016 17:12:36 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id hOYD5NvMFwRi; Sat, 20 Aug 2016 17:12:36 -0700 (PDT) Received: from [192.168.1.9] (unknown [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id AD537161225; Sat, 20 Aug 2016 17:12:36 -0700 (PDT) Subject: Re: bug#24276: head without pipline is not reading complete STDIN, resulting in unwilling and unexpected command execution To: Sebastian , 24276-done@debbugs.gnu.org References: From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <8d3296cd-6e2c-2e03-1a87-01b2c8e27f65@cs.ucla.edu> Date: Sat, 20 Aug 2016 17:12:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 24276-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) This is not a bug. It's quite OK for 'head' to read just as much input as= is=20 required, and to not bother to read the rest of input. In fact, POSIX req= uires=20 this behavior if standard input is a seekable file. See: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap01.html and look for "seekable input". From unknown Fri Sep 05 09:29:44 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 18 Sep 2016 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator