Bugzilla – Attachment 220409 Details for
Bug 397322
yast crashes when editing 'localhost' hostnames
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
patch to fix the problem
network.patch (text/plain), 3.81 KB, created by
Michal Zugec
on 2008-06-05 11:49:35 UTC
(
hide
)
Description:
patch to fix the problem
Filename:
MIME Type:
Creator:
Michal Zugec
Created:
2008-06-05 11:49:35 UTC
Size:
3.81 KB
patch
obsolete
>Index: services/host.ycp >=================================================================== >--- services/host.ycp (revision 48084) >+++ services/host.ycp (working copy) >@@ -68,12 +68,25 @@ > <b>Host Aliases</b>, separated by spaces.</p> > "); > >- integer items = 0; > integer max = 0; > list<term> table_items = []; > > y2debug("hosts=%1", Host::hosts); >+ >+maplist(string host, list<string> names, (map<string, list<string> >) Host::hosts, { >+ if(size(names) < 1) { >+ y2error("Invalid host: %1, (%2)", host, names); >+ return; >+ } >+ foreach(string s, names,{ >+ list<string> row=splitstring(s, " "); >+ string aliases = mergestring(remove(row, 0), " "); >+ term item = `item(`id(size(table_items)), host, row[0]:"", aliases); >+ table_items = add(table_items, item); >+ }); >+}); > /* make ui items from the hosts list */ >+/* > maplist(string host, list<string> names, (map<string, list<string> >) Host::hosts, { > if(size(names) < 1) { > y2error("Invalid host: %1, (%2)", host, names); >@@ -87,10 +100,9 @@ > items = items + 1; > }); > }); >- >+*/ > y2debug("table_items=%1", table_items); >- y2debug("items=%1", items); >- max = items; >+ max = size(table_items); > > /* Hosts dialog contents */ > term contents = `HBox( >@@ -132,13 +144,13 @@ > Label::BackButton(), Label::OKButton()); > > UI::ChangeWidget(`id(`table), `Items, table_items); >- if(items > 0) UI::SetFocus(`id(`table)); >+ if(size(table_items) > 0) UI::SetFocus(`id(`table)); > > any ret = nil; > while(true) { > >- UI::ChangeWidget(`id(`edit), `Enabled, items > 0); >- UI::ChangeWidget(`id(`delete), `Enabled, items > 0); >+ UI::ChangeWidget(`id(`edit), `Enabled, size(table_items) > 0); >+ UI::ChangeWidget(`id(`delete), `Enabled, size(table_items) > 0); > > ret = UI::UserInput(); > y2debug("ret=%1", ret); >@@ -157,6 +169,7 @@ > term item = HostDialog(max, `empty()); > if(item == nil) > continue; >+/* > else { > Host::modified = true; > string ip = (item[1]:""); >@@ -164,11 +177,10 @@ > > Host::hosts[ip] = add(Host::hosts[ip]:[], entry); > } >- >+*/ > table_items = add(table_items, item); > UI::ChangeWidget(`id(`table), `Items, table_items); > UI::ChangeWidget(`id(`table), `CurrentItem, max); >- items = items + 1; > max = max + 1; > continue; > } >@@ -208,11 +220,13 @@ > string ip = item[1]:""; > string oldip = olditem[1]:""; > >+/* > Host::hosts[oldip] = filter(string dns, Host::hosts[oldip]:[], { > return regexpsub(dns, "([ \t]+)", " ") != regexpsub(oldentry, "([ \t]+)", " "); > }); >+*/ > y2debug("Deleting: %1 (%2)", oldip, ip); >- Host::hosts[ip] = add(Host::hosts[ip]:[], entry); >+// Host::hosts[ip] = add(Host::hosts[ip]:[], entry); > > return item; > } >@@ -241,16 +255,17 @@ > string ip = e[1]:""; > if(cur == e[0, 0]:nil) { > if(ip != "" && ip != nil) { >+/* > Host::hosts[ip] = filter(string dns, Host::hosts[ip]:[], { > return dns != entry; > }); >+*/ > return false; > } > } > return true; > }); > UI::ChangeWidget(`id(`table), `Items, table_items); >- items = size(table_items); > Host::modified = true; > continue; > } >@@ -259,6 +274,16 @@ > } > else if(ret == `next) { > /* check_ */ >+ if(Host::modified){ >+ Host::hosts=$[]; >+ foreach(term row, table_items, { >+ y2internal("%1, %2, %3", row[1]:"", row[2]:"", row[3]:""); >+ string value = mergestring([row[2]:"", row[3]:""], " "); >+ string key = row[1]:""; >+ if(!haskey(Host::hosts, key))Host::hosts[key]=[ value ]; >+ else Host::hosts[key] = add(Host::hosts[key]:[], value); >+ }); >+ } > break; > } > else { >@@ -270,6 +295,8 @@ > > y2debug("table_items=%1", table_items); > y2debug("hosts=%1", Host::hosts); >+y2internal("table_items=%1", table_items); >+y2internal("hosts=%1", Host::hosts); > > return (symbol) ret; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 397322
:
220262
|
220263
|
220264
|
220265
|
220330
| 220409