Hi,
I am forwarding a bug reported against cgit 1.0 in Debian.
https://bugs.debian.org/784621
syntax-highlighting.py aborts due to an unhandled exception if the
inner call to guess_lexer() throws ClassNotFound. Please see the
attached patch by Daniel Reichelt that resolves the issue.
Is the handling of TypeError for the outer call still needed? The
documentation mentions only ClassNotFound as a possible exception.
http://pygments.org/docs/api/#pygments.lexers.guess_lexer_for_filename
Regards,
Peter
--- Begin Message ---
Package: cgit
Version: 1.0+git2.8.3-3~bpo8+1
Followup-For: Bug #784621
Hi,
I just stumbled over this issue as well. The attached patch fixes this.
Cheers
Daniel
-- System Information:
Debian Release: 8.6
APT prefers stable-updates
APT policy: (990, 'stable-updates'), (990, 'proposed-updates'), (990,
'stable'), (500, 'testing-proposed-updates'), (99, 'testing'), (98,
'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)
Versions of packages cgit depends on:
ii libc6 2.19-18+deb8u6
ii liblua5.1-0 5.1.5-7.1
ii libssl1.0.0 1.0.1t-1+deb8u5
ii zlib1g 1:1.2.8.dfsg-2+b1
Versions of packages cgit recommends:
ii apache2 [httpd] 2.4.10-10+deb8u7
Versions of packages cgit suggests:
ii highlight 3.18-3
ii python3 3.4.2-2
pn python3-docutils <none>
ii python3-markdown 2.5.1-2
ii python3-pygments 2.0.1+dfsg-1.1+deb8u1
-- no debconf information
-- debsums errors found:
debsums: changed file /usr/lib/cgit/filters/syntax-highlighting.py (from cgit
package)
--- /usr/lib/cgit/filters/syntax-highlighting.py.orig 2016-11-17 23:42:23.992555420 +0100
+++ /usr/lib/cgit/filters/syntax-highlighting.py 2016-11-17 23:42:20.000547312 +0100
@@ -41,7 +41,10 @@
except ClassNotFound:
# check if there is any shebang
if data[0:2] == '#!':
- lexer = guess_lexer(data)
+ try:
+ lexer = guess_lexer(data)
+ except ClassNotFound:
+ lexer = TextLexer()
else:
lexer = TextLexer()
except TypeError:
_______________________________________________
Pkg-cgit-devel mailing list
pkg-cgit-de...@lists.alioth.debian.org
https://lists.alioth.debian.org/mailman/listinfo/pkg-cgit-devel
--- End Message ---