bugmake - Bugs: bug #63693, allow a way of asserting that...

 
 

bug #63693: allow a way of asserting that $(SHELL) is POSIX/Bourne compatible

Submitter:  David Boyce <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
Component Version:  None Operating System:  None
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 23 Jan 2023 09:20:06 PM UTC, original submission:  

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.

David Boyce <boyski>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by boyski (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code