[gpm]gpm 1.20.1-cvs bug

Petr Mladek pmladek@suse.cz
Thu, 11 Jul 2002 15:59:43 +0200


--------------Boundary-00=_J7839JVQOYMZAODEVH2R
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Thursday 11 July 2002 13:39, Peter Berg Larsen wrote:
> On Wed, 10 Jul 2002, Xiong Quanren wrote:
> > Check out the newest cvs snapshot of gpm. find following bugs:
> > 2) After fixing previous bug by myself, when using the conf/gpm-syn.c=
onf
> > in the package as my configuration file, it complained about 10 param=
eter
> > values are invalid.
>
> Are you sure it complained about values, and not option names? This wou=
ld
> happen if you used an old 1.19.6 conf file. If it is not so, I would
> like to know which ones it complained about.

I reproduced this problem and found that it exists when
gpm-syn.conf contains TABs.

Example of warrning message:
*** warning [synaptics.c(1850)]: Value (=09TRUE
) for parameter edge_motion_speed_enabled is invalid


In src/synaptics.c is this test:
[...]
              if (index ("YyTt1", token [0])) {
                *(param_data [param].addr.flag_p) =3D 1;
              } else if (index ("NnFf0", token [0])) {                   =
      =20
                *(param_data [param].addr.flag_p) =3D 0;
              } else {
                gpm_report (GPM_PR_WARN,"Value (%s) for parameter %s is=20
invalid",=20
=09=09token, param_data [param].name);                   =20
[...] =20

but token[0] contains '\t'.


I think that the best solution is to fix strtok command.
I suppose to use:
=09token =3D strtok (NULL, "[] \t\n");


Simply patch against gpm-1.20.1rc1 is attached.
It was fine also for yesterday's CVS snapshot.

--=20
With greetings,

Petr Mladek
software developer
--------------------------------------------------------------------- =20
SuSE CR, s.r.o.                             e-mail: pmladek@suse.cz
Drahobejlova 27                             tel:+420 2 9654 2373=20
190 00 Praha 9                              fax:+420 2 9654 2374  =20
Ceska republika                             http://www.suse.cz   =20

--------------Boundary-00=_J7839JVQOYMZAODEVH2R
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="gpm-1.20.1rc1-synaptics.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gpm-1.20.1rc1-synaptics.patch"

--- src/synaptics.c
+++ src/synaptics.c
@@ -1801,7 +1801,7 @@
   }else{
     while (fgets (line, 80, config)) {
       if (line [0] == '[') {
-	if ( (token = strtok (line, "[] ")) ) {
+	if ( (token = strtok (line, "[] \t\n")) ) {
 	  param = 0;
 
 	  /* which param is it */
@@ -1814,7 +1814,7 @@
 	  if (!param_data [param].name) {
 	    gpm_report (GPM_PR_WARN,"Unknown parameter %s", token);
 	  } else {
-	    token = strtok (NULL, "[] ");
+	    token = strtok (NULL, "[] \t\n");
 
 	    switch (param_data [param].p_type) {
 	    case Integer_Param:

--------------Boundary-00=_J7839JVQOYMZAODEVH2R--