IRIX Network Forums
patching sh with mksh - Printable Version

+- IRIX Network Forums (//forums.irixnet.org)
+-- Forum: SGI/MIPS (//forums.irixnet.org/forum-3.html)
+--- Forum: Development/Porting (//forums.irixnet.org/forum-9.html)
+--- Thread: patching sh with mksh (/thread-1742.html)



patching sh with mksh - 23jodys - 12-24-2019

I have been fiddling with building mksh as a patch to 6.5.22 so that I can fully replace. I am building from scratch using MIPSpro and GNUmake and using gendist to build a real patch which will fully replace the existing sh. An issue I am running into is that several of the init scripts expect to use ksh and some weird test options.

Specifically, in 
Code:
/dev/MAKEDEV
the shell is set to ksh (which in the patch is actually mksh). However, we have

Code:
@if [ -d rmt -a -l rmt ];

which as far as test commands go, is pretty non-standard. I can symlink /sbin/test to mksh, but it will not fully execute this expression. In old ksh terms -l checks if file exists and is a symlink. mksh and other newer shells do -L. 

Option 1) scrub the init scripts and other random shell scripts to deal with this. Downside: a lot of patches.
Option 2) patch mksh during build to leave in a compatibility mode. Downside: got to patch mksh.

 My work in progress is https://github.com/23jodys/irix-patches/tree/master/mksh_package


RE: patching sh with mksh - Raion - 12-24-2019

Hi Jody,

Some of the KSH operations I saw didn't really require any updates on the version of mksh I used, but I also tried pdksh, and a few others and they work fine as well. As far as the basic OS goes, you lose nothing by upgrading to mksh. Only an old version of pre-adobe framemaker failed to run on my system.

Additionally, upgrading tcsh to the latest tcsh works too.

Patching the initscripts should be easy, especially if you were to redeploy it in the tardist format IRIX uses.


RE: patching sh with mksh - Raion - 01-30-2020

Update:

I created a set of scripts looking for errors along with carefully checking the syslog.

It looks like /dev/MAKEDEV, which isn't invoked normally, and /etc/init.d/mail are the **only** instances where a -l is used for sh, and it's only 8 instances in the former case, and 1 in the latter, on line 174. That is peanuts to patch, you could use a vim substitution pattern to get the desired effect.

I don't use Github for personal reasons, but I'll be happy to help if there's any other concerns or issues you find. I have been running /bin/sh as /bin/mksh for a while and it's not a problem. I imagine bash or zsh would work too; if you're so inclined.