Package: grep
Version: 2.20-3
Severity: important
Tags: patch

The 'egrep' script enters into a infinite loop when I try to start
it. The problem is most likely a consequence of how I have configured
bash so the problem is not as such universal, but it highlights some
(in my view) rather significant issues with the 'egrep' command.

The command is implemented as a script that wants to call the "grep"
command and two rather strange choices was made when writing this
script.

First of all the first line looks like the following:

    #!/bin/bash

and secondly, the "grep" command is invoked thus:

   PATH=$dir:$PATH
   grep=grep

This seems like a suboptimal way to implement such a basic tool. Why
is this a bash script and why is the command invoked without an
absolute path?

In my case, I have a somewhat intricate .bashrc setup in order to
handle the numerous different environments I am working and one way or
another, I have managed to do something that means that calling
'egrep' cause it to recursively call itself and thus lead to an
infinite loop, either due to some environment mismatch or some alias
that are sneaked in somewhere. In either case, it is quite obvious
that the script is not very robust against a number of user
configurations.

In my case, applying the following patch solved the problem. Changing
the grep invokation to using an absolute path presumably would have
worked just as well.

/Christian

--- egrep       2014-09-19 09:57:30.080890633 +0200
+++ /bin/egrep  2014-09-18 23:04:16.278121780 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 grep=grep
 case $0 in
   */*)


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 3.16-1-486
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages grep depends on:
ii  dpkg          1.17.13
ii  install-info  5.2.0.dfsg.1-4
ii  libc6         2.19-11
ii  libpcre3      1:8.35-3

grep recommends no packages.

grep suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to