[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Detecting invocation as /bin/sh ?
From: |
Alexandre Ferrieux |
Subject: |
Re: Detecting invocation as /bin/sh ? |
Date: |
Fri, 26 Sep 2014 13:29:04 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Friday, September 26, 2014 10:00:08 AM UTC+2, Andreas Schwab wrote:
> Alexandre Ferrieux <alexandre.ferrieux@gmail.com> writes:
>
> > So, what about, in bash's initialization, detecting that we are invoked as
> > "/bin/sh",
>
> It already does. See (bash) Bash POSIX Mode.
Yes, it does do this detection, but too late for our concern, since things
occur in the following order:
(1) set_shell_name(argv[0]) => this detects "sh" and sets 'act_like_sh'
(2) shell_initialize() => this decides to import funcs from env depending on
flags like 'posixly_correct'
(3) if (act_like_sh) ... sv_strict_posix ("POSIXLY_CORRECT")
So it seems the order is wrong. As a consequence, and this is confirmed by
experience, the #!/bin/sh prefix behaves as featuristic bash.
My suggestion then is to undo that mistake.
-Alex
- Detecting invocation as /bin/sh ?, Alexandre Ferrieux, 2014/09/26
- Re: Detecting invocation as /bin/sh ?, Andreas Schwab, 2014/09/26
- Re: Detecting invocation as /bin/sh ?, Greg Wooledge, 2014/09/26
- Message not available
- Re: Detecting invocation as /bin/sh ?,
Alexandre Ferrieux <=
- Re: Detecting invocation as /bin/sh ?, Chet Ramey, 2014/09/29
- Message not available
- Re: Detecting invocation as /bin/sh ?, Alexandre Ferrieux, 2014/09/29
- Re: Detecting invocation as /bin/sh ?, Chet Ramey, 2014/09/29
- Message not available
- Re: Detecting invocation as /bin/sh ?, Alexandre Ferrieux, 2014/09/29
- Re: Detecting invocation as /bin/sh ?, Chet Ramey, 2014/09/29
- Message not available
- Re: Detecting invocation as /bin/sh ?, Alexandre Ferrieux, 2014/09/30
Message not available