geodynamics / aspect

A parallel, extensible finite element code to simulate convection in both 2D and 3D models.
https://aspect.geodynamics.org/
Other
228 stars 237 forks source link

update_prm_files.sh doesn't work correctly on Mac #2347

Open anne-glerum opened 6 years ago

anne-glerum commented 6 years ago

The update_prm_files_to_2.0.0_model_settings.sed file does not update input files correctly (see fig for result) on macOS High Sierra 10.13.4.

screen shot 2018-06-20 at 14 27 37

anne-glerum commented 4 years ago

Just ran into an update script error again for the update_prm_files_to_2.0.0_model_settings script:

sed: 203: ./update_scripts/prm_files/update_prm_files_to_2.0.0_model_settings.sed: command i expects \ followed by text

Running on MacOS Mojave 10.14.5

tjhei commented 4 years ago

can you try to edit

  sed -i.tmp -f $script "$@"

to say

  sed -i .tmp -f $script "$@"

? (add a space before .tmp)

anne-glerum commented 4 years ago

I changed the line you mentioned in update_prm_files.sh, but get the same error. The error complains about the underlying file update_scripts/prm_files/update_prm_files_to_2.0.0_model_settings.sed.

tjhei commented 4 years ago

ah, got it. Can you please try to change

i # The parameters below this comment were created by the update script\

to

i\
# The parameters below this comment were created by the update script\

(i text is a GNU extension that doesn't work under osx): https://www.gnu.org/software/sed/manual/sed.html#Other-Commands

anne-glerum commented 4 years ago

mmm, there is no error any more, but there are too many ends inserted now, see the attached diff and snapshot. Screenshot 2020-04-14 at 17 43 15 diff_resume_free_surface.txt

Sorry that I don't really have time to investigate it myself, sed is also not my strong suite.

tjhei commented 4 years ago

Sorry that I don't really have time to investigate it myself, sed is also not my strong suite.

same here and I don't have access to my OSX machine right now.

@gassmoeller do you have a way to test this right now?

gassmoeller commented 4 years ago

Will take a look later today, but I do not have access to OSX as well. @anne-glerum: Do you need the updates in the update_to_2.0 script? Or could you just remove that script and keep the later ones for 2.1 that are written in perl? I also just noticed that we merged a few other changes that will not work with the 2.0 update anymore (though that is in the update script for source files, not input files).

gassmoeller commented 4 years ago

Sorry, took a bit longer. Have not found the error yet, but Anne can you try the following to install a GNU sed - the one provided on linux - on your Mac, and see if the scripts work afterwards? If you do not have homebrew maybe there are alternative ways to install gnu-sed on Mac. This would at least confirm that the difference is in the sed versions.

https://daoyuan.li/a-normal-sed-on-mac/

gassmoeller commented 4 years ago

Not sure this fixes it, but I found one more GNU extension that was used in the script (see #3458), can you give the version in the PR a try?

anne-glerum commented 4 years ago

Sorry, took a bit longer. Have not found the error yet, but Anne can you try the following to install a GNU sed - the one provided on linux - on your Mac, and see if the scripts work afterwards?

GNU sed produces a correctly updated file!

Not sure this fixes it, but I found one more GNU extension that was used in the script (see #3458), can you give the version in the PR a try?

I saw that Timo gave it a try, so I assume that's covered.

gassmoeller commented 4 years ago

I think I found a way to test this (GNU sed has the --posix option which disables all GNU extensions), but I would need a test .prm file (all files inside ASPECT are already converted). @anne-glerum can you send me a file to test?

anne-glerum commented 4 years ago

@anne-glerum can you send me a file to test?

Just in case you want to actually run the prm, I don't attach the ones I was actually trying to update, which have custom plugins. The same problem occurred for files that I got through: git show tags/v1.5.0:tests/adiabatic_conditions.prm > test_update_prm.txt test_update_prm.txt