[Bug 1294678] [NEW] grep waits forever for piped input

Matthew Paul Thomas mpt at canonical.com
Wed Mar 19 14:29:44 UTC 2014


Public bug reported:

Problem occurs with: bash 4.3-2ubuntu1, Ubuntu Trusty
Does not occur with: bash 4.2-5ubuntu3, Ubuntu 13.10

At a bash prompt, this command works instantly:
    touch ~/test && grep thunder ~/test

But this equivalent command has failed to exit after ten minutes:
    touch ~/test && cat ~/test | grep thunder

The problem is not with cat or with grep. For example, this command works instantly:
    ps aux > ~/test && grep thunder ~/test

But this equivalent command has failed to exit after ten minutes:
    ps aux | grep thunder

This command also fails to exit:
    ls -l /proc/*/fd/* | grep 9579047

The common factor here is the pipe.

All the commands above *do* exit when run in a terminal in an Ubuntu
guest session.

They also exit when run under strace from the beginning:
    http://paste.ubuntu.com/7119748/

When strace is attached to a process that is not exiting, it is stuck on a read:
    Process 26532 attached
    read(0, 

<cjwatson> you'd get this if the shell failed to close its ends of the
pipe it's constructed

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: bash 4.3-2ubuntu1
ProcVersionSignature: Ubuntu 3.13.0-16.36-generic 3.13.5
Uname: Linux 3.13.0-16-generic i686
NonfreeKernelModules: wl
ApportVersion: 2.13.3-0ubuntu1
Architecture: i386
CurrentDesktop: Unity
Date: Wed Mar 19 14:09:53 2014
InstallationDate: Installed on 2011-02-24 (1118 days ago)
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
SourcePackage: bash
UpgradeStatus: Upgraded to trusty on 2014-03-10 (9 days ago)

** Affects: bash (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386 trusty

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash in Ubuntu.
https://bugs.launchpad.net/bugs/1294678

Title:
  grep waits forever for piped input

Status in “bash” package in Ubuntu:
  New

Bug description:
  Problem occurs with: bash 4.3-2ubuntu1, Ubuntu Trusty
  Does not occur with: bash 4.2-5ubuntu3, Ubuntu 13.10

  At a bash prompt, this command works instantly:
      touch ~/test && grep thunder ~/test

  But this equivalent command has failed to exit after ten minutes:
      touch ~/test && cat ~/test | grep thunder

  The problem is not with cat or with grep. For example, this command works instantly:
      ps aux > ~/test && grep thunder ~/test

  But this equivalent command has failed to exit after ten minutes:
      ps aux | grep thunder

  This command also fails to exit:
      ls -l /proc/*/fd/* | grep 9579047

  The common factor here is the pipe.

  All the commands above *do* exit when run in a terminal in an Ubuntu
  guest session.

  They also exit when run under strace from the beginning:
      http://paste.ubuntu.com/7119748/

  When strace is attached to a process that is not exiting, it is stuck on a read:
      Process 26532 attached
      read(0, 

  <cjwatson> you'd get this if the shell failed to close its ends of the
  pipe it's constructed

  ProblemType: Bug
  DistroRelease: Ubuntu 14.04
  Package: bash 4.3-2ubuntu1
  ProcVersionSignature: Ubuntu 3.13.0-16.36-generic 3.13.5
  Uname: Linux 3.13.0-16-generic i686
  NonfreeKernelModules: wl
  ApportVersion: 2.13.3-0ubuntu1
  Architecture: i386
  CurrentDesktop: Unity
  Date: Wed Mar 19 14:09:53 2014
  InstallationDate: Installed on 2011-02-24 (1118 days ago)
  InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
  SourcePackage: bash
  UpgradeStatus: Upgraded to trusty on 2014-03-10 (9 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1294678/+subscriptions



More information about the foundations-bugs mailing list