After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 310824 - zenity --progress kills parent process!
zenity --progress kills parent process!
Status: RESOLVED FIXED
Product: zenity
Classification: Core
Component: general
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: Zenity Maintainers
Zenity Maintainers
: 337392 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-07-19 02:22 UTC by Matthew Burke
Modified: 2009-12-07 11:53 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
patch (2.30 KB, patch)
2005-12-19 11:37 UTC, Claudio Saavedra
none Details | Review
oops (1.23 KB, patch)
2005-12-19 11:40 UTC, Claudio Saavedra
none Details | Review
patch to add --auto-kill to --progress dialogs. (3.76 KB, patch)
2006-03-28 16:20 UTC, Diego Escalante Urrelo (not reading bugmail)
none Details | Review

Description Matthew Burke 2005-07-19 02:22:45 UTC
Version details: 2.10.0
Distribution/Version: Ubuntu 5.04

Basically in the following code if I am to cancel at the
--file-selection dialog everything does cancel correctly. But if I am
to cancel at the --progress dialog the commands I issue do
not go through.

myfile=$(zenity --file-selection --title="Create image from CD" --save
--directory --filename=~/newimage.iso)
if [ $? != 0 ]; then
      exit 0
fi
(
      echo "0"; sleep 1
      dd if=/dev/cdrom of=$myfile bs=1024
      echo "100"; sleep 1
) | zenity --progress --pulsate
if [ $? != 0 ]; then
      killall dd
fi
Comment 1 Matthew Burke 2005-07-19 14:21:25 UTC
After messing around a bit I came to the conclusion of being pretty certain this
is a bug. I was just testing some commands in a terminal to see what they spit
back as output. For instance 'zenity --question;echo $?' ... cancel returns 1
and okay returns 0, just like the documentation says. However ... try 'zenity
--progress;echo $?' ... and you never get a chance to see what it's returning
because it exits the terminal session. In my case this is a bad thing because I
cannot include the appropriate commands to kill the process that --progress was
relating to in the first place, nor can I remove the incomplete ISO.
Comment 2 Lucas Rocha 2005-07-19 14:50:34 UTC
Just an short explanation: the current behavior of Zenity Progress Dialog when
you click on cancel button is killing the parent process and return an error
code (1).

Maybe It'd better to just return 1 and let the user choose the cancel behavior.
Is that what you're suggesting?
Comment 3 Matthew Burke 2005-07-19 17:10:23 UTC
Yes. :) Like in my case I cannot stop the dd process unless I am able to choose
the cancel behavior. We could then even have the ability to prompt on cancel.
Like as if they really want to cancel the action being taken ... if no just
resume the --process dialog. :)
Comment 4 Lucas Rocha 2005-07-20 03:34:33 UTC
We'll make it on 2.13 because ATM zenity is feature-frozen.
Comment 5 Claudio Saavedra 2005-12-19 11:37:02 UTC
Created attachment 56150 [details] [review]
patch

With this patch users will have to decide what to do when cancelling. Anyway, I think that an option like --progress-kill-in-cancel won't be bad at all, what do you think Lucas?
Comment 6 Claudio Saavedra 2005-12-19 11:40:37 UTC
Created attachment 56151 [details] [review]
oops

Previous patch was mixed other patch. Sorry.
Comment 7 Diego Escalante Urrelo (not reading bugmail) 2006-03-28 16:20:11 UTC
Created attachment 62224 [details] [review]
patch to add --auto-kill to --progress dialogs.
Comment 8 Joel Bryan Juliano 2006-04-27 02:18:55 UTC
I tried different combinations to capture anything from zenity but no success, namely

----

(zenity --progress ...) | sed 's/Hang/Hangup'
read HUP_SIGNAL
if [ "$HUP_SIGNAL" = "Hangup" ]
kill something...
fi

----

(zenity --progress ... &
PID="$!"
something...
) && kill $PID && kill something....

----

zenity --progress .... && kill something....


these doesn't work, I'll try to see if there's something changed if I press the cancel button to compare my variable to..

joelbryan
Comment 9 Lucas Rocha 2006-05-10 03:41:25 UTC
*** Bug 337392 has been marked as a duplicate of this bug. ***
Comment 10 Lucas Rocha 2006-12-02 10:54:50 UTC
Fixed in HEAD! Thanks!

2006-12-02  Lucas Rocha  <lucasr@gnome.org>

        * src/zenity.h, src/progress.c, src/option.c: add "auto-kill" option
        to progress dialog. Now the user can choose whether to kill parent 
        process or not (Fixes bug #310824). Patch from Diego Escalante Urrelo
        <diego@aureal.com.pe>.
Comment 11 Florian Bruhin 2009-12-07 11:53:40 UTC
Zenity is sending a SIGHUP to the parent process when cancel is pressed.
If you're forced to use an older version of Zenity where this behaviour isn't fixed. you can easely capture it using the trap command (at least when you're using bash). Example:

trap 'echo "Cancel pressed!"' SIGHUP
zenity --progress

this can be used to easely clean up stuff when cancel is pressed. If you simply want to ignore the SIGHUP you can do something like that:

trap '' SIGHUP
zenity --progress

I hope that helped,

Florian