Hi,

I'm trying OpenIFS on a mac (10.12.6 : Sierra).  I've found a couple of problems with the oifs_run script.

The first problem is the use of 'ulimit':


#  Make sure process stack limit is increased
ulimit -s unlimited

this doesn't work as macOS doesn't support setting 'ulimited' stack.  I worked around this by changing the line to:

ulimit -s unlimited || true

(or could comment it out).

The second problem was a bit more curious. I get errors from the 'sed' command to replace the values of NPROC in the namelist file:

sed: -i may not be used with stdin

Despite reordering the arguments to sed, this error persisted. The script use of sed looks completely correct to me and I could not reproduce this problem on my linux machine. It's seems specific to mac and maybe my macOS version. However, the workaround is to explicitly put a space after the '-i' argument using an escape character '\':

sed  -e "s/NPROC=[^,]*,/NPROC=${OIFS_NPROC},/" \
     -e "s/NPRNT_STATS=[^,]*,/NPRNT_STATS=${OIFS_NPROC},/" \
     -i\   fort.4

which now works as expected.

Cheers, Ryan.



2 Comments

  1. Unknown User (nagc)

    Hi Ryan,

    Thanks for that. I was aware of the issue with ulimit and have already made the same correction.

    The problem with 'sed -i' is because macOS is based on FreeBSD, so the version of sed behaves differently to the GNU sed on linux.  An answer is here: 
    https://stackoverflow.com/questions/35620009/sed-extra-characters-at-end-of-l-command
    but in short, the -i flag in FreeBSD (macOS) requires an argument after it whereas GNU sed doesn't. The filename after -i flag is interpreted as the suffix to apply to the 'original' file. Although using a space character via '\ ' will work, it will generate a file with a trailing space, which is not ideal. Probably better to use '-i .orig' instead.

    Cheers,  Glenn

  2. Unknown User (gdcarver113@outlook.com)

    Thanks, I've changed the command to 'sed -i .old' which works fine. Maybe make this the default in oifs_run?