Menu

#1494 Darwin inital environment should be bash instead of ksh

5.0.0
closed
Erich
None
code+test
1
2017-11-26
2017-10-16
Erich
No

The initial Darwin address() environment seems to be ksh.
It should be bash instead

Related

Bugs: #1439
Feature Requests: #703

Discussion

  • Bruce

    Bruce - 2017-10-16

    I disagree. The default shell on the system is /bin/sh. In the MacOS I'm using that does get you bash. I believe that it is a UNIX/Linux thing that unless otherwise specified the default shell is /bin/sh which is guaranteed to give you a Bourne compatible shell.

     
    • Erich

      Erich - 2017-10-16

      ooRexx currently defines (hardcoded, not by inspecting e. g. $SHELL) the
      following "initial environment" for Unix systems:
      ksh on AIX
      sh on SUN
      bash on Linux

      Due to a bug (and the fact that Darwin doesn't fit well into above
      "categories") Darwin currently gets ksh as the initial environment.

      rexxref says: "The environments selected depend on the caller. Normally the
      default environment is the used shell, mostly "CMD" on Windows systems and
      "bash" on Linux systems." It doesn't seem to say anything about non-Linux
      systems.

      Wikipedia says, that in 2003 Darwin changed to "Bash instead of tcsh as
      default shell".

      On a Linux Ubuntu system with default shell bash, there's definitely a
      difference between running sh and bash.

      I don't have access to any Darwin system - I'm open for suggestions

       
  • Bruce

    Bruce - 2017-10-17

    So I've done a little more reading. POSIX defines as the default system shell, a strict subset of Korn Shell. I'm guessing that this is the subset that most closely aligns with the original Bourne Shell. This is why ksh has different functionality if it is invoked as /bin/sh or /bin/ksh.

    Ubuntu has two default system shells. I believe that if you type /bin/sh you get dash, while the default terminal shell is indeed bash.

    On my Mac 10.10.5 the default system shell /bin/sh reports itself as GNUBash.

    I guess the point here is why are we, by default invoking any other shell on a UNIX/Linux/POSIX system other than /bin/sh? On all systms this is a lowest common denominator, maxium portability choice.

     

    Last edit: Bruce 2017-10-17
  • Bruce

    Bruce - 2017-10-17

    It turns out that bash does the same thing as ksh when invoked via /bin/sh, it enters POSIX mode.

     
  • Jack J. Woehr

    Jack J. Woehr - 2017-10-17

    I agree the default should be /bin/sh ... if anyone wants special functionality they can invoke bash or ksh explicitly.

     
  • Per Olov Jonsson

    Not a very scientific answer but when I look at the command "set" in a standard terminal on my standard setup macOS Sierra MAC it reports SHELL=/bin/bash

    I have used bash a long time without thinking about it, it did not occur to me that it could be anything else, unless I changed it. But I have not seen any official document from Apple, and "Darwin" came around 2000 or so so for me it is more about what shell is the standard for macOS Sirerra and soon Sierra High.

    I have to go back somewhat on the above, the question was about "Darwin" and not about macOS, right? Darwin is one family of open source OS, macOS, Mac OS X etc is another, proprietary OS using "Darwin" as a base, so my answer relates to macOS, not to Darwin as such.

    This is what Wikipedia writes about it (English version is not as detailed as the German):
    Trotz der Bestrebungen, Darwin abseits von macOS – das von 1998 bis 2012 Mac OS X und von 2012 bis 2016 OS X hieß – verfügbar zu machen, gibt es das Darwin-Betriebssystem hauptsächlich als Unterbau und somit als integralen Bestandteil von macOS und iOS.

    since /bin/sh reports as GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16) I am fine with thath as well, maybe more future proof?

     

    Last edit: Per Olov Jonsson 2017-10-17
    • Bruce

      Bruce - 2017-10-18

      Let see if I can do better explaining this. It doesn’t matter what shell you use as your terminal shell, or which shell the OS sets up for you when you define a new user. We aren’t talking about terminal shells, we are talking about shells that are invoked in a non-terminal environment.

      In that case the UNIX specification which binds the actions of SUN Solaris, IBM AIX, and MacOS, is to invoke the shell named ’sh’.

      For example here is the POSIX definition of the system() function.
      The system() function shall behave as if a child process were created using fork(), and the child process invoked the sh utility using execl() as follows:
      execl(<shell path="">, “sh", "-c", command, (char *)0);

      Every UNIX or POSIX system is guaranteed to have /bin/sh, and /bin/sh is guaranteed to have a defined set of behaviors.

      There is no definition on how /bin/sh is implemented. At least three shells bash, ksh, and dash have POSIX modes that when invoked via /bin/sh they adopt the defined behaviors.

      The Linux Standard Base, for the most part follows UNIX and POSIX, and requires /bin/sh.

      It would simplify our code base if all *NIX followed the standards and defaulted to /bin/sh

      Bruce

      On Oct 17, 2017, at 2:37 PM, Per Olov Jonsson perolovjonsson@users.sf.net wrote:

      Not a very scientific answer but when I look at the command "set" in a standard terminal on my standard setup macOS Sierra MAC it reports SHELL=/bin/bash

      I have used bash a long time without thinking about it, it did not occur to me that it could be anything else, unless I changed it. But I have not seen any official document from Apple, and "Darwin" came around 2000 or so so for me it is more about what shell is the standard for macOS Sirerra and soon Sierra High.

      [bugs:#1494] https://sourceforge.net/p/oorexx/bugs/1494/ Darwin inital environment should be bash instead of ksh

      Status: accepted
      Group: 5.0.0
      Created: Mon Oct 16, 2017 07:19 PM UTC by Erich
      Last Updated: Tue Oct 17, 2017 05:18 PM UTC
      Owner: Erich

      The initial Darwin address() environment seems to be ksh.
      It should be bash instead

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/bugs/1494/ https://sourceforge.net/p/oorexx/bugs/1494/
      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/

       
      • Per Olov Jonsson

        Dear Bruce,

        /bin/sh makes perfekt sense also to me, I edited my posting already yesterday to this respect, but the edit did not go to the list. I only responded because Erich asked for input from users, not only developers. And Erich and I had a somewhat confused discussion on the subject in the past, see

        [bugs:#1439] https://sourceforge.net/p/oorexx/bugs/1439/

        Using /bin/sh would have the advantage that IF Apple should decide on another shell as the standard ooRexx would automatically follow.

        Hälsningar/Regards/Grüsse,
        P.O. Jonsson
        oorexx@jonases.se
        Von mein MacBookPro gesendet

        Am 18.10.2017 um 02:24 schrieb Bruce bjskelly@users.sf.net:

        Let see if I can do better explaining this. It doesn’t matter what shell you use as your terminal shell, or which shell the OS sets up for you when you define a new user. We aren’t talking about terminal shells, we are talking about shells that are invoked in a non-terminal environment.

        In that case the UNIX specification which binds the actions of SUN Solaris, IBM AIX, and MacOS, is to invoke the shell named ’sh’.

        For example here is the POSIX definition of the system() function.
        The system() function shall behave as if a child process were created using fork(), and the child process invoked the sh utility using execl() as follows:
        execl(<shell path="">, “sh", "-c", command, (char *)0);

        Every UNIX or POSIX system is guaranteed to have /bin/sh, and /bin/sh is guaranteed to have a defined set of behaviors.

        There is no definition on how /bin/sh is implemented. At least three shells bash, ksh, and dash have POSIX modes that when invoked via /bin/sh they adopt the defined behaviors.

        The Linux Standard Base, for the most part follows UNIX and POSIX, and requires /bin/sh.

        It would simplify our code base if all *NIX followed the standards and defaulted to /bin/sh

        Bruce

        On Oct 17, 2017, at 2:37 PM, Per Olov Jonsson perolovjonsson@users.sf.net perolovjonsson@users.sf.net wrote:

        Not a very scientific answer but when I look at the command "set" in a standard terminal on my standard setup macOS Sierra MAC it reports SHELL=/bin/bash

        I have used bash a long time without thinking about it, it did not occur to me that it could be anything else, unless I changed it. But I have not seen any official document from Apple, and "Darwin" came around 2000 or so so for me it is more about what shell is the standard for macOS Sirerra and soon Sierra High.

        [bugs:#1494] https://sourceforge.net/p/oorexx/bugs/1494/ https://sourceforge.net/p/oorexx/bugs/1494/ https://sourceforge.net/p/oorexx/bugs/1494/ Darwin inital environment should be bash instead of ksh

        Status: accepted
        Group: 5.0.0
        Created: Mon Oct 16, 2017 07:19 PM UTC by Erich
        Last Updated: Tue Oct 17, 2017 05:18 PM UTC
        Owner: Erich

        The initial Darwin address() environment seems to be ksh.
        It should be bash instead

        Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/bugs/1494/ https://sourceforge.net/p/oorexx/bugs/1494/ https://sourceforge.net/p/oorexx/bugs/1494/ https://sourceforge.net/p/oorexx/bugs/1494/
        To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/
        [bugs:#1494] https://sourceforge.net/p/oorexx/bugs/1494/ Darwin inital environment should be bash instead of ksh

        Status: accepted
        Group: 5.0.0
        Created: Mon Oct 16, 2017 07:19 PM UTC by Erich
        Last Updated: Tue Oct 17, 2017 09:37 PM UTC
        Owner: Erich

        The initial Darwin address() environment seems to be ksh.
        It should be bash instead

        Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/bugs/1494/ https://sourceforge.net/p/oorexx/bugs/1494/
        To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/

         
  • Erich

    Erich - 2017-11-26
    • status: accepted --> closed
     
  • Erich

    Erich - 2017-11-26

    Consenus was reached that Darwin should have "sh" as defaut environment.
    See [feature-requests:#703]

    Closing this.

     

    Related

    Feature Requests: #703

Anonymous
Anonymous

Add attachments
Cancel