Hello community, here is the log from the commit of package linuxrc for openSUSE:Factory checked in at 2014-07-29 21:21:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/linuxrc (Old) and /work/SRC/openSUSE:Factory/.linuxrc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "linuxrc" Changes: -------- --- /work/SRC/openSUSE:Factory/linuxrc/linuxrc.changes 2014-07-26 11:28:03.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.linuxrc.new/linuxrc.changes 2014-07-29 21:21:50.000000000 +0200 @@ -1,0 +2,10 @@ +Mon Jul 28 16:39:10 CEST 2014 - snw...@suse.de + +- add missing break +- more dead code cleanup +- fix evil nameserver config bug +- make debugwait option more useful +- make log file script behave +- 5.0.6 + +------------------------------------------------------------------- Old: ---- linuxrc-5.0.5.tar.xz New: ---- linuxrc-5.0.6.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ linuxrc.spec ++++++ --- /var/tmp/diff_new_pack.VDuLqb/_old 2014-07-29 21:21:51.000000000 +0200 +++ /var/tmp/diff_new_pack.VDuLqb/_new 2014-07-29 21:21:51.000000000 +0200 @@ -25,9 +25,9 @@ Summary: SUSE Installation Program License: GPL-3.0+ Group: System/Boot -Version: 5.0.5 +Version: 5.0.6 Release: 0 -Source: linuxrc-5.0.5.tar.xz +Source: linuxrc-5.0.6.tar.xz BuildRoot: %{_tmppath}/%{name}-%{version}-build %description ++++++ linuxrc-5.0.5.tar.xz -> linuxrc-5.0.6.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.5/VERSION new/linuxrc-5.0.6/VERSION --- old/linuxrc-5.0.5/VERSION 2014-07-25 18:15:07.000000000 +0200 +++ new/linuxrc-5.0.6/VERSION 2014-07-28 16:39:01.000000000 +0200 @@ -1 +1 @@ -5.0.5 +5.0.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.5/changelog new/linuxrc-5.0.6/changelog --- old/linuxrc-5.0.5/changelog 2014-07-25 18:15:10.000000000 +0200 +++ new/linuxrc-5.0.6/changelog 2014-07-28 16:39:03.000000000 +0200 @@ -1,4 +1,13 @@ -2014-07-25: HEAD +2014-07-28: HEAD + - Merge pull request #13 from openSUSE/sw_0002 + - Sw 0002 + - add missing break + - more dead code cleanup + - fix evil nameserver config bug + - make debugwait option more useful + - make log file script behave + +2014-07-25: 5.0.5 - Merge pull request #12 from openSUSE/sw_0001 - Sw 0001 - remove more parts of old network code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.5/file.c new/linuxrc-5.0.6/file.c --- old/linuxrc-5.0.5/file.c 2014-07-25 18:13:49.000000000 +0200 +++ new/linuxrc-5.0.6/file.c 2014-07-28 16:37:52.000000000 +0200 @@ -149,7 +149,7 @@ { key_tmpfs, "_TmpFS", kf_cmd }, { key_netstop, "NetStop", kf_cfg + kf_cmd }, { key_testmode, "_TestMode", kf_cfg }, - { key_debugwait, "_DebugWait", kf_cfg + kf_cmd + kf_cmd_early }, + { key_debugwait, "DebugWait", kf_cfg + kf_cmd + kf_cmd_early }, { key_expert, "Expert", kf_cfg + kf_cmd }, /* drop it? */ { key_rescue, "Rescue", kf_cfg + kf_cmd }, { key_rootimage, "RootImage", kf_cfg + kf_cmd }, @@ -682,6 +682,7 @@ case key_nameserver: if(*f->value) str_copy(&config.ifcfg.manual->ns, f->value); + break; case key_proxy: url_free(config.url.proxy); @@ -763,7 +764,13 @@ break; case key_debugwait: - if(f->is.numeric) config.debugwait = f->nvalue; + if(f->is.numeric) { + config.debugwait = f->nvalue; + } + else if(*f->value) { + config.debugwait = 1; + slist_append_str(&config.debugwait_list, f->value); + } break; case key_manual: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.5/global.h new/linuxrc-5.0.6/global.h --- old/linuxrc-5.0.5/global.h 2014-07-25 18:13:49.000000000 +0200 +++ new/linuxrc-5.0.6/global.h 2014-07-28 16:37:52.000000000 +0200 @@ -341,6 +341,7 @@ unsigned extramount:1; /* mountpoints.extra is in use */ unsigned textmode:1; /* start yast2 in text mode */ unsigned debugwait:1; /* pop up dialogs at some critical points */ + unsigned debugwait_off:1; /* force debugwait off */ unsigned linemode:2; /* line mode */ unsigned ask_language:1; /* let use choose language */ unsigned ask_keytable:1; /* let user choose keytable */ @@ -403,6 +404,7 @@ char *dev; /* braille device */ char *type; /* braille driver */ } braille; + slist_t *debugwait_list; /* list of positions to stop at; see debugwait */ char *instsys_id; /* instsys id */ char *initrd_id; /* initrd id */ slist_t *disks; /* list of harddisk, without '/dev/' */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.5/net.c new/linuxrc-5.0.6/net.c --- old/linuxrc-5.0.5/net.c 2014-07-25 18:13:49.000000000 +0200 +++ new/linuxrc-5.0.6/net.c 2014-07-28 16:37:52.000000000 +0200 @@ -63,8 +63,8 @@ static void net_wicked_dhcp(void); static void net_cifs_build_options(char **options, char *user, char *password, char *workgroup); -static int ifcfg_write2(char *device, ifcfg_t *ifcfg, int initial); -static int ifcfg_write(char *device, ifcfg_t *ifcfg); +static int ifcfg_write(char *device, ifcfg_t *ifcfg, int initial); +static int _ifcfg_write(char *device, ifcfg_t *ifcfg); static char *inet2str(inet_t *inet, int type); static int net_get_ip(char *text, char **ip, int with_prefix); static int net_check_ip(char *buf, int multi, int with_prefix); @@ -237,7 +237,7 @@ } config.ifcfg.manual->dhcp = 0; - ifcfg_write2(config.ifcfg.manual->device, config.ifcfg.manual, 0); + ifcfg_write(config.ifcfg.manual->device, config.ifcfg.manual, 0); net_wicked_up(config.ifcfg.manual->device); @@ -1097,7 +1097,7 @@ ifcfg = calloc(1, sizeof *ifcfg); ifcfg->dhcp = 1; - ifcfg_write2(device, ifcfg, 0); + ifcfg_write(device, ifcfg, 0); free(ifcfg->type); free(ifcfg); @@ -1962,7 +1962,7 @@ // static config must be used only once if(ifcfg->used && !ifcfg->dhcp) continue; - ifcfg_write2(ifcfg->device, ifcfg, 1); + ifcfg_write(ifcfg->device, ifcfg, 1); } // 2nd, all interfaces with wildcard patterns @@ -1981,7 +1981,7 @@ matched = ifcfg->device ? match_netdevice(hd->unix_dev_name, hwaddr, ifcfg->device) : 0; - if(matched) ifcfg_write2(hd->unix_dev_name, ifcfg, 1); + if(matched) ifcfg_write(hd->unix_dev_name, ifcfg, 1); } } @@ -1997,12 +1997,18 @@ /* - * Wrapper around ifcfg_write() that does some more logging. + * Write ifcfg/ifroute files for device. + * + * May be a dhcp or static config. + * + * Wrapper around _ifcfg_write() that does some more logging. + * + * Note: 'device' is the interface name not including any vlan id. * * If initial is set, mark interface is 'initial'; that is, no further auto * config is tried on it. */ -int ifcfg_write2(char *device, ifcfg_t *ifcfg, int initial) +int ifcfg_write(char *device, ifcfg_t *ifcfg, int initial) { char *ifname = NULL; int i; @@ -2016,11 +2022,6 @@ if(ifcfg->vlan) strprintf(&ifname, "%s.%s", device, ifcfg->vlan); } - // FIXME: the next line is basically correct but shouldn't be here in this place - if(!ifname) { - str_copy(&ifname, config.net.device); - } - // if a device spec is a wildcard patterm, don't allow to overwrite an existing config if(slist_getentry(config.ifcfg.initial, ifname)) { if(ifcfg && ifcfg->pattern) { @@ -2033,7 +2034,7 @@ } } - i = ifcfg_write(device, ifcfg); + i = _ifcfg_write(device, ifcfg); if(i) { str_copy(&config.ifcfg.current, ifname); @@ -2053,30 +2054,30 @@ /* * Write ifcfg/ifroute files for device. * - * - may be a dhcp or static config - * - if global config is used we always create a ***static*** config + * May be a dhcp or static config. + * + * Note1: use ifcfg_write() instead! * - * Note: use ifcfg_write2()! + * Note2: 'device' is the verbatim interface name as used in ifcfg-* or + * ifroute-* (including vlan id) while ifcfg->device may even be a wildcard + * pattern. */ -int ifcfg_write(char *device, ifcfg_t *ifcfg) +int _ifcfg_write(char *device, ifcfg_t *ifcfg) { - char *fname, *s; + char *fname; FILE *fp, *fp2; char *gw = NULL; // allocated char *ns = NULL; // allocated char *domain = NULL; // allocated char *vlan = NULL; // allocated - int global_values = 0; int is_dhcp = 0; slist_t *sl; slist_t *sl_ifcfg = NULL; slist_t *sl_ifroute = NULL; unsigned ptp = 0; - // use global values + // obsolete: use global values if(!device || !ifcfg) { - global_values = 1; - fprintf(stderr, "\n\nXXX Old net config NOT SUPPORTED! XXX\n\n"); printf("\n\nXXX Old net config NOT SUPPORTED! XXX\n\n"); fflush(stdout); @@ -2086,26 +2087,7 @@ return 0; } - fprintf(stderr, "ifcfg_write: device = %s, global = %d, ifcfg = %s\n", device, global_values, ifcfg ? ifcfg->device : ""); - - if(global_values) { - device = config.net.device; - - if(!config.net.hostname.ok) return 0; - - // calculate prefix from netmask if missing - if( - config.net.hostname.ipv4 && - !config.net.hostname.prefix4 && - config.net.netmask.ok && - config.net.netmask.ip.s_addr - ) { - int i = netmask_to_prefix(config.net.netmask.name); - if(i >= 0) config.net.hostname.prefix4 = i; - } - } - - if(!device) return 0; + fprintf(stderr, "ifcfg_write: device = %s, ifcfg = %s\n", device, ifcfg ? ifcfg->device : ""); ptp = check_ptp(device); @@ -2113,9 +2095,9 @@ ptp |= ifcfg->ptp; - // 1. maybe dhcp config, but only if passed explicitly + // 1. maybe dhcp config - if(!global_values && ifcfg->dhcp) { + if(ifcfg->dhcp) { is_dhcp = 1; sl = slist_append_str(&sl_ifcfg, "BOOTPROTO"); @@ -2143,96 +2125,62 @@ str_copy(&sl->value, "auto"); if(!is_dhcp) { - if(global_values) { - char *ip1 = NULL, *ip2 = NULL; - - if((s = inet2str(&config.net.hostname, 4))) { - if(asprintf(&ip1, "%s/%u", s, config.net.hostname.prefix4) == -1) ip1 = NULL; - } + int i; + slist_t *sl0, *sl1; - if((s = inet2str(&config.net.hostname, 6))) { - if(asprintf(&ip2, "%s/%u", s, config.net.hostname.prefix6) == -1) ip2 = NULL; - } + str_copy(&gw, ifcfg->gw); + str_copy(&ns, ifcfg->ns); + str_copy(&domain, ifcfg->domain); + if(ifcfg->vlan) { + strprintf(&vlan, ".%s", ifcfg->vlan); + sl = slist_append_str(&sl_ifcfg, "ETHERDEVICE"); + str_copy(&sl->value, device); + } - if(ip1 && ip2) { - sl = slist_append_str(&sl_ifcfg, "IPADDR_1"); - str_copy(&sl->value, ip1); - sl = slist_append_str(&sl_ifcfg, "IPADDR_2"); - str_copy(&sl->value, ip2); + if((sl0 = slist_split(' ', ifcfg->ip))) { + if(!sl0->next) { + sl = slist_append_str(&sl_ifcfg, "IPADDR"); + str_copy(&sl->value, sl0->key); + if(ifcfg->netmask_prefix > 0 && !strchr(sl->value, '/')) { + strprintf(&sl->value, "%s/%d", sl->value, ifcfg->netmask_prefix); + } } else { - if(!ip1) { - ip1 = ip2; - ip2 = NULL; + for(i = 0, sl1 = sl0; sl1; sl1 = sl1->next) { + sl = slist_append(&sl_ifcfg, slist_new()); + strprintf(&sl->key, "IPADDR_%d", ++i); + str_copy(&sl->value, sl1->key); + if(ifcfg->netmask_prefix > 0 && !strchr(sl->value, '/')) { + strprintf(&sl->value, "%s/%d", sl->value, ifcfg->netmask_prefix); + } } - sl = slist_append_str(&sl_ifcfg, "IPADDR"); - str_copy(&sl->value, ip1); } - free(ip1); - free(ip2); - - // net_apply_ethtool() - // ETHTOOL_OPTIONS + sl0 = slist_free(sl0); } - else { - int i; - slist_t *sl0, *sl1; - str_copy(&gw, ifcfg->gw); - str_copy(&ns, ifcfg->ns); - str_copy(&domain, ifcfg->domain); - if(ifcfg->vlan) { - strprintf(&vlan, ".%s", ifcfg->vlan); - sl = slist_append_str(&sl_ifcfg, "ETHERDEVICE"); - str_copy(&sl->value, device); - } - - if((sl0 = slist_split(' ', ifcfg->ip))) { + if(ptp) { + if((sl0 = slist_split(' ', ifcfg->gw))) { if(!sl0->next) { - sl = slist_append_str(&sl_ifcfg, "IPADDR"); + sl = slist_append_str(&sl_ifcfg, "REMOTE_IPADDR"); str_copy(&sl->value, sl0->key); - if(ifcfg->netmask_prefix > 0 && !strchr(sl->value, '/')) { - strprintf(&sl->value, "%s/%d", sl->value, ifcfg->netmask_prefix); - } } else { for(i = 0, sl1 = sl0; sl1; sl1 = sl1->next) { sl = slist_append(&sl_ifcfg, slist_new()); - strprintf(&sl->key, "IPADDR_%d", ++i); + strprintf(&sl->key, "REMOTE_IPADDR_%d", ++i); str_copy(&sl->value, sl1->key); - if(ifcfg->netmask_prefix > 0 && !strchr(sl->value, '/')) { - strprintf(&sl->value, "%s/%d", sl->value, ifcfg->netmask_prefix); - } } } sl0 = slist_free(sl0); } + } - if(ptp) { - if((sl0 = slist_split(' ', ifcfg->gw))) { - if(!sl0->next) { - sl = slist_append_str(&sl_ifcfg, "REMOTE_IPADDR"); - str_copy(&sl->value, sl0->key); - } - else { - for(i = 0, sl1 = sl0; sl1; sl1 = sl1->next) { - sl = slist_append(&sl_ifcfg, slist_new()); - strprintf(&sl->key, "REMOTE_IPADDR_%d", ++i); - str_copy(&sl->value, sl1->key); - } - } - - sl0 = slist_free(sl0); - } - } - - for (sl = ifcfg->flags; sl; sl = sl->next) { - if(!(sl1 = slist_getentry(sl_ifcfg, sl->key))) sl1 = slist_append(&sl_ifcfg, slist_new()); - str_copy(&sl1->key, sl->key); - str_copy(&sl1->value, sl->value); - } + for (sl = ifcfg->flags; sl; sl = sl->next) { + if(!(sl1 = slist_getentry(sl_ifcfg, sl->key))) sl1 = slist_append(&sl_ifcfg, slist_new()); + str_copy(&sl1->key, sl->key); + str_copy(&sl1->value, sl->value); } } @@ -2257,28 +2205,15 @@ // 3. create ifroute entries if(!is_dhcp) { - if((global_values && config.net.gateway.ok) || gw) { - if(global_values) { - if((s = inet2str(&config.net.gateway, 4))) { - sl = slist_append(&sl_ifroute, slist_new()); - strprintf(&sl->key, "default %s - %s", s, device); - } + if(gw) { + slist_t *sl1, *sl0 = slist_split(' ', ifcfg->gw); - if((s = inet2str(&config.net.gateway, 6))) { - sl = slist_append(&sl_ifroute, slist_new()); - strprintf(&sl->key, "default %s - %s", s, device); - } + for(sl1 = sl0; sl1; sl1 = sl1->next) { + sl = slist_append(&sl_ifroute, slist_new()); + strprintf(&sl->key, "default %s - %s", sl1->key, device); } - else { - slist_t *sl1, *sl0 = slist_split(' ', ifcfg->gw); - - for(sl1 = sl0; sl1; sl1 = sl1->next) { - sl = slist_append(&sl_ifroute, slist_new()); - strprintf(&sl->key, "default %s - %s", sl1->key, device); - } - slist_free(sl0); - } + slist_free(sl0); } } @@ -2553,6 +2488,8 @@ sleep(1); + LXRC_WAIT + net_update_state(); str_copy(&buf, NULL); @@ -2574,6 +2511,8 @@ sleep(1); + LXRC_WAIT + net_update_state(); str_copy(&buf, NULL); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.5/util.c new/linuxrc-5.0.6/util.c --- old/linuxrc-5.0.5/util.c 2014-07-25 18:13:49.000000000 +0200 +++ new/linuxrc-5.0.6/util.c 2014-07-28 16:37:52.000000000 +0200 @@ -2423,7 +2423,7 @@ /* * copy strings, *dst points to malloc'ed memory */ -void str_copy(char **dst, char *src) +void str_copy(char **dst, const char *src) { char *s; @@ -3940,44 +3940,70 @@ } +/* + * Stop and allow to start a shell. + * + * Current code position is passed as arg. + * + * Useful for debugging. See linuxrc.debug and debug.wait options. + */ void util_wait(const char *file, int line) { - if(!config.debugwait) return; + char *pos = NULL, *s; - fprintf(stderr, "%s(%d)\n", file, line); - printf("%s(%d) ?", file, line); + if(!config.debugwait || config.debugwait_off) return; - switch(getchar()) { - case 'q': - util_umount_all(); - util_clear_downloads(); - config.debugwait = 0; - lxrc_end(); - exit(0); - break; + str_copy(&pos, file); + if((s = strrchr(pos, '.'))) *s = 0; + strprintf(&pos, "%s:%d", pos, line); - case 's': - kbd_end(0); - if(config.win) disp_cursor_on(); - if(!config.linemode) { - printf("\033c"); - if(config.utf8) printf("\033%%G"); - fflush(stdout); - } + if( + !config.debugwait_list || + slist_getentry(config.debugwait_list, pos) + ) { + fprintf(stderr, "== %s ==\n", pos); + printf("== %s ==\n(enter = next, s = shell, c = continue normally, q = quit)? ", pos); - system("PS1='\\w # ' /bin/bash 2>&1"); + switch(getchar()) { + case 'q': + util_umount_all(); + util_clear_downloads(); + config.debugwait = 0; + lxrc_end(); + exit(0); + break; - kbd_init(0); - if(config.win) { - disp_cursor_off(); - if(!config.linemode) disp_restore_screen(); - } + case 's': + kbd_end(0); + if(config.win) disp_cursor_on(); + if(!config.linemode) { + printf("\033c"); + if(config.utf8) printf("\033%%G"); + fflush(stdout); + } - default: - break; + system("PS1='\\w # ' /bin/bash 2>&1"); + + kbd_init(0); + if(config.win) { + disp_cursor_off(); + if(!config.linemode) disp_restore_screen(); + } + break; + + case 'c': + config.debugwait_off = 1; + break; + + default: + break; + } } + + str_copy(&pos, NULL); } + void util_umount_all_devices () { FILE *fd; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-5.0.5/util.h new/linuxrc-5.0.6/util.h --- old/linuxrc-5.0.5/util.h 2014-07-25 18:13:49.000000000 +0200 +++ new/linuxrc-5.0.6/util.h 2014-07-28 16:37:52.000000000 +0200 @@ -70,7 +70,7 @@ void name2inet(inet_t *inet, char *name); void s_addr2inet(inet_t *inet, unsigned long s_addr); char *inet2print(inet_t *inet); -void str_copy(char **dst, char *src); +void str_copy(char **dst, const char *src); void strprintf(char **buf, char *format, ...) __attribute__ ((format (printf, 2, 3))); char *get_instmode_name(instmode_t instmode); char *get_instmode_name_up(instmode_t instmode); -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org