Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#4016 closed defect (worksforme)

syntax highlighting works with #!/bin/sh but not with #!/bin/bash

Reported by: anonymous Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: 0.10
Severity: normal Keywords:
Cc: kelrin@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

trac 0.10
GNU enscript 1.6.3

As near as I can figure, syntax highlighting in either strict sh or bash forms should work with enscript, since /usr/share/enscript/hl/enscript.st contains:

startrules
{
...
  /^#![ \t]*(\/usr)?\/bin\/sh/                          sh;
...
  /^#![ \t]*(\/usr)?(\/local)?\/bin\/bash/              bash;
...
}

and everthing else regarding it seems ship-shape, but trac may possibly be clobbering that, as /usr/lib/python2.4/site-packages/trac/mimeview/enscript.py contains only

types = {
...
    'application/x-csh':        ('csh', 2),
...
    'text/x-csh':               ('csh', 2),
...
    'text/x-ksh':               ('ksh', 2),
...
    'text/x-sh':                ('sh', 2),
...
    'application/x-sh':         ('sh', 2),
    'text/x-zsh':               ('zsh', 2),
...
}

Not sure if that's it or not, since I'm only guessing at unravelling what controls the highlighting, but something's not right, regardless. I changed a particular example from #/bin/sh in rev86 to #/bin/bash in rev90 and can flip through the revs and watch the syntax highlighting disappear.

Attachments (0)

Change History (4)

comment:1 by kelmo, 18 years ago

Cc: kelrin@… added

I can confirm this behaviour, and would love the day when my bash scripts are hightlighted with pretty colours.

Trac is a great tool, thanks.

comment:2 by Noah Kantrowitz (coderanger) <coderanger@…>, 18 years ago

Have tried setting the MIME type in Subversion?

 $ svn ps 'svn:mime-type' 'text/x-sh' <your file>

comment:3 by Christian Boos, 18 years ago

Resolution: worksforme
Status: newclosed

Check also TracIni#mimeviewer-section (Ok, I know, the documentation doesn't show in 0.10, fixed in 0.10.1dev), you can configure the mimeviewer to handle #!/bin/bash like this:

[mimeviewer]
mime_map = application/x-sh:bash

comment:4 by anonymous, 18 years ago

Thanks to all - especially Christian Boos - tried that and it worksforme, too. ;) But, true, just couldn't find that in 0.10.

Um. This message is not spam. I tell you three times. *Resubmit*

Okay, this filter is really lame. Down from 62% to 54%. Maybe I should open a new bug about spam bugs? And why should I have to have cookies enabled when 'm just going to delete and redisable them in a minute?

Anyway, thanks again for the mime tip.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.