Bug 265730 - KDE 4.6.0: kate: startup noise and broken external tool
Summary: KDE 4.6.0: kate: startup noise and broken external tool
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-07 22:29 UTC by Jon Nelson
Modified: 2011-07-29 16:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Nelson 2011-02-07 22:29:25 UTC
Version:           unspecified (using KDE 4.6.0) 
OS:                Linux

Every time kate is opened the following is spammed:

"KConfigIni: In file /usr/share/kde4/apps/kate/externaltools, line 8: "
"Invalid escape sequence "\'"." 
"KConfigIni: In file /usr/share/kde4/apps/kate/externaltools, line 8: "
"Invalid escape sequence "\'"." 
"KConfigIni: In file /usr/share/kde4/apps/kate/externaltools, line 8: "
"Invalid escape sequence "\'"." 
"KConfigIni: In file /usr/share/kde4/apps/kate/externaltools, line 8: "
"Invalid escape sequence "\'"." 


This should be pretty trivial to fix:

change:
 \'%filename\'
to:
 \\'%filename\\'
or
'%filename'

(I'm not sure which is correct)



Reproducible: Always
Comment 1 Jon Nelson 2011-02-16 16:19:39 UTC
A corrected command:


command=if [ -z %directory ];  then kdialog --title Error --msgbox "The document has never been saved and thus cannot be compared to RCS."; else\ncd %directory\nif [ -d .svn ] && grep %filename .svn/entries 2>&1 >/dev/null ; then\n  svn diff %filename|kompare -o -\nelif [ -d CVS ] && grep %filename CVS/Entries 2>&1 >/dev/null ; then\n  cvs diff -ub %filename|kompare -o -\nelif [ -d .git ] && echo $(git ls-files) | grep %filename 2>&1 >/dev/null ; then\n  git diff %filename|kompare -o -\nelse\n  kdialog --title Error --msgbox "The file '%filename' is not under revision control.";\nfi\nfi\n
executable=kompare


Please note the addition of a semi-colon after the initial 'if' (and before 'then') and the correction of the back-whack ('\') before the single-quotes in the message "The file '%filename' is not under revision control."

Please note:

echo $(git ls-files) <<- wrong
git ls-files | grep <<- right

Please note: the original script placed an "fi" before "cd %directory". This is wrong. If %directory was empty then kdialog would get executed with "The document has never been saved and thus.." *however* the script would then continue anyway.  The logic here *should* be:

if [ -z %directory ]; then
  kdialog --title Error --msgbox "The document has never been saved and thus cannot be compared to RCS.";
else
  cd %directory || exit 1
  if [ -d .svn ] && grep %filename .svn/entries 2>&1 >/dev/null ; then
   svn diff %filename|kompare -o -
  elif [ -d CVS ] && grep %filename CVS/Entries 2>&1 >/dev/null ; then
   cvs diff -ub %filename|kompare -o -
  elif [ -d .git ] && git ls-files | grep %filename 2>&1 >/dev/null ; then
   git diff %filename|kompare -o -
  else
   kdialog --title Error --msgbox "The file '%filename' is not under revision control.";
  fi
fi


Lastly, *none* of these work in subdirectories of the top-level project (except perhaps CVS -- I can't say). 

Almost all of these external commands are probably better implemented as external *helper scripts* which kate then executes with the right arguments. That would make them easier to maintain, easier to write correctly, and probably safer to execute.

In this particular case, kate shipped with an external command that didn't even parse properly and doesn't work anyway.  I suggest that this particular command be removed -- it has too many issues to be corrected.

ditto externaltool_CompareDirectoryofCurrentDocumenttoRCS and externaltool_EmailCVSDiffforCurrentDocument.
Comment 2 Christoph Cullmann 2011-06-05 17:39:43 UTC
Git commit 50d61a17d2d651ee5464f112f35fc5e4b9f204d9 by Christoph Cullmann.
Committed on 05/06/2011 at 17:39.
Pushed by cullmann into branch 'master'.

remove broken commands
thanks for pointing this out to Jon Nelson
BUG: 265730

M  +1    -31   kate/plugins/externaltools/externaltools     

http://commits.kde.org/kate/50d61a17d2d651ee5464f112f35fc5e4b9f204d9
Comment 3 Jon Nelson 2011-07-29 16:43:00 UTC
Confirm it is fixed in 4.7.0 final.
Thanks!