Summary: | KopeTeX doesnot display math and freezes Kopete | ||
---|---|---|---|
Product: | [Unmaintained] kopete | Reporter: | Sonmez Sahutoglu <sonmezsahut> |
Component: | Latex Plugin | Assignee: | Dennis Nienhüser <nienhueser> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | environ.314, Simon80 |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Fixes kopetex script to use correct shell
Alternate fix for the problem |
Description
Sonmez Sahutoglu
2006-10-20 01:52:52 UTC
It's the same for me with Kubuntu 6.10 The problem is that /bin/sh is specified as the shell in the kopete_latexconvert.sh script, while /bin/bash really should be used. sh is linked to bash in most distributions, but in Ubuntu it is linked to dash. It seems that the scripts creator assumed that it would work with any standard shell, while it actually requires bash. Simply change the first line of /usr/bin/kopete_latexconvert.sh from "#!/bin/sh" to "#!/bin/bash" to make the script work properly. Created attachment 18601 [details]
Fixes kopetex script to use correct shell
kopete_latexconvert.sh seems to only work with bash, so change the shell
accordingly.
Of course, this will break on FreeBSD, where /bin/sh exists, but bash (if it's installed) lives in /usr/local/bin/bash :-). Looks like the correct fix is to make the script not require bash (ie, use genuine sh syntax). Hrm, though it works here, and must be using sh. Can someone on kubuntu take a look at the script to see why dash doesn't like it? It seems to be the "let"-command (line 225 here) and this (line 194): test -f ${f##*/} || ln -s $f . # multi-processing! I'm no bash-monkey though, so someone else will have to figure out what's the problem :) The actual error messages are this: /usr/bin/kopete_latexconvert.sh: 1: let: not found test: 1: out.eps: unexpected operator ln: creating symbolic link `./*.eps' to `/home/frank/*.eps': File exists To solve this just change that line (kubuntu 6.10): let OPTIND=$OPTIND+1 with: OPTIND=`expr $OPTIND + 1` It works with dash, at least it works on my system. I have spotted another problem: when you write something like $$ text $$ in a chatwindow and you are using the latex plugin text is sent to kopete_latexconvert.sh as an input parameter. Since this is a command line parameter characters like \f \t etc etc are interpreted as special character. It happens you have to write something like \frac which is of course misunderstood by the script. A solution would be escaping backslashes. In latex.ccp you should add in the handlelatex method (I think, I'm not a lot into Qt) QRegExp backslash ( "\" ); latexformula.replace( backslash, "\\" ); Maybe other kind of characters should be escaped, like $. Sorry, I can't provide any patch cause I haven't got kopete 0.12.3 source files. Hope some of the developpers can provide some kind of fix for this. Thank you Andrea I made the suggested change here, and it still works, so it seems safe for non-kubuntu distributions (I'm running FreeBSD). I can't reproduce the problem you mention with \frac - I can do something like: $$\frac{3}{5}$$ and get a nice fraction in my kopete window. Can anyone else try that? Talking about people who is using dash or bash (I guess Philip you are using sh or maybe tcsh, don't know). Philip can you try typing $$\\frac{3}{5}$$ and see what happens? Thank you very much. Andrea If I enter $$\\frac{3}{5}$$ I get "frac35" displayed in my kopete window. That's because you only need one backslash. Remove the second and it will work. Whoops, sorry, never mind. I read that message out of context :( *** Bug 139582 has been marked as a duplicate of this bug. *** Created attachment 19657 [details]
Alternate fix for the problem
Here's another fix - this uses the built in $(( expression )) syntax instead of
the expr command. I'm not sure which is more portable.
SVN commit 799167 by nienhueser: Increment variable using sh compatible arithmetic expansion $(( )), tested with dash and bash. Use -d parameter of mktemp to avoid removing and recreating the temporary file as a directory. CCBUG: 135997 M +2 -4 kopete_latexconvert.sh WebSVN link: http://websvn.kde.org/?view=rev&revision=799167 The above fixes it for Kubuntu, thanks for the input everyone. I'll backport this later and see what can be done for escaping characters (the \frac problem for example happens with dash, but not bash). SVN commit 799193 by nienhueser: Use printf instead of echo to avoid escape sequence interpretation by the underlying shell. This means that latex commands don't get messed up by the shell anymore. CCBUG: 135997 M +1 -1 kopete_latexconvert.sh WebSVN link: http://websvn.kde.org/?view=rev&revision=799193 SVN commit 799199 by nienhueser: Increment variable using sh compatible arithmetic expansion $(( )), tested with dash and bash. Use -d parameter of mktemp to avoid removing and recreating the temporary file as a directory. Backport of revision 799167. CCBUG: 135997 M +2 -4 kopete_latexconvert.sh WebSVN link: http://websvn.kde.org/?view=rev&revision=799199 SVN commit 799200 by nienhueser: Use printf instead of echo to avoid escape sequence interpretation by the underlying shell. This means that latex commands don't get messed up by the shell anymore. Backport of revision 799193. BUG: 135997 M +1 -1 kopete_latexconvert.sh WebSVN link: http://websvn.kde.org/?view=rev&revision=799200 |