Hide Forgot
Hi, renaming binary /lib/udev/rename_device is unable to deal with comments after HWADDR=52:54:00:12:34:56 after boot, name of device is not ahoj, but system specific ens4 name it is allowed in initscripts to have comments in bash style renaming should deal with line like HWADDR=52:54:00:12:34:56 #comment here Without comment it works well. What do you think? Thanks&Regards Honza 3: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 scope global dynamic ens4 valid_lft 86372sec preferred_lft 86372sec inet6 fe80::5054:ff:fe12:3456/64 scope link valid_lft forever preferred_lft forever [root@localhost ~]# cat /etc/sysc sysconfig/ sysctl.conf sysctl.d/ [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens4 DEVICE=ahoj ONBOOT=yes BOOTPROTO=dhcp HWADDR=52:54:00:12:34:56 #comment here TYPE=Ethernet [root@localhost ~]# rpm -qa initscripts initscripts-9.49.7-1.el7.x86_64
Hi, another thing is similar, but result is much more worse. Same problem with comment in DEVICE string [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens4 DEVICE=ahoj #commet here ONBOOT=yes BOOTPROTO=dhcp HWADDR=52:54:00:12:34:56 TYPE=Ethernet result: 3: ahoj_#commet_he: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 scope global dynamic ahoj_#commet_he valid_lft 86378sec preferred_lft 86378sec inet6 fe80::5054:ff:fe12:3456/64 scope link valid_lft forever preferred_lft forever Thanks®ards Honza
I think that something like this should be sufficient: diff --git a/src/rename_device.c b/src/rename_device.c index 8e28154..bb5e6b8 100644 --- a/src/rename_device.c +++ b/src/rename_device.c @@ -120,6 +120,14 @@ int isCfg(const struct dirent *dent) { } static inline char *dequote(char *start, char *end) { + char *c; + //remove comments and trailing whitespace + c = strchr(start, '#'); + if (c!=NULL) + *c='\0'; + + g_strchomp(start); + if (end==NULL) { end=start; while(*end) end++;
This issue is not a blocker so reassigning to 7.1
https://git.fedorahosted.org/cgit/initscripts.git/commit/?h=rhel7-branch&id=7b4971bc90b9766b1f643ab5c1aba7d7b3ac5fb0
initscripts-9.49.23-1.el7 I've tried: 1. comment in HWADDR line 2. comment in DEVICE line 3. DEVICE name with hash char like "ahoj#comment"
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-0471.html