Bug 299113 - Unable to load multiples text files in the same session from script.
Summary: Unable to load multiples text files in the same session from script.
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: scripting (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-30 15:40 UTC by jcdole
Modified: 2012-10-27 17:58 UTC (History)
1 user (show)

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 jcdole 2012-04-30 15:40:17 UTC
Hello.
I am calling kate from a shell script (saying : edit_files_of_the_day.sh ) for editing some kind of files in the same session.
The script was running fine until opensuse 10.3.
Something like :

#!/bin/bash
# edit_files_of_the_day.sh
cd /my_dir1/my_dir2
for afile in  paul.txt  pierre.txt  jean*.txt ;  do
    kate -u $afile
done

cd /my_dir1/my_dir4
for afile in  manchester.txt  Italy* ;  do
  if [ -d "$afile" ]; then
	echo "$afile is a directory. Nothing to do"
  elif [ -f "$afile" ]; then
       kate -u $afile
  else
	echo "$afile does not exist or is a special file. Nothing to do"
  fi
done
# end of script
#

For 11.1, I had to modify the script by adding the following at the very beginning of the shell.
( see also & at the end )

kate  -u  /my_data/dummy_file  &

Note :   /my_data/dummy_file must exists otherwise kate stop loading  the files after the first one; waiting I close it  for opening the next one and so on.

Don't ask me why it was working.

Now I am running 12.1.
The script is working only once (until I reboot) .
After that it stop loading with these errors :

linux:~/bin # ./edit_files_of_the_day.sh
kate(9769) KXMLGUI::ActionList:lug: Index 16 is not within range (0 - 14
kate(9790) KXMLGUI::ActionList:lug: Index 16 is not within range (0 - 14
linux:~/bin #


How could I call kate within for loop ?

Opensuse 12.1
Linux 3.1.9-1.4-desktop #1 SMP PREEMPT Fri Jan 27 08:55:10 UTC 2012 (efb5ff4) x86_64 x86_64 x86_64 GNU/Linux

kate-4.7.2-2.1.2.x86_64
KDE : Revision KDE 4.7 (2011-09-04) 


Reproducible: Always

Steps to Reproduce:
1. run any script like the one as describe in the details paragraph( must run ok the first time after boot ).
2. Close Kate
3. re run the script
Actual Results:  
Result after step 1 with a real script
All message are correct.
============================
linux:~ # logs_read_part0
/root/bin/logs_read_part1: line 27: /var/log/boot.omsg: No such file or directory
/root/bin/logs_read_part1: line 27: /var/log/boot.msg: No such file or directory
/root/bin/logs_read_part1: line 27: /var/log/messages: Permission denied
/root/bin/logs_read_part1: line 27: /var/log/localmessages: Permission denied
/root/bin/logs_read_part1: line 27: /var/log/ntp: Permission denied
/root/bin/logs_read_part1: line 27: /var/log/nx-nomachine.log: No such file or directory
/root/bin/logs_read_part1: line 27: /var/log/ssh.log: No such file or directory
/root/bin/logs_read_part1: line 27: /var/log/nvidia.log: Permission denied
/root/bin/logs_read_part1: line 27: /var/log/cups*log: No such file or directory
/root/bin/logs_read_part1: line 27: /var/log/apache2/*log: No such file or directory
/root/bin/logs_read_part1: line 27: /var/log/dhcp_dns/*log: No such file or directory
/root/bin/logs_read_part2: line 27: cd: /var/log/openldap: No such file or directory
Desktop est un repertoire
Documents est un repertoire
Downloads est un repertoire
Music est un repertoire
Pictures est un repertoire
Public est un repertoire
Templates est un repertoire
Videos est un repertoire
bin est un repertoire
inst-sys est un repertoire
lost+found est un repertoire
-- END step 1 ------------------------------- 

Result after step 2
============================
Nothing to say
-- END step 2 ------------------------------- 

Result after step 3 ( re run the same script )
============================
linux:~ # /root/bin/logs_read_part0
kate(6462) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 

Note : Only the first file is loaded.
If I close Kate, the second file is loaded and the console show :

linux:~ # /root/bin/logs_read_part0
kate(6462) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6508) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 

and so on for each closing Kate window.
linux-srv:~ # /root/bin/logs_read_part0
kate(6462) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6508) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6576) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14                                               
kate(6578) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14                                               
kate(6580) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6582) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14                                               
kate(6584) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6586) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14                                               
kate(6588) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6591) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6593) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6595) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14                                               
kate(6597) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6599) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6601) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6603) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6605) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6607) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6609) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
kate(6611) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
linux:~ # 



Expected Results:  
It is expected that all the files open in kate each time the script is started.
Comment 1 Christoph Cullmann 2012-10-27 17:58:52 UTC
For me that works just fine:

for i in *.c; do kate $i; done

-u is default now, and this for loop just opens 2 files in my existing running kate session.