Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Multi-mode support, Bash support, Zsh support, Fish support #191

Open
anadon opened this issue Jun 25, 2024 · 9 comments
Open

Comments

@anadon
Copy link

anadon commented Jun 25, 2024

Few contemporary scripts are written to conform to the POSIX standard. Many more are written to conform to bash, zsh, or fish. Of these, bash is particularly important. I'd like to see feature development to have multiple shells supported, but I'm not sure if I have the language skill level or project specific knowledge to work on these features. However, my own project requires such support and without it is basically dead.

@anadon
Copy link
Author

anadon commented Jun 27, 2024

Now needed to better support koalaman/shellcheck#3008

@Niols
Copy link
Member

Niols commented Jun 27, 2024

Morbig was initially written in the context of the CoLiS project that targeted Debian maintainer scripts, the huge majority of which are indeed written in POSIX Shell, mainly for performance reasons (dash is significantly faster than bash).

Of course, that doesn't mean that it shouldn't evolve beyond that, and it is fairly natural to want to consider classic Shell extensions — bash and zsh certainly are the most common ones (fish is also popular but is fundamentally quite different). The main two issues that I see with that are:

  1. that supporting several Shell variations involves either a lot of duplication, basically writing one version of Morbig per Shell variation, or having to separate from the POSIX standard.
  2. that we are talking about a considerable amount of work that none of us has on our hands; contributions are of course welcome, though.

@anadon
Copy link
Author

anadon commented Jun 27, 2024

I would like to hear from the experience of the shell-check developers, personally. There are many different possible outcomes depending on their experiences, and they do have much broader support of shells.

@Niols
Copy link
Member

Niols commented Jun 27, 2024

That would be very interesting indeed!

@anadon
Copy link
Author

anadon commented Jun 29, 2024

Related to #192, it appears that Shellcheck has much of the same infrastructure of Morbig. I believe a sane course of action could be to develop a version 2 using Shellcheck's infrastructure and then to extend features based on their already built out support for desired features.

@Niols
Copy link
Member

Niols commented Aug 25, 2024

If Morbig can be made extensible while also keeping the guarantee that it is as close to the POSIX standard as possible, that would be amazing. I do agree that drawing inspiration from Shellcheck would make sense. Still, lot of work!

@anadon
Copy link
Author

anadon commented Aug 25, 2024 via email

@Niols
Copy link
Member

Niols commented Aug 25, 2024

I don't think that Morbig has been superseeded by ShellCheck. These two pieces of software do not serve the same purpose at all:

  • Morbig has been designed from the get-go to provide a static parser for POSIX Shell that could be as trustworthy as possible when it comes to respecting the standard. This was meant as a basis for static analysis tools.
  • ShellCheck, on the other hand, does not care that much about compatibility with the standard, and is more focused on wide Shell support and extensibility. Bugs in the grammar support are unimportant as long as the reports to the users are relevant.

In principle, it is possible to get the best of both worlds, but I don't think Morbig is anywhere near that (and this has never been our intent in the past, and there is no time or energy presently to tackle this) and the last times I followed ShellCheck it was also really not there yet either, and I doubt they would be interested in spending much work to support very particular grammatical peculiarities of the POSIX Shell.

It could be worth linking to ShellCheck in the README as a related tool though, indeed.

@anadon
Copy link
Author

anadon commented Aug 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants