bug-make
[Top][All Lists]
Advanced

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

[bug #63693] allow a way of asserting that $(SHELL) is POSIX/Bourne comp


From: David Boyce
Subject: [bug #63693] allow a way of asserting that $(SHELL) is POSIX/Bourne compatible
Date: Mon, 23 Jan 2023 16:20:09 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?63693>

                 Summary: allow a way of asserting that $(SHELL) is
POSIX/Bourne compatible
                 Project: make
               Submitter: boyski
               Submitted: Mon 23 Jan 2023 09:20:06 PM UTC
                Severity: 3 - Normal
              Item Group: Enhancement
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: None
        Operating System: None
           Fixed Release: None
           Triage Status: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 23 Jan 2023 09:20:06 PM UTC By: David Boyce <boyski>
Currently, make decides whether the current shell is sufficiently
POSIX-shell-like by looking at a hard-coded list of names:

/* determines whether path looks to be a Bourne-like shell. */
int
is_bourne_compatible_shell (const char *path)
{
  /* List of known POSIX (or POSIX-ish) shells.  */
  static const char *unix_shells[] = {
    "sh",
    "bash",
    "dash",
    "ksh",
    "rksh",
    "zsh",
    "ash",
    NULL
  };

This is unfortunate for a couple of reasons. First, it probably leaves out
some compatible shells and would make it harder to adapt to a new POSIX shell
someone might invent. Second, it damages shell wrapper capabilities which is
my specific problem.

I have a little open-source tool called "mdsh"
(https://github.com/boyski/mdsh) which wraps over the real shell and provides
diagnostic data for debugging complex make issues. But since name "mdsh" is
not on the list above it's not recognized as a POSIX shell though it simply
re-execs /bin/sh so of course it is. This causes problems when used with
.ONESHELL, for instance, since leading @ characters in interior lines are only
stripped for POSIX shells which means setting SHELL=mdsh results in mysterious
breakages.

I've had to resort to invoking mdsh via a symlink to a name that is on the
list, e.g. "rksh -> mdsh", which works but is not exactly elegant. I suggest
it would be better to have a way of adding to the list dynamically, or simply
to assert that the current shell is POSIX-compatible.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63693>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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