From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 01 02:22:51 2019 Received: (at submit) by debbugs.gnu.org; 1 Jul 2019 06:22:51 +0000 Received: from localhost ([127.0.0.1]:47596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hhpiE-0000Sk-TM for submit@debbugs.gnu.org; Mon, 01 Jul 2019 02:22:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:43726) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hhpiD-0000Sd-AK for submit@debbugs.gnu.org; Mon, 01 Jul 2019 02:22:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42554) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhpiC-0006oY-2A for bug-grep@gnu.org; Mon, 01 Jul 2019 02:22:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_MED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhpi9-0002oU-U9 for bug-grep@gnu.org; Mon, 01 Jul 2019 02:22:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:47144 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hhpi7-0002jz-PZ for bug-grep@gnu.org; Mon, 01 Jul 2019 02:22:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 239C9ADF2 for ; Mon, 1 Jul 2019 06:22:40 +0000 (UTC) Date: Mon, 1 Jul 2019 08:22:36 +0200 From: "Dr. Werner Fink" To: bug-grep@gnu.org Subject: Question on reading from socket(pair) instead from pipe Message-ID: <20190701062236.GA7923@boole.suse.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2oS5YaxWCcQjTEyO" Content-Disposition: inline X-GPG-Fingerprint: 1B06 BF5A 3829 90FB CBA2 75BE 50E9 0D55 1DC1 6B2E User-Agent: Mutt/1.11.3 (2019-02-01) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit 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: -2.3 (--) --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, with grep 3.3 I see for a FIFO this echo XXX | strace grep -E XXX [...] fstat(1, {st_mode=3DS_IFCHR|0620, st_rdev=3Dmakedev(0x88, 0xc), ...}) =3D= 0 stat("/dev/null", {st_mode=3DS_IFCHR|0666, st_rdev=3Dmakedev(0x1, 0x3), .= =2E.}) =3D 0 fstat(0, {st_mode=3DS_IFIFO|0600, st_size=3D0, ...}) =3D 0 lseek(0, 0, SEEK_CUR) =3D -1 ESPIPE (Illegal seek) read(0, "XXX\n", 98304) =3D 4 fstat(1, {st_mode=3DS_IFCHR|0620, st_rdev=3Dmakedev(0x88, 0xc), ...}) =3D= 0 write(1, "XXX\n", 4XXX) =3D 4 read(0, "", 98304) =3D 0 close(1) =3D 0 close(2) =3D 0 exit_group(0) =3D ? +++ exited with 0 +++ prefect but with libpipeline configured to use much faster socketpairs I see this: strace -f ./mgrep -e XXX clone(strace: Process 2020 attached child_stack=3DNULL, flags=3DCLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCH= LD, child_tidptr=3D0x7fb632fb4a10) =3D 2020 [...] [pid 2020] execve("/usr/bin/grep", ["grep", "-e XXX"], 0x7ffd31f42ea8 /*= 128 vars */ [...] [pid 2020] fstat(1, {st_mode=3DS_IFCHR|0620, st_rdev=3Dmakedev(0x88, 0xc= ), ...}) =3D 0 [pid 2020] stat("/dev/null", {st_mode=3DS_IFCHR|0666, st_rdev=3Dmakedev(= 0x1, 0x3), ...}) =3D 0 [pid 2020] fstat(0, {st_mode=3DS_IFSOCK|0400, st_size=3D0, ...}) =3D 0 [pid 2020] lseek(0, 0, SEEK_CUR) =3D -1 ESPIPE (Illegal seek) [pid 2020] read(0, "XXX\n", 98304) =3D 4 [pid 2020] read(0, "", 98304) =3D 0 [pid 2020] close(1) =3D 0 [pid 2020] close(2) =3D 0 [pid 2020] exit_group(1) =3D ? [pid 2020] +++ exited with 1 +++ IMHO reading data from a FIFO/pipe or from a FSOCK/socket(pair) should resu= lt in the same result. The mgrep is a simple test C code which uses libpipeli= ne to write "XXX\n" to a FILE stream used on the input fd of the sub process f= or the grep command: FILE *xy; int fd =3D dup(1); pipeline *p =3D pipeline_new(); pipeline_want_in(p, -1); pipeline_want_out(p, fd); pipecmd *grep =3D pipecmd_new("/usr/bin/grep"); [... handle options and arguments ...] xy =3D pipeline_get_infile (p); fprintf(xy, "XXX\n"); fflush(xy); fclose(xy); Nevertheless in both cases stdout for grep is 136/12 aka /dev/pts/12 Werner --=20 "Having a smoking section in a restaurant is like having a peeing section in a swimming pool." -- Edward Burr --2oS5YaxWCcQjTEyO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJgBAABCABKFiEEGwa/WjgpkPvLonW+UOkNVR3Bay4FAl0ZppksFIAAAAAAFQAO cGthLWFkZHJlc3NAZ251cGcub3Jnd2VybmVyQHN1c2UuZGUACgkQUOkNVR3Bay7m uhAAuDFkxlRrTDWnpzoWVrlghfG/3VF0yfJcp17oaKnLUpRPL40lxq8+KfxjR1Td imDunIWgvZMNgrxZ+kuzKwWKh9Vys4ONAjIsleZsl6Lj0H+yItAzMGtEk1/xnlGw 1ewpNxgHSgDliAbdTjaJNvXDqnOGM2yE36dYzRkVopdlSEK2V89RV2Bn/n6Fq9ha Y/6llAwzRm/xM4VroUwOJ6psBJmr+XEDd9WmPuNFoVd6/a14O/M0lufwcRd9VUtq BjLGMFwk9ekxhrNiP6yJh04vjwB11G7ikfEZrb4g2+4nycIu+95JxOOR8a+86D6A saHBjcPhr/9PTL1w50WlQ/txqA+T6ea42U4MlZZskKghIYFlUA2j8W0K/lKwtAU5 w6cMeIOfhxv+JWahPSxZtOhGOXhzFJmExHf9UoTK5aMg5qyAqH/1zo0BnrtThdFi gbjunvQ2Tyw+3vmtZrqQDU9El0k3MHCPmhFWUerlJak5Hbggp2j4FK8vAoE8tgzZ //5BlNoGiQmcgC8MCt2Y2yrHBrM/5WH9zKamFsOhpjlNZdoqNFdld1DM2GBMjpTI 6bHvajoYmfWnEq7MxaiacIsUFIWkftKzBDgWe3z/KACoNMr9Z/c5k5q/aZu61RcP TIQKdRZ3p82CrEHBUFxtDgtLmcP8Pd0trLAMJlJ5aUeCEYE= =pRvq -----END PGP SIGNATURE----- --2oS5YaxWCcQjTEyO-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 01 04:17:51 2019 Received: (at 36455) by debbugs.gnu.org; 1 Jul 2019 08:17:51 +0000 Received: from localhost ([127.0.0.1]:47645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hhrVX-00034z-EA for submit@debbugs.gnu.org; Mon, 01 Jul 2019 04:17:51 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hhrVV-00034l-Gy for 36455@debbugs.gnu.org; Mon, 01 Jul 2019 04:17:50 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2FD41161DC3; Mon, 1 Jul 2019 01:17:42 -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 uKpjcu5wTmmf; Mon, 1 Jul 2019 01:17:41 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 88630161DC4; Mon, 1 Jul 2019 01:17:41 -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 N61C54Ojx0FR; Mon, 1 Jul 2019 01:17:41 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 6587C161DC3; Mon, 1 Jul 2019 01:17:41 -0700 (PDT) Subject: Re: bug#36455: Question on reading from socket(pair) instead from pipe To: "Dr. Werner Fink" , 36455@debbugs.gnu.org References: <20190701062236.GA7923@boole.suse.de> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <9cd363ab-5836-1a91-7894-236197394b8f@cs.ucla.edu> Date: Mon, 1 Jul 2019 01:17:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <20190701062236.GA7923@boole.suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36455 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: -3.3 (---) Dr. Werner Fink wrote: > IMHO reading data from a FIFO/pipe or from a FSOCK/socket(pair) should result > in the same result. Yes it should, but only if you invoke 'grep' with the same arguments both times, which I expect you didn't. Look at the two execve lines in the strace output. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 01 04:49:07 2019 Received: (at 36455) by debbugs.gnu.org; 1 Jul 2019 08:49:07 +0000 Received: from localhost ([127.0.0.1]:47667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hhrzn-0003w6-EY for submit@debbugs.gnu.org; Mon, 01 Jul 2019 04:49:07 -0400 Received: from mx2.suse.de ([195.135.220.15]:45466 helo=mx1.suse.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hhrzk-0003va-Bk for 36455@debbugs.gnu.org; Mon, 01 Jul 2019 04:49:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AD38AAD23; Mon, 1 Jul 2019 08:48:58 +0000 (UTC) Date: Mon, 1 Jul 2019 10:48:42 +0200 From: "Dr. Werner Fink" To: Paul Eggert Subject: Re: bug#36455: Question on reading from socket(pair) instead from pipe Message-ID: <20190701084842.GA15716@boole.suse.de> References: <20190701062236.GA7923@boole.suse.de> <9cd363ab-5836-1a91-7894-236197394b8f@cs.ucla.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline In-Reply-To: <9cd363ab-5836-1a91-7894-236197394b8f@cs.ucla.edu> X-GPG-Fingerprint: 1B06 BF5A 3829 90FB CBA2 75BE 50E9 0D55 1DC1 6B2E User-Agent: Mutt/1.11.3 (2019-02-01) X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36455 Cc: 36455@debbugs.gnu.org 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: -3.3 (---) --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019/07/01 01:17:41 -0700, Paul Eggert wrote: > Dr. Werner Fink wrote: > > IMHO reading data from a FIFO/pipe or from a FSOCK/socket(pair) should = result > > in the same result. >=20 > Yes it should, but only if you invoke 'grep' with the same arguments both > times, which I expect you didn't. Look at the two execve lines in the str= ace > output. Ah ... I see, indeed ... mea culpa Looks like pipecmd_argf() does not work the way I expected, whereas adding pipecmd_arg(grep, "-e"); pipecmd_arg(grep, "XXX"); does the job. --=20 "Having a smoking section in a restaurant is like having a peeing section in a swimming pool." -- Edward Burr --a8Wt8u1KmwUX3Y2C Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJgBAABCABKFiEEGwa/WjgpkPvLonW+UOkNVR3Bay4FAl0ZyOYsFIAAAAAAFQAO cGthLWFkZHJlc3NAZ251cGcub3Jnd2VybmVyQHN1c2UuZGUACgkQUOkNVR3Bay5A 2BAA2XltjzTk9/mLJwu1L1i0qtOjVI2krG8ESaTx477q21jB6z7LFYwqceaPHKAu rqTepIExU69MLuA2nvki7SM1YD5k1r53da7PtbZ+hUT+axA9Oibs5JldVwcuMdAR Yx7GKb94GlWZLBIp3vPfOQbrq7SjXmZDxwvWuKfgrPxxWev3pBJ43aKSMIxQo1RX Dfa7muWR7fUkwHJVjieS/5eVv3Cj9BMpQVb0w4gHLcW4XPwZvUBe5IwRfj5zhb5F +BBK1IAy5B7MZ7ogLLpBmVK6YkrGj6RYJiPTBunjERYFHUXqQtynPO/X1MVwpQbj UuemJ1tbKU6b++yvH8J36xNdPlCKgIPyzOyCtvpR8V9Da7lRVpmud9RiBF7D2JZO 6jUJhet7o/HiwqjES9elHGJ8Aeb7TSghJPu+W12FrlUh8q9uHxDAXCA72iHzac27 h4bUVzOi1ipHhBp4MxKImzigQcygBktFrlrfTP9tP+dJxe6f9/4so3RUHG+kYNyh yIdgAunvQ1rmZGCpTczh8LWvH4tLMc5CcQI7eXbKE/p8PfdAK78/46lQeXPae2A6 RFDWz5w1IzcZs7dg+KOe0bpdi+pT8WjWCC+L9m/KTl0j4KfJ8GWvn76OtpD1TaFv vnQqv7o5XTnBDRLc5K1WLhsn0ZYXQxiCc8+TBSykr0adoNY= =C/0L -----END PGP SIGNATURE----- --a8Wt8u1KmwUX3Y2C-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 04 02:48:01 2019 Received: (at 36455-done) by debbugs.gnu.org; 4 Jul 2019 06:48:02 +0000 Received: from localhost ([127.0.0.1]:50265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hivXF-0000Ed-HH for submit@debbugs.gnu.org; Thu, 04 Jul 2019 02:48:01 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:49054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hivXD-0000EC-Ep for 36455-done@debbugs.gnu.org; Thu, 04 Jul 2019 02:48:00 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CC55E1626A4; Wed, 3 Jul 2019 23:47:51 -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 Ix8GY3LppGAP; Wed, 3 Jul 2019 23:47:51 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2ECFC1626A5; Wed, 3 Jul 2019 23:47:51 -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 r0PR3ln86wAf; Wed, 3 Jul 2019 23:47:51 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 0FBDA1626A3; Wed, 3 Jul 2019 23:47:51 -0700 (PDT) Subject: Re: bug#36455: Question on reading from socket(pair) instead from pipe To: "Dr. Werner Fink" References: <20190701062236.GA7923@boole.suse.de> <9cd363ab-5836-1a91-7894-236197394b8f@cs.ucla.edu> <20190701084842.GA15716@boole.suse.de> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Wed, 3 Jul 2019 23:47:50 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190701084842.GA15716@boole.suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 36455-done Cc: 36455-done@debbugs.gnu.org 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: -3.3 (---) Right, closing the bug report. From unknown Tue Jun 24 05:14:39 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 01 Aug 2019 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