[BusyBox 0001436]: [patch] skip trailing whitespace and comments in /etc/network/interfaces

bugs at busybox.net bugs at busybox.net
Mon Feb 18 21:13:55 UTC 2008


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=1436 
====================================================================== 
Reported By:                mirabilos
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1436
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             07-20-2007 05:09 PDT
Last Modified:              02-18-2008 13:13 PST
====================================================================== 
Summary:                    [patch] skip trailing whitespace and comments in
/etc/network/interfaces
Description: 
I wrote this diff to make the parsing of /etc/network/interfaces
some less surprising to the normal user.

====================================================================== 

---------------------------------------------------------------------- 
 vda - 07-21-07 07:34  
---------------------------------------------------------------------- 
Scary. Will this work too?

while (c = *p) {
    if (c == '#') { *p = '\0'; break; }
    if (c == '"' || c == '\'') {
        while (1) {
            c2 = *++p;
            if (!c2) goto break2;
            if (c2 == c) break;
            if (c2 == '\\' && *p) p++;
        }
    }
    p++;
}
break2: 

---------------------------------------------------------------------- 
 mirabilos - 07-21-07 09:06  
---------------------------------------------------------------------- 
I don't think so, because the different kinds of quoting
require different handling. 

---------------------------------------------------------------------- 
 vda - 07-21-07 16:19  
---------------------------------------------------------------------- 
Can we PLEASE discuss patches on the mailing list?

What are quoting rules for /etc/network/interfaces? 

---------------------------------------------------------------------- 
 mirabilos - 07-23-07 03:02  
---------------------------------------------------------------------- 
About formal rules: I think you'd have to ask the Debian people,
or whoever defined the file format for /etc/network/interfaces.
I don't know, I'm just guessing, and from a shell programmer's
point of view, single quotes and double quotes behave quite dif-
ferently.

If it's just the goto that offends you, I can rewrite the code
to not use one. But you need some kind of state machine here.

About the mailing list: feel free to make up a thread and Cc:
me, I'm not subscribed to any mailing list here. 

---------------------------------------------------------------------- 
 vda - 02-18-08 13:13  
---------------------------------------------------------------------- 
I believe current svn's handling is correct:

# _in first position only_ starts a comment,
empty lines are ignored,
'\' in last position concatenates lines (needs CONFIG_DESKTOP)

This should be compatible with "standard" tools. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-20-07 05:09  mirabilos      New Issue                                    
07-20-07 05:09  mirabilos      Status                   new => assigned     
07-20-07 05:09  mirabilos      Assigned To               => BusyBox         
07-20-07 05:09  mirabilos      File Added: 970-ifupdown-whitespace.patch        
           
07-21-07 07:34  vda            Note Added: 0002614                          
07-21-07 09:06  mirabilos      Note Added: 0002621                          
07-21-07 16:19  vda            Note Added: 0002624                          
07-23-07 03:02  mirabilos      Note Added: 0002628                          
02-18-08 13:13  vda            Status                   assigned => closed  
02-18-08 13:13  vda            Note Added: 0005094                          
======================================================================




More information about the busybox-cvs mailing list