Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Nov 2002 10:46:43 +0100
From:      Joan Picanyol i Puig <lists-freebsd-questions@biaix.org>
To:        freebsd-questions@freebsd.org
Subject:   trouble with perl writing to pipes :(
Message-ID:  <20021108094643.GA3590@grummit.biaix.org>

next in thread | raw e-mail | index | archive | help

--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi, 

I'm noticing some weird behaviour having perl writing to pipes (they eat
my output):

grummit:~/tmp/runwhen/dirs/root/runwhen/cvsup$ cat shownextrun
#!/usr/bin/perl -w
print('sleeping; next run at: ',
      scalar(localtime(time()+$ENV{'DELAY'})), "\n");
      exec({ $ARGV[0] } @ARGV);

grummit:~/tmp/runwhen/dirs/root/runwhen/cvsup$ DELAY=1 ./shownextrun true
sleeping; next run at: Fri Nov  8 10:44:21 2002

grummit:~/tmp/runwhen/dirs/root/runwhen/cvsup$ DELAY=1 ./shownextrun true | cat
grummit:~/tmp/runwhen/dirs/root/runwhen/cvsup$

Attached is the diff of the two ktrace outputs, one sending the output
through the pipe, one without doing so. As showed above, running with the
pipe eats my output. The diff was obtained by ripping the pid by "kdump
-f ktrace.out.nopipe | cut -d ' ' -f 4- > ktrace.out.nopipe.nopid". The
original dump's are available (as text) at http://biaix.org/pk/debug/

tks
-- 
pica

--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ktrace.diff"

*** ktrace.out.pipe.nopid	Fri Nov  8 10:22:18 2002
--- ktrace.out.nopipe.nopid	Fri Nov  8 10:22:01 2002
***************
*** 1356,1366 ****
  perl     CALL  break(0x8058000)
  perl     RET   break 0
  perl     CALL  break(0x8059000)
  perl     RET   break 0
  perl     CALL  getpid
! perl     RET   getpid 3416/0xd58
  perl     CALL  break(0x805a000)
  perl     RET   break 0
  perl     CALL  fstat(0x3,0xbfbfd29c)
  perl     RET   fstat 0
  perl     CALL  break(0x805c000)
--- 1356,1366 ----
  perl     CALL  break(0x8058000)
  perl     RET   break 0
  perl     CALL  break(0x8059000)
  perl     RET   break 0
  perl     CALL  getpid
! perl     RET   getpid 3410/0xd52
  perl     CALL  break(0x805a000)
  perl     RET   break 0
  perl     CALL  fstat(0x3,0xbfbfd29c)
  perl     RET   fstat 0
  perl     CALL  break(0x805c000)
***************
*** 1418,1429 ****
  perl     RET   read 624/0x270
  perl     CALL  close(0x3)
  perl     RET   close 0
  perl     CALL  fstat(0x1,0xbfbff83c)
  perl     RET   fstat 0
! perl     CALL  break(0x8061000)
! perl     RET   break 0
  perl     CALL  execve(0xbfbff5cc,0x8050080,0xbfbffb64)
  perl     NAMI  "/command/true"
  perl     RET   execve -1 errno 2 No such file or directory
  perl     CALL  execve(0xbfbff5cc,0x8050080,0xbfbffb64)
  perl     NAMI  "/bin/true"
--- 1418,1434 ----
  perl     RET   read 624/0x270
  perl     CALL  close(0x3)
  perl     RET   close 0
  perl     CALL  fstat(0x1,0xbfbff83c)
  perl     RET   fstat 0
! perl     CALL  ioctl(0x1,TIOCGETA,0xbfbff870)
! perl     RET   ioctl 0
! perl     CALL  write(0x1,0x8059000,0x30)
! perl     GIO   fd 1 wrote 48 bytes
!     "sleeping; next run at: Fri Nov  8 10:16:29 2002
!     "
! perl     RET   write 48/0x30
  perl     CALL  execve(0xbfbff5cc,0x8050080,0xbfbffb64)
  perl     NAMI  "/command/true"
  perl     RET   execve -1 errno 2 No such file or directory
  perl     CALL  execve(0xbfbff5cc,0x8050080,0xbfbffb64)
  perl     NAMI  "/bin/true"

--azLHFNyN32YCQGCU--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021108094643.GA3590>