Linux grep command getting stuck in infinite loop while doing recurring search

0

When trying to search for a pattern in files of current and subfolders, the grep command is stuck in an infinite loop.

The following illustrates the problem:

/results/log/check_log:    if ($f1 eq 'dump') {
/results/work/log/check_log:    if ($f1 eq 'dump') {
/results/work/work/log/check_log:    if ($f1 eq 'dump') {
/results/work/work/work/log/check_log:    if ($f1 eq 'dump') {
/results/work/work/work/work/log/check_log:    if ($f1 eq 'dump') {
/results/work/work/work/work/work/log/check_log:    if ($f1 eq 'dump') {
/results/work/work/work/work/work/work/log/check_log:    if ($f1 eq 'dump') {
/results/work/work/work/work/work/work/work/log/check_log:    if ($f1 eq 'dump') {

Update: Adding the command used for reference.

sh -c 'grep --exclude=\*.{lst,txt} -srF dump *'

I am not quite sure what is causing this issue. I had searched in SOF and other forums, but this kind of infinite loop issue couldn't be found.

Any help in identifying the cause is much appreciated.

learningloop

Posted 2018-10-10T09:04:53.433

Reputation: 103

Possible loop in the file system (link somewhere to some parent directory). But where is grep involved? What is the exact command you used? – xenoid – 2018-10-10T09:15:55.867

1ls -ld /results/work, please? – user1686 – 2018-10-10T10:13:06.923

As if /results/work pointed to /results somehow. Investigate this. In my Debian grep -r doesn't follow symlinks, grep -R does; your grep may vary (neither option is POSIX). What filesystem is this? Is it healthy? – Kamil Maciorowski – 2018-10-10T10:14:07.913

No answers