This is an old revision of the document!


Important Grep Notice

Grep Overview

Grep is used extensively by dCore to crawl through extensions, dependency lists and large database files to import and update SCEs. GNU Grep provides faster performance than the built-in BusyBox version. The recommendation is to ensure GNU Grep is installed and utilized.

Grep Utilization

To confirm that GNU Grep is imported and utilized run which grep:

tc@box:/mnt/sda1/tce$ which grep
/bin/grep

If the output is /bb/grep the slower BusyBox version is being used. If the output is /bin/grep the faster GNU Grep is likely being used although it may symlink to /bb/grep, so further confirmation is required. Run sudo find / -name “grep”, the results will confirm /bin/grep is loaded and which SCE(s) it comes from, in this case xorg-intel.sce:

tc@box:~$ sudo find / -name "grep"
/bin/grep
/bb/grep
/tmp/tcloop/xorg-intel/bin/grep

Can also run ls -l /bin | grep grep:

tc@box:/mnt/sda1/tce$ ls -l /bin | grep grep
lrwxrwxrwx 1 root root       6 Jun  5 16:45 bzegrep -> bzgrep
lrwxrwxrwx 1 root root       6 Jun  5 16:45 bzfgrep -> bzgrep
lrwxrwxrwx 1 root root      27 Jun  5 16:45 bzgrep -> /tmp/tcloop/lxde/bin/bzgrep
lrwxrwxrwx 1 root root      29 Jun  5 16:45 egrep -> /tmp/tcloop/xorg-nv/bin/egrep
lrwxrwxrwx 1 root root      29 Jun  5 16:45 fgrep -> /tmp/tcloop/xorg-nv/bin/fgrep
lrwxrwxrwx 1 root root      28 Jun  5 16:45 grep -> /tmp/tcloop/xorg-nv/bin/grep
lrwxrwxrwx 1 root root      27 Jun  5 16:45 zegrep -> /tmp/tcloop/lxde/bin/zegrep
lrwxrwxrwx 1 root root      27 Jun  5 16:45 zfgrep -> /tmp/tcloop/lxde/bin/zfgrep
lrwxrwxrwx 1 root root      26 Jun  5 16:45 zgrep -> /tmp/tcloop/lxde/bin/zgrep

In this example grep is symlinked ('l' in lrwxrwxrwx) with /tmp/tcloop/xorg-nv/bin/grep (not /bb/grep):

lrwxrwxrwx 1 root root      28 Jun  5 16:45 grep -> /tmp/tcloop/xorg-nv/bin/grep

Last run echo $PATH to confirm the /bin pathway is prioritized before /bb:

tc@box:/mnt/sda1/tce$ echo $PATH
/home/tc/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/bb:/etc/sysconfig/tcedir/ondemand

Import GNU Grep

Some SCEs include GNU Grep, though it is best to confirm using the steps outlined above. For example, xorg-* SCEs appear to include GNU Grep but the Xvesa SCE does not. Users running Xvesa graphics or no graphics may, therefore, not be utilizing the faster Grep. If the SCE that provides this faster Grep is always listed in sceboot.lst then there is no need for a separate import, otherwise import the 'grep' package from the Debian or Ubuntu repositories to load at boot:

sce-import -b grep

GNU Grep Performance

To confirm whether this Grep hassle is worthwhile, an 11 MB mupdf.sce (PDF reader) update check was completed as a case study. This is a moderately sized extension not imported with advanced techniques, such as a dependency import. On slow hardware /bb/grep took 1min:27sec to complete an update check versus 0min:37sec using /bin/grep.

> Return to the dCore Wiki Welcome page

Print/export
QR Code
QR Code dcore:important_grep_notice (generated for current page)