|
Bugzilla – Full Text Bug Listing |
| Summary: | /etc/NetworkManager/dispatcher.d/netcontrol_services regex too greedy | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE 10.3 | Reporter: | Jon Nelson <jnelson-suse> |
| Component: | Network | Assignee: | Marius Tomaschewski <mt> |
| Status: | RESOLVED FIXED | QA Contact: | E-mail List <qa-bugs> |
| Severity: | Normal | ||
| Priority: | P5 - None | CC: | jnelson-suse, mt |
| Version: | Final | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Other | ||
| Whiteboard: | OU 10.3 | ||
| Found By: | Other | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
This is a sysconfig script. To clarify, the script is part of sysconfig, so it should not be assigned to gnome-maintainers. Christian: Something for you? Yes. I'll check that. Jon, would you please show me your output of iwconfig? I want to make sure that I'm not misunderstood: there are two issues here, one is that the script assumes eth0 when that is not likely to be true for most people (it should use ${1} which is the name of the wireless interface). The other issue is the sed command is invalid for some outputs of iwconfig. I don't have the example in front of me, unfortunately, because I reinstalled and don't have access to that machine for a while. However, the iwconfig source clearly can output more information on the same line as the ESSID output. See lines 177-202 of iwconfig.c wherein it prints the interface name, the ESSID (if any), and the Nickname (if any). What I would see resembles:
wifi0 ESSID:"essid value here" Nickname:"Nickname here"
Also take note that the ESSID *can* have single quotes or even double quotes in it, but that's a third issue (and IIRC already a bug ;-)
This should fix two problems:
--- scripts/netcontrol_services (Revision 1421)
+++ scripts/netcontrol_services (Arbeitskopie)
@@ -32,6 +32,6 @@
test -r ./config && . ./config
test -r scripts/functions && . scripts/functions
-E="`iwconfig eth0 2>/dev/null | sed -n 's/^.*ESSID:\"\(.*\)\"/\1/p'`"
+E="`iwconfig ${1} 2>/dev/null | sed -n 's/^.*ESSID:\"\(.*\)\".*$/\1/p'`"
info_mesg "calling 'if${2}-services ${1}${E:+-$E}'"
scripts/if${2}-services "${1}${E:+-$E}"
Joe, how can it get ESSID of an interface in an reliable way?
I'm afraid parsing iwconfig output can not be considered as reliable. What does it is intended to detect here? The configured ESSID? Or associated ESSID? The associated ESSID. Joe told me there is currently no other easy way to get ESSID. Fix from comment 6 will work as long as essid does not contain double quotes. And if it does you are lost. I can live with that, since YaST does not allow such crazy essids anyway. Fixed in svn. Will go to next beta (probably beta6) Regression in openSUSE 10.3?
Same file, slightly different problem?
In any case, I just upgraded to 10.3 and now my ifservices stuff doesn't work again. :-(
The cause:
the script /etc/NetworkManager/dispatcher.d/netcontrol_services uses this:
E="`iwconfig ${1} 2>/dev/null | sed -n 's/^.*ESSID:\"\(.*\)\".*$/\1/p'`"
When it should be using this (match ESSID:" then anything until the next double-quote):
E="`iwconfig ${1} 2>/dev/null | sed -n 's/^.*ESSID:\"\([^\"]*\)\".*$/\1/p'`"
Please fix.
Otherwise, openSUSE 10.3 is looking and feeling GREAT so far (only a few hours as yet....)
Oh well, parsing output is always @$*%)!$# ... Your patch is absolutely right. And it fits better to comment 9. Thanks a lot, Jon. Fixed in svn: --- scripts/netcontrol_services (Revision 1594) +++ scripts/netcontrol_services (Arbeitskopie) @@ -32,6 +32,6 @@ test -r ./config && . ./config test -r scripts/functions && . scripts/functions -E="`iwconfig ${1} 2>/dev/null | sed -n 's/^.*ESSID:\"\(.*\)\".*$/\1/p'`" +E="`iwconfig ${1} 2>/dev/null | sed -n 's/^.*ESSID:\"\([^\"]*\)\".*$/\1/p'`" info_mesg "calling 'if${2}-services ${1}${E:+-$E}'" scripts/if${2}-services "${1}${E:+-$E}" Curious - can this be made into an update for 10.3? Obviously this remains broken otherwise. :-( This will go to the next online update for 10.3 When will the next online update happen for sysconfig? released |
Where it says 'eth0' it should read ${1} Also, the sed command is slightly wrong in that if iwconfig output has anything /after/ the ESSID:"value here" text (on the same line) it will be mistakenly included in the essid. This was also problem for me.