[BusyBox 0001267]: Rev ision 18018, ifstate warning printed with first time boot

bugs at busybox.net bugs at busybox.net
Fri Mar 9 22:04:19 UTC 2007


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1267 
====================================================================== 
Reported By:                espakman
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1267
Category:                   Other
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             03-09-2007 12:40 PST
Last Modified:              03-09-2007 14:04 PST
====================================================================== 
Summary:                    Rev ision 18018, ifstate warning printed with first
time boot
Description: 
Revision 18018 added the following code:

/* Read the previous state from the state file */
state_fp = fopen_or_warn("/var/run/ifstate", "r");

If the system is booted for the first time, no state file is present and
an ugly warning is printed.
====================================================================== 

---------------------------------------------------------------------- 
 vda - 03-09-07 13:08  
---------------------------------------------------------------------- 
Replace fopen_or_warn with plain fopen. Is this looks ok to you? 

---------------------------------------------------------------------- 
 espakman - 03-09-07 13:41  
---------------------------------------------------------------------- 
That works, but I'm not sure what the desired behavior should be. In Debian
the statefile is cleaned/recreated at every boot with an init.d script.

The patch (rev 18018) to read the previous statefile can be tricky, what
happens if no ifdown -a is done at reboot or halt time? The state is kept
and after booting (and no clean of the statefile with an init script) ifup
-a will think the interfaces are up. Or am I wrong? 

---------------------------------------------------------------------- 
 vda - 03-09-07 13:49  
---------------------------------------------------------------------- 
I think /var/run is supposed to be cleaned up on each boot. It contains
pidfiles and similar information, not permanent data.

As for the idea of keeping info in such a file in general, well... I find
the whole idea (design) of ifup/ifdown fragile, and therefore I personally
don't use it. Thus cannot vouch on the correctness of that change in rev
18018. 

---------------------------------------------------------------------- 
 espakman - 03-09-07 14:04  
---------------------------------------------------------------------- 
Agree. I just checked, in Debian the statefile is placed in
/etc/network/run/ instead of /var/run/. So that should be the reason why
it's explicitly cleaned there.

I think the correct fix is not to warn if the file doesn't exist so
"fopen" instead of "fopen_or_warn". 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
03-09-07 12:40  espakman       New Issue                                    
03-09-07 12:40  espakman       Status                   new => assigned     
03-09-07 12:40  espakman       Assigned To               => BusyBox         
03-09-07 13:08  vda            Note Added: 0002224                          
03-09-07 13:41  espakman       Note Added: 0002225                          
03-09-07 13:49  vda            Note Added: 0002226                          
03-09-07 14:04  espakman       Note Added: 0002227                          
======================================================================




More information about the busybox-cvs mailing list