RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1027945 - /lib/udev/rename_device unable to handle HWADDR with comments
Summary: /lib/udev/rename_device unable to handle HWADDR with comments
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: initscripts
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: initscripts Maintenance Team
QA Contact: Jan Ščotka
URL:
Whiteboard:
Depends On:
Blocks: 909279
TreeView+ depends on / blocked
 
Reported: 2013-11-07 13:31 UTC by Jan Ščotka
Modified: 2016-11-25 13:07 UTC (History)
3 users (show)

Fixed In Version: initscripts-9.49.18-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 10:52:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0471 0 normal SHIPPED_LIVE initscripts bug fix and enhancement update 2015-03-05 15:18:11 UTC

Description Jan Ščotka 2013-11-07 13:31:44 UTC
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

Comment 1 Jan Ščotka 2013-11-07 13:39:18 UTC
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&regards
 Honza

Comment 3 Lukáš Nykrýn 2013-11-08 13:30:58 UTC
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++;

Comment 6 Lukáš Nykrýn 2014-03-10 15:56:09 UTC
This issue is not a blocker so reassigning to 7.1

Comment 10 Leos Pol 2015-01-13 16:45:08 UTC
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"

Comment 12 errata-xmlrpc 2015-03-05 10:52:12 UTC
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


Note You need to log in before you can comment on or make changes to this bug.