emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#36455: closed (Question on reading from socket(pai


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#36455: closed (Question on reading from socket(pair) instead from pipe)
Date: Thu, 04 Jul 2019 06:49:01 +0000

Your message dated Wed, 3 Jul 2019 23:47:50 -0700
with message-id <address@hidden>
and subject line Re: bug#36455: Question on reading from socket(pair) instead 
from pipe
has caused the debbugs.gnu.org bug report #36455,
regarding Question on reading from socket(pair) instead from pipe
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
36455: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36455
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Question on reading from socket(pair) instead from pipe Date: Mon, 1 Jul 2019 08:22:36 +0200 User-agent: Mutt/1.11.3 (2019-02-01)
Hi,

with grep 3.3 I see for a FIFO this

  echo XXX | strace grep -E XXX
  [...]
  fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0xc), ...}) = 0
  stat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(0x1, 0x3), ...}) = 0
  fstat(0, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
  lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
  read(0, "XXX\n", 98304)                 = 4
  fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0xc), ...}) = 0
  write(1, "XXX\n", 4XXX)                    = 4
  read(0, "", 98304)                      = 0
  close(1)                                = 0
  close(2)                                = 0
  exit_group(0)                           = ?
  +++ 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=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, 
child_tidptr=0x7fb632fb4a10) = 2020
  [...]
  [pid  2020] execve("/usr/bin/grep", ["grep", "-e XXX"], 0x7ffd31f42ea8 /* 128 
vars */ <unfinished ...>
  [...]
  [pid  2020] fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0xc), ...}) 
= 0
  [pid  2020] stat("/dev/null", {st_mode=S_IFCHR|0666, st_rdev=makedev(0x1, 
0x3), ...}) = 0
  [pid  2020] fstat(0, {st_mode=S_IFSOCK|0400, st_size=0, ...}) = 0
  [pid  2020] lseek(0, 0, SEEK_CUR)       = -1 ESPIPE (Illegal seek)
  [pid  2020] read(0, "XXX\n", 98304)     = 4
  [pid  2020] read(0, "", 98304)          = 0
  [pid  2020] close(1)                    = 0
  [pid  2020] close(2)                    = 0
  [pid  2020] exit_group(1)               = ?
  [pid  2020] +++ exited with 1 +++

IMHO reading data from a FIFO/pipe or from a FSOCK/socket(pair) should result
in the same result.  The mgrep is a simple test C code which uses libpipeline
to write "XXX\n" to a FILE stream used on the input fd of the sub process for
the grep command:

  FILE *xy;
  int fd = dup(1);
  pipeline *p = pipeline_new();
  pipeline_want_in(p, -1);
  pipeline_want_out(p, fd);
  pipecmd *grep = pipecmd_new("/usr/bin/grep");
  [... handle options and arguments ...]
  xy = 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

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

Attachment: signature.asc
Description: PGP signature


--- End Message ---
--- Begin Message --- Subject: Re: bug#36455: Question on reading from socket(pair) instead from pipe 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
Right, closing the bug report.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]