[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Detecting invocation as /bin/sh ?

From: Alexandre Ferrieux
Subject: Detecting invocation as /bin/sh ?
Date: Thu, 25 Sep 2014 23:53:18 -0700 (PDT)
User-agent: G2/1.0


In the wake of the exported func bug, as can be seen in the nearby thread 
"Issues with exported functions", many people are just now discovering a host 
of things that bash does, of course in a documented way, but that they never 
needed in the first place.

Of course, their intention is precisely expressed by the '#!/bin/sh' header in 
scripts, but most major Unices today just have a symbolic link there (sh->bash).

So, what about, in bash's initialization, detecting that we are invoked as 
"/bin/sh", and disabling all those bells and whistles (or behaving as bash -p, 
which is a close approximation) ?

Note we already have something similar with the name "rbash" that triggers 
restricted mode:

  restricted_shell = shell_is_restricted (shell_name);

So I'm merely proposing to do the same with privileged_mode (or a close cousin 
if its side effects are too strong):

  privileged_mode = shell_is_legacy_sh (shell_name);

Reactions ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]