[Pkg-mc-devel] Bug#844212: Bug#844212: mc: improved syntax detections for sh, perl, makefile and m4

Jonas Smedegaard dr at jones.dk
Sun Nov 13 17:22:46 UTC 2016

Hi Yury,

Quoting Yury V. Zaytsev (2016-11-13 16:49:13)
> On Sun, 13 Nov 2016, Jonas Smedegaard wrote:
>> Similar patterns likely makes sense to expand to other syntaxes as well.
> In the future, please post such patches directly to the upstream bug 
> tracker; they are not Debian-specific, and all you gonna get out of 
> posting them to the Debian bug tracker is a few months to a few years 
> delay in getting them upstreamed.

Ok - and thanks for your swift response!

I can recommend to add a reportbug hook to warn bugreporters that such 
severe bitrot is to be expected.

Should I file a separate wishlist bugreport about that?

>> Attached is a patch for improved syntax detections for sh, perl, 
>> makefile and m4.
> I've committed the *.t thing, but your regexes scare the hell out of me.
> I understand that these ones are some kind of editor tags, but I'm not 
> sure what they are actually supposed to match:
> -\\\*-\s\*(.\*;)?(mode:\s)?.\*(sh|shell-script)(;.\*)?\s-\\\*-
> -\\\*-\s\*(.\*;)?mode:\smakefile(;.\*)?\s-\\\*-)
> -\\\*-\s\*(.\*;)?(mode:\s)?.\*Autotest(;.\*)?\s-\\\*-

It is emacs-style hint, with \ and * backtick-escaped:


# -*- Mode: sh; tab-width: 4; indent-tabs-mode: t -*-

# This is a -*- sh -*-

> Besides, the whole composition is somehow weird and inconsistent:
> ^#\s\*(!\s\*(/usr/bin/)?make|-\\\*-\s\*(.\*;)?mode:\smakefile(;.\*)?\s-\\\*-)
>      ^ spaces in shebang?!

Intended: Emacs style commonly contains spaces, (even hashbang style 
uncommonly does too, I believe):


>              ^ why this is optional?!

Because it is in the wild:


> ^#\s\*!\s\*(/usr/bin/)?m4|-\\\*-\s\*(.\*;)?(mode:\s)?.\*Autotest(;.\*)?\s-\\\*-
>        ^ no parens unlike above?!
> ^#!\s\*/(.\*/|usr/bin/env\s)([a-z]?|ba|pdk)sh|-\\\*-\s\*(.\*;)?(mode:\s)?.\*(sh|shell-script)(;.\*)?\s-\\\*-
>                                                ^ can't be a valid script

Again, that is emacs hint.  Only when executable bit is set do the 
initial line need to be a hashbang - files included or in other ways 
used indirectly need not.

> I'm sorry, but I think this is unfit to be committed.

If not because you made wrong assumptions now clarified, please 
elaborate why.

 - Jonas

 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

More information about the Pkg-mc-devel mailing list