MESAHub/mesa

testing adipls fails because of a warning in GNU grep >= 3.8

Closed this issue · 3 comments

Describe the issue

During the installation process, the get-input function of adipls, which calls egrep, is used to generate output for a test case. Versions of GNU grep >= 3.8 alias egrep to grep -E and print a warning when it is invoked:

/o/mesa ❯❯❯ which egrep                                                                                                                                                                                                                                                  
/usr/bin/egrep
/o/mesa ❯❯❯ egrep
egrep: warning: egrep is obsolescent; using grep -E
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.

This warning causes the test to fail even when the contents of obs.txt and obs.test.txt are identical. Specifically, when adipls.c.d is called when the test is run, the warning is produced. Since the test script is run in build_and_test as ./ck >& diff.txt, this warning is included in diff.txt even when the files do not differ.

System information

  • MESA version: any
  • MESA SDK version: any
  • Operating system: archlinux (current latest)

Output from ./help
Run ./help from your MESA directory ($MESA_DIR) and include the output here.

MESA Version
r21.12.1

uname -a
Linux framework 5.19.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 15 Sep 2022 16:08:26 +0000 x86_64 GNU/Linux

gfortran -v
Using built-in specs.
COLLECT_GCC=/opt/mesasdk/bin/gfortran.exec
COLLECT_LTO_WRAPPER=/opt/mesasdk/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/user/sdk2-tmp/build/gcc/configure CC= CXX= --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --prefix=/home/user/sdk2-tmp/mesasdk --with-gmp=/home/user/sdk2-tmp/mesasdk --with-mpfr=/home/user/sdk2-tmp/mesasdk --with-mpc=/home/user/sdk2-tmp/mesasdk --enable-languages=c,c++,fortran --disable-multilib --disable-nls --disable-libsanitizer --enable-clocale=generic
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.1.0 (GCC) 

$MESASDK_ROOT
/opt/mesasdk

MESASDK version
x86_64-linux-22.6.1

$PATH
/opt/mesa/adipls/test/../adipack.c/bin:/opt/mesasdk/bin:/home/joel/.bin:/home/joel/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

$MESA_DIR
/opt/mesa

I presume the solution here is to replace egrep with grep -E in adipls/adipack.c/bin/get-input. I'm just trying to find out how long grep has supported the -E option. People were asking about it on unix.SE in 2012, so it's probably a safe change. The closest thing I can find to a changelog on the official site is a commit history, which I haven't searched definitively to see when -E was added.

Could you at least try making the suggested change, if you haven't already, just to check that the build will then succeed and tests pass? You're welcome to open a PR, otherwise I'll fix this later after checking the build is okay.

Does anyone know of anything to beware of on Macs?

fxt44 commented

a check on my intel and m1 macs suggests there is not an issue.

I presume the solution here is to replace egrep with grep -E in adipls/adipack.c/bin/get-input.

That does work for me.

Related aside: amusingly, I've found this rather ranty blog post complaining about precisely this issue, so I imagine we're not the only people running into it. As far as I can tell, -E was added before 2007, because according to the grep 3.8 release announcement the GNU team has considered egrep and fgrep deprecated since 2007. Clearly some habits die hard.

I guess another follow-up question to ask here is: is it reasonable to pipe stderr to diff.txt? I imagine that there are other moving parts than egrep specifically which, too, might one day declare themselves obsolete.