public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* Re: [LTP] [PATCH] su01: fix the uncompleted string match
       [not found] <1364958179-5410-1-git-send-email-gaowanlong@cn.fujitsu.com>
@ 2013-04-03 11:52 ` chrubis
       [not found]   ` <515C2398.4060906@cn.fujitsu.com>
  0 siblings, 1 reply; 3+ messages in thread
From: chrubis @ 2013-04-03 11:52 UTC (permalink / raw)
  To: Wanlong Gao; +Cc: Garrett Cooper, LTP, Mike Frysinger

Hi!
> We find that sometimes "spawn /bin/su -l $USER1 -c whoami"
> may return two lines:
> "Attempting to create directory /home/su_usr2/perl5"
> "su_usr2"
> So the uncompleted "su_usr2" string match the first line,
> but we expect to match the second line here.
> So, fix it to match "su_usr2\r" instead.
> 
> Reported-by: DAN LI <li.dan@cn.fujitsu.com>
> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

Looks good. What about making it even more strict with "^$USER\r"?

>      expect {
> -				"$USER1" { set i_am_correct 1 }
> +				"$USER1\r" { set i_am_correct 1 }
>      }
>    }
>  }

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] su01: fix the uncompleted string match
       [not found]   ` <515C2398.4060906@cn.fujitsu.com>
@ 2013-04-03 12:55     ` chrubis
       [not found]       ` <515CDA27.9010309@cn.fujitsu.com>
  0 siblings, 1 reply; 3+ messages in thread
From: chrubis @ 2013-04-03 12:55 UTC (permalink / raw)
  To: Wanlong Gao; +Cc: Garrett Cooper, LTP, Mike Frysinger

Hi!
> >> We find that sometimes "spawn /bin/su -l $USER1 -c whoami"
> >> may return two lines:
> >> "Attempting to create directory /home/su_usr2/perl5"
> >> "su_usr2"
> >> So the uncompleted "su_usr2" string match the first line,
> >> but we expect to match the second line here.
> >> So, fix it to match "su_usr2\r" instead.
> >>
> >> Reported-by: DAN LI <li.dan@cn.fujitsu.com>
> >> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> > 
> > Looks good. What about making it even more strict with "^$USER\r"?
> 
> I'm afraid that "^" is not supported.

I've looked in the expect docs and the syntax for regular expressions
should be '-re "^$USER\r"' (beware not tested).

> > 
> >>      expect {
> >> -				"$USER1" { set i_am_correct 1 }
> >> +				"$USER1\r" { set i_am_correct 1 }
> >>      }
> >>    }
> >>  }
> > 
> 

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] su01: fix the uncompleted string match
       [not found]       ` <515CDA27.9010309@cn.fujitsu.com>
@ 2013-04-04  9:02         ` chrubis
  0 siblings, 0 replies; 3+ messages in thread
From: chrubis @ 2013-04-04  9:02 UTC (permalink / raw)
  To: Wanlong Gao; +Cc: Garrett Cooper, LTP, Mike Frysinger

Hi!
> > I've looked in the expect docs and the syntax for regular expressions
> > should be '-re "^$USER\r"' (beware not tested).
> 
> I tested this and saw that it can't work, because the buffer of expect
> is not line oriented, the "^" and "$" can't work well at most time.

Thanks for the testing.

Lets proceed with the original version.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-04  9:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1364958179-5410-1-git-send-email-gaowanlong@cn.fujitsu.com>
2013-04-03 11:52 ` [LTP] [PATCH] su01: fix the uncompleted string match chrubis
     [not found]   ` <515C2398.4060906@cn.fujitsu.com>
2013-04-03 12:55     ` chrubis
     [not found]       ` <515CDA27.9010309@cn.fujitsu.com>
2013-04-04  9:02         ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox