LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Delay with kdialog when run by root (https://www.linuxquestions.org/questions/linux-software-2/delay-with-kdialog-when-run-by-root-553521/)

geoff_f 05-13-2007 06:39 AM

Delay with kdialog when run by root
 
I've constructed a script that uses kdialog. The dialog box appears immediately on being called, but takes about 20 secs after the box disappears to return with the result. This only happens with the 'root' user; a normal user experiences no delay. The 'root' user's shell reports 'kbuildsycoca running...' before launching the dialog box. This does not appear when a normal user runs this script. This happens with Suse 10.0 and openSUSE 10.2, but not with Knoppix 5.1.1 (ie, Knoppix has no delay with either user, and no 'kbuildsycoca running...' message). This short demo will illustrate the problem:
Code:

#!/bin/bash

# Try kdialog for the 1st time
Selection=$(kdialog --title "Kdialog Test" --radiolist "Please select an Option from the following list:" 1 Option1 on 2 Option2 off 3 Option3 off)
Result=$?                                                                                                                # Get dialog return result
echo "Result from 1st dialog =$Result"
echo "Selection =$Selection"

# Now try kdialog for the 2nd time
Selection=$(kdialog --title "Kdialog Test2" --radiolist "Please select an Option from the following list:" 1 Option1 on 2 Option2 off 3 Option3 off)
Result=$?                                                                                                                # Get dialog return result
echo "Result from 2nd dialog =$Result"
echo "Selection =$Selection"

What happens is that the first dialog appears pretty well immediately, then, after selecting an option and clicking on OK, there is a delay of about 20 seconds before the Result is echoed. Then the second dialog box appears without delay; after making the second selection, another 20 seconds delay occurs before the second Result is echoed.

Does anyone know what's going on here? Is there a setting that can fix this? At the moment it is stopping me from using kdialog in scripts run by root.

I've searched with Google and with LQ Search, but no joy. Any help would be really appreciated.

(Posting in this forum because I'm not sure whether it's a problem with bash, kde or SUSE.)

titopoquito 05-13-2007 12:57 PM

I get this delay even when I call the script as normal user, no matter how often I do this. No delay appears if I don't use $() but echo the output into a file.

Interestingly, If I changed it to
Code:

#!/bin/bash

# Try kdialog for the 1st time
kdialog --title "Kdialog Test" --radiolist "Please select an Option from the following list:" 1 Option1 on 2 Option2 off 3 Option3 off > kdialog.output
Selection=$(cat kdialog.output)
Result=$?                                                                                                                # Get dialog return result
echo "Result from 1st dialog =$Result"
echo "Selection =$Selection"

# Now try kdialog for the 2nd time
Selection=$(kdialog --title "Kdialog Test2" --radiolist "Please select an Option from the following list:" 1 Option1 on 2 Option2 off 3 Option3 off)
Result=$?                                                                                                                # Get dialog return result
echo "Result from 2nd dialog =$Result"
echo "Selection =$Selection"

then BOTH runs go quick, even though the second one is with your code. If I change the first one back to your code BOTH runs take long.

kdialog looks nicer, but If I need something like this I use Xdialog which starts much quicker as far as I have experienced.

geoff_f 05-14-2007 04:35 AM

titopoquito, thanks very much for your reply. The same thing works for me, and solves my problem! I can live with using a temp file intermediary, as long as it gets the job done.

But as to why it would behave like that, it's just too bizarre for words.

Once again, many thanks.


All times are GMT -5. The time now is 09:43 PM.