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 322908 - Choosing inappropriate settings combinations in Pilot Settings->Device Settings shouldn't crash app
Choosing inappropriate settings combinations in Pilot Settings->Device Settin...
Status: VERIFIED FIXED
Product: gnome-pilot
Classification: Other
Component: gpilotd
2.0.x
Other Solaris
: High major
: ---
Assigned To: Jerry Yu
gnome-pilot Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-12-01 09:32 UTC by Jerry Yu
Modified: 2006-03-07 10:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (632 bytes, patch)
2005-12-01 09:35 UTC, Jerry Yu
none Details | Review

Description Jerry Yu 2005-12-01 09:32:18 UTC
Please describe the problem:
If you choose /dev/pilot for device and USB for Type - application will crash.
Restarting application will also lead to crash, because this setting has been
saved. Only manual editing of config file will restore application to usable state.

Steps to reproduce:



Actual results:


Expected results:


Does this happen every time?
Yes

Other information:
Version details: gnome-pilot 2.0.13
Distribution/Version: Solaris NV 24
Comment 1 Jerry Yu 2005-12-01 09:35:33 UTC
Created attachment 55466 [details] [review]
proposed patch

It works for this bug on Solaris platform
Comment 2 Matt Davey 2006-01-10 00:25:43 UTC
the proposed patch requires use of the libusb pilot-link code,
which is not as stable on linux as the visor/usbserial code
(which uses the ttyUSB* devices).

What happens during the crash?  Certainly if gpilotd is
asked to bind to a non-existent device it should be able
to report that to the user, and encourage the user to find
the correct device / permissions.  That would be a better
patch, in my opinion.
Comment 3 calvin.liu 2006-01-10 03:08:39 UTC
(In reply to comment #2)
> the proposed patch requires use of the libusb pilot-link code,
> which is not as stable on linux as the visor/usbserial code
> (which uses the ttyUSB* devices).

Hi, Matt, 
Actually we just offer one more option to users. If they won't use libusb, they still can choose to use ttyUSB*.
> 
> What happens during the crash?  Certainly if gpilotd is
> asked to bind to a non-existent device it should be able
> to report that to the user, and encourage the user to find
> the correct device / permissions.  That would be a better
> patch, in my opinion.

Suppose an opposite situation is also possible, the device was there when first time configuration, then can't be found, e.g., was removed for some reason. So definitely we will check the device/permission during configuration but it's better to have another protection after that. 
My 2 cents.
> 

Comment 4 Matt Davey 2006-01-10 11:41:06 UTC
(In reply to comment #3)
> > the proposed patch requires use of the libusb pilot-link code,
> > which is not as stable on linux as the visor/usbserial code
> > (which uses the ttyUSB* devices).

> Hi, Matt, 
> Actually we just offer one more option to users. If they won't use libusb, they
> still can choose to use ttyUSB*.

Apologies.  Looking in the capplete code I see that the return value from
check_device_settings() is never checked in gnome-pilot-ddialog.
I have a patched version in which the device dialog is not closed
unless check_device_settings() returns TRUE or the dialog is
cancelled.  This seems more logical to me.  If your patch and 
mine were both applied, then I believe your patch would prevent
the user proceeding with a USB config and a non 'libusb:' device
string.

Matt
p.s. fragment of my patch to  capplet/gnome-pilot-ddialog.c:
@@ -237,20 +249,26 @@ gnome_pilot_ddialog_run_and_close (Gnome
 {
 	GnomePilotDDialogPrivate *priv;
 	gint btn;
+	GPilotDevice tmpdev;
 	
 	priv = gpdd->priv;
 	
 	gnome_dialog_set_parent (GNOME_DIALOG (priv->dialog), parent);
-	btn = gnome_dialog_run (GNOME_DIALOG (priv->dialog));
-	
-	if (btn == 0)
-		read_device_config (GTK_OBJECT (gpdd), priv->device);
+	while(1) {
+		btn = gnome_dialog_run (GNOME_DIALOG (priv->dialog));
 	
+		if (btn == 0) {
+			read_device_config (GTK_OBJECT (gpdd), &tmpdev);
+			if(check_device_settings (&tmpdev)) {
+				*priv->device = tmpdev;
+				break;
+			}
+		} else {
+			break;
+		}
+	}
 	gnome_dialog_close (GNOME_DIALOG (priv->dialog));
 
-	if (btn == 0)
-		check_device_settings (priv->device);
-
 	return btn == 0 ? TRUE : FALSE;
 }
 
----------------------
Comment 5 Jerry Yu 2006-01-12 07:24:01 UTC
Hi,Matt
In fact, my patch here is only for Solaris and I think I should do a new patch for Linux which will include several line of  preprocessing codes such as "#ifdef SOLARIS". 
Then I think both of your patch and my new patch can be applied together, becasue "check_device_settings()" only check "if (device->type == PILOT_DEVICE_SERIAL)". My patch offers one more check "if (device->type == PILOT_DEVICE_USB_VISOR)".

In fact, Your patch here conflicts with my another patch linked below.
http://bugzilla.gnome.org/attachment.cgi?id=55465&action=view

I think they are two different solutions.
Your solution: the device dialog is not closed unless check_device_settings() returns TRUE or the dialog is cancelled. 
My solution: the device dialog is closed at first, then the dialog reappears at the same time restores the old values unless check_device_settings() returns TRUE or it is cancelled.
Comment 6 Matt Davey 2006-02-01 22:21:36 UTC
Hi Jerry,

Just to be clear: the problem I see with your patch as it stands is
that it would prevent a linux user from selecting "USB" as their device
type and using the standard visor/usbserial ttyUSBx device file.

Adding SOLARIS switches is one option, but it probably makes sense to add
a new device type for libusb so that linux users have the option of using
the faster but experimental libusb.  For the moment, I think it would be
premature to insist that all USB devices need to use "usb:" as a device name.

By the way -- the original crash that you reported is fixed in recent
pilot-link CVS.  The current behaviour is that gpilotd reports
"Unable to bind to pilot" on the console.  It doesn't pop up a window,
but doesn't crash either.
Comment 7 Matt Davey 2006-02-03 08:46:47 UTC
I'm marking this as resolved, because the original crash is not reproducible with the current codebase.  I believe it was fixed by pilot-link updates post 0.12.0pre4.
Comment 8 Jerry Yu 2006-03-07 10:23:35 UTC
Yes, the original crash is not reporducible and the current behaviour is like what Matt said. I verified it using CVS codes of gnome-pilot + pilot-link-0.12.0-pre4.
Comment 9 Matt Davey 2006-03-07 10:41:37 UTC
Thanks, Jerry.