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

Shell not recognised #3181

Closed
mirabilos opened this issue Aug 30, 2016 · 11 comments
Closed

Shell not recognised #3181

mirabilos opened this issue Aug 30, 2016 · 11 comments

Comments

@mirabilos
Copy link

mirabilos commented Aug 30, 2016

Hi,

https://github.com/MirBSD/kwalletcli lists as:

Groff 55.0% C 18.4% C++ 16.6% Makefile 10.0% 

However, the lines-as-counted-by-wc distribute as follows:

  • 167 make
  • 86 text (UTF-8)
  • 380 C
  • 329 C++
  • 665 shell
  • 1094 nroff
  • 2123 SVG

(plus three *.png files I don’t count, as they’re binary)

@Alhadis
Copy link
Collaborator

Alhadis commented Aug 30, 2016

What's mksh?

@mirabilos
Copy link
Author

John Gardner dixit:

What's mksh?

The successor of pdksh, and an independent Korn shell implementation
(with the blessing of David Korn).

Disclaimer: I am the current developer of mksh.

bye,

//mirabilos

FWIW, I'm quite impressed with mksh interactively. I thought it was much
much more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh

@Alhadis
Copy link
Collaborator

Alhadis commented Aug 31, 2016

Well, the reason the shell-script isn't being recognised as one is because it uses an unfamiliar interpreter directive. Linguist pairs the names of known executables (like bash, ksh, dash, et al) to languages when matching based on hashbangs. Since mksh isn't in the list, it isn't doing any language recognition.

You can manually override that by adding a .gitattributes file with a linguist-language property set. More on that here. Alternatively, adding an Emacs or Vim modeline in the first couple lines of the file will help, too. :-)

John Gardner dixit:

Erh... do you have your language settings set to Latin? :|

@larsbrinkhoff
Copy link
Contributor

larsbrinkhoff commented Aug 31, 2016

About 100 repositories mention mksh. I don't think it would be unreasonable to add it to the list of shell interpreters.

EDIT: That's just in the repository name. This search get 7000 hits.

@pchaigno
Copy link
Contributor

EDIT: That's just in the repository name. This search get 7000 hits.

@larsbrinkhoff Results of your search don't seem to contain the mksh shebang :/
This search yields only 47 files with mksh shebangs.

@mirabilos
Copy link
Author

John Gardner dixit:

Well, the reason the shell-script isn't being recognised as one is
because it uses an unfamiliar interpreter directive. Linguist pairs
the names of known executables (like bash, ksh, dash, et al) to
languages when matching based on hashbangs. Since mksh isn't in the
list, it isn't doing any language recognition.

mksh was added to Debian’s static code checker in, I don’t know,
2008 or so, so…

Lars Brinkhoff dixit:

About 100 repositories mention mksh. I don't think it would be
unreasonable to add it to the list of shell interpreters.

… yes please!

John Gardner dixit:

John Gardner dixit:

Erh... do you have your language settings set to Latin? :|

What is “language settings”? My Unix system doesn’t have that.
But yes, this is Latin.

Paul Chaignon dixit:

EDIT: That's just in the repository name. This search get 7000 hits.

@larsbrinkhoff Results of your search don't seem to contain the mksh shebang :/
[This search](https://github.com/search?p=1&q=%22usr%2Fbin%2Fenv+mksh%22

“This search” is broken, the standard shebang is “#!/bin/mksh”,
only some (predominantly older) scripts use “#!/usr/bin/env mksh”.

Please make sure both are recognised for scripts.

Some distributions also have “mksh-static” and “lksh” as binaries
in the mksh package, although the former tends to only be used for
some local scripts using a “rescue shell”, and the latter is only
used by “legacy scripts”, i.e. those that require the shell to behave
as older korn or bourne shell variants did, for some things. Although
adding them would not be unreasonable.

If you want, I can do a recherche on which shells a contemporary GNU
system offers (trivial, as I’ve installed most of them, for testing
mksh against their behaviour) and submit a pull request adding them,
in both shebang forms, to your lists, so we have them all at once.

bye,

//mirabilos

„Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund,
mksh auf jedem System zu installieren.“
-- XTaran auf der OpenRheinRuhr, ganz begeistert
(EN: “[…]uhr.gz is a reason to install mksh on every system.”)

@larsbrinkhoff
Copy link
Contributor

Results of your search don't seem to contain the mksh shebang

@pchaigno No, but that't not what I was trying to find. I just wanted to vaguely gauge the popularity of this shell.

@mirabilos
Copy link
Author

Lars Brinkhoff dixit:

I just wanted to vaguely gauge the popularity of this shell.

Roughly two billion installations, although not as /bin/mksh
but as /system/bin/sh on Android.

So, nothing to get worked up about ;-)

bye,

//mirabilos

Beware of ritual lest you forget the meaning behind it.
yeah but it means if you really care about something, don't
ritualise it, or you will lose it. don't fetishise it, don't
obsess. or you'll forget why you love it in the first place.

@lukateras
Copy link
Contributor

/bin/mksh is POSIX-compliant, and is usually symlinked to /bin/sh. Most mksh users use usual #!/bin/sh shebang In order to ensure compatibility with other POSIX-compliant shells, which is why results are skewed.

/bin/dash is in similar situation. Perhaps it makes sense to add less popular shells in a bulk?

@smola
Copy link
Contributor

smola commented Jul 3, 2017

PR to add a few more shells: #3708

@lildude
Copy link
Member

lildude commented Oct 31, 2017

Looks like Linguist now recognises a lot more shell including all those mentioned here, so I'm closing this issue. If there's anything missing or we need further extensions, please open a new issue or submit a PR for those.

@lildude lildude closed this as completed Oct 31, 2017
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants