Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Egrep is obsolescent for some linux distributions. #3484

Closed
Luxxii opened this issue Dec 9, 2022 · 1 comment · Fixed by #3485
Closed

Egrep is obsolescent for some linux distributions. #3484

Luxxii opened this issue Dec 9, 2022 · 1 comment · Fixed by #3485

Comments

@Luxxii
Copy link

Luxxii commented Dec 9, 2022

Bug report

Executing workflows and capturing the output (which is captured in .command.log) causes the warning:

egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
egrep: warning: egrep is obsolescent; using grep -E
...
...

generated by the command egrep to be spammed into the captured log.

Expected behavior and actual behavior

egrep is not spammed in .command.log and one can actually investigate the actual output.

Steps to reproduce the problem

Occurs in any recent Linux-Distribution, where the comannd egrep prints the following each time it is called:

egrep: warning: egrep is obsolescent; using grep -E

This can be e.g. reproduced with the current Arch-Linux-distribution.

Environment

  • Nextflow version: 22.04.5 (build 5708)
  • Java version: openjdk version "17.0.5" 2022-10-18
  • Operating system: Linux (6.0.10-arch2-1)
  • Bash version: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)

Additional context

Hi all,

this is an issue i observed 1 or 2 months ago. This should be something very easy to fix. In new Linux-distributions a warning is printed if someone uses the egrep-command. This is probably caused by this line.

Instead of using:

return ['/bin/bash','-c', "set -o pipefail; $cmd | { egrep '(Job Id:|job_state =)' || true; }".toString()]

we should use:

return ['/bin/bash','-c', "set -o pipefail; $cmd | { grep -E '(Job Id:|job_state =)' || true; }".toString()]

The command egrep is historical and most probably only existent, so that older programs which rely on it can run without any modification. Since we only capture the output with it and egrep itself uses grep -E i assume that it is safe to change this.

@Luxxii
Copy link
Author

Luxxii commented Dec 9, 2022

Other places i also found egrep:

$grep -rnw "." -e "egrep"
./tests/checks/dynamic-storedir.nf/.checks:36:[[ `grep 'INFO' .nextflow.log | egrep -c '\[skipping\] Stored process > foo'` == 4 ]] || false
./tests/checks/dynamic-storedir.nf/.checks:61:[[ `grep 'INFO' .nextflow.log | egrep -c '\[skipping\] Stored process > foo'` == 4 ]] || false
./tests/checks/error.nf/.checks:11:[[ `grep 'NOTE' .nextflow.log | egrep -c "Process .* terminated with an error exit status"` == 3 ]] || false
./tests/checks/error.nf/.checks:23:[[ `grep 'NOTE' .nextflow.log | egrep -c "Process .* terminated with an error exit status"` == 3 ]] || false
./docs/tracing.rst:141:  Make sure the following tools are available in the environment where tasks are executed: ``awk``, ``date``, ``grep``, ``egrep``, ``ps``, ``sed``, ``tail``, ``tee``.
./docs/sync-doc.sh:3:if egrep "^release = '.*edge|.*SNAPSHOT'$" -c conf.py >/dev/null; then
./modules/nextflow/src/test/groovy/nextflow/executor/OarExecutorTest.groovy:273:        executor.queueStatusCommand(null) == ['sh','-c', "oarstat -f | egrep '(Job_Id:|state =)' ".toString()]
./modules/nextflow/src/test/groovy/nextflow/executor/OarExecutorTest.groovy:274:        executor.queueStatusCommand('xxx') == ['sh','-c', "oarstat -f xxx | egrep '(Job_Id:|state =)' ".toString()]
./modules/nextflow/src/test/groovy/nextflow/executor/test-bash-wrapper-with-trace.txt:18:        local STATUS=$(2> /dev/null < /proc/$1/status egrep 'Vm|ctxt')
./modules/nextflow/src/test/groovy/nextflow/executor/test-bash-wrapper-with-trace.txt:23:        local x_peak=$(echo "$STATUS" | egrep 'VmPeak|VmHWM' | sed 's/^.*:\s*//' | sed 's/[\sa-zA-Z]*$//' | tr '\n' ' ' || echo -n '0 0')
./modules/nextflow/src/test/groovy/nextflow/executor/PbsExecutorTest.groovy:283:        executor.queueStatusCommand(null) == ['bash','-c', "set -o pipefail; qstat -f -1 | { egrep '(Job Id:|job_state =)' || true; }"]
./modules/nextflow/src/test/groovy/nextflow/executor/PbsExecutorTest.groovy:284:        executor.queueStatusCommand('xxx') == ['bash','-c', "set -o pipefail; qstat -f -1 xxx | { egrep '(Job Id:|job_state =)' || true; }"]
./modules/nextflow/src/test/groovy/nextflow/executor/PbsProExecutorTest.groovy:156:             executor.queueStatusCommand(null) == ['bash','-c', "set -o pipefail; qstat -f \$( qstat -B | egrep -v '(^Server|^---)' | awk -v ORS=' ' '{print \"@\"\$1}' ) | { egrep '(Job Id:|job_state =)' || true; }"]
./modules/nextflow/src/test/groovy/nextflow/executor/PbsProExecutorTest.groovy:157:        executor.queueStatusCommand('xxx') == ['bash','-c', "set -o pipefail; qstat -f xxx | { egrep '(Job Id:|job_state =)' || true; }"]
./modules/nextflow/src/test/groovy/nextflow/container/UdockerBuilderTest.groovy:111:            ((udocker.py images | egrep -o "^ubuntu:latest\\s") || udocker.py pull "ubuntu:latest")>/dev/null
./modules/nextflow/src/test/groovy/nextflow/container/UdockerBuilderTest.groovy:128:            ((udocker.py images | egrep -o "^ubuntu:latest\\s") || udocker.py pull "ubuntu:latest")>/dev/null
./modules/nextflow/src/test/groovy/nextflow/container/UdockerBuilderTest.groovy:143:            ((udocker.py images | egrep -o "^ubuntu:latest\\s") || udocker.py pull "ubuntu:latest")>/dev/null
./modules/nextflow/src/main/groovy/nextflow/executor/PbsProExecutor.groovy:91:            cmd += '$( qstat -B | egrep -v \'(^Server|^---)\' | awk -v ORS=\' \' \'{print \"@\"\$1}\' )'
./modules/nextflow/src/main/groovy/nextflow/executor/PbsProExecutor.groovy:93:        return ['bash','-c', "set -o pipefail; $cmd | { egrep '(Job Id:|job_state =)' || true; }".toString()]
./modules/nextflow/src/main/groovy/nextflow/executor/PbsExecutor.groovy:130:        return ['bash','-c', "set -o pipefail; $cmd | { egrep '(Job Id:|job_state =)' || true; }".toString()]
./modules/nextflow/src/main/groovy/nextflow/executor/OarExecutor.groovy:135:        return ['sh','-c', "$cmd | egrep '(Job_Id:|state =)' ".toString()]
./modules/nextflow/src/main/groovy/nextflow/container/UdockerBuilder.groovy:99:        def result = "((udocker.py images | egrep -o \"^$image\\s\") || udocker.py pull \"$image\")>/dev/null\n"
./modules/nextflow/src/main/resources/nextflow/executor/command-trace.txt:27:        local STATUS=$(2> /dev/null < /proc/$1/status egrep 'Vm|ctxt')
./modules/nextflow/src/main/resources/nextflow/executor/command-trace.txt:32:        local x_peak=$(echo "$STATUS" | egrep 'VmPeak|VmHWM' | sed 's/^.*:\s*//' | sed 's/[\sa-zA-Z]*$//' | tr '\n' ' ' || echo -n '0 0')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant