[asterisk-bugs] [Asterisk 0014137]: menuselect sets defaults too late

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Jan 30 17:36:38 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14137 
====================================================================== 
Reported By:                jnemeth
Assigned To:                jpeeler
====================================================================== 
Project:                    Asterisk
Issue ID:                   14137
Category:                   Utilities/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 421 
Request Review:              
====================================================================== 
Date Submitted:             2008-12-25 05:17 CST
Last Modified:              2009-01-30 17:36 CST
====================================================================== 
Summary:                    menuselect sets defaults too late
Description: 
     The main Makefile contains the following target (which is called at
the start of the all target):

menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts
        menuselect/menuselect --check-deps menuselect.makeopts
$(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)

The purpose of this target is to allow the user to have
/etc/asterisk.makeopts and/or ~/.asterisk.makeopts to have your options set
for you (i.e. to easily set the same options when upgrading as documented
in "Build Process (module selection)" section of UPGRADE-1.4.txt; however,
it doesn't work.

     The bug is in menuselect/menuselect.c.  Its main() function contains
the following:

...
 1414   for (x = 1; x < argc; x++) {
 1415     if (!strcmp(argv[x], "--check-deps"))
 1416       check_deps = 1;
 1417     else {
 1418       res = parse_existing_config(argv[x]);
 1419       if (!res && !strcasecmp(argv[x], OUTPUT_MAKEOPTS_DEFAULT))
 1420         existing_config = 1;
 1421       res = 0;
 1422     }
 1423   }
...
 1430   if (!existing_config)
 1431     process_defaults();
 1432   else if (check_deps)
 1433     res = sanity_check();
...

The loop starting at 1414 processes the arguments to menuselect.  Starting
at 1418 it processes things that are files.  At 1419 if menuselect.makeopts
is seen and successfully processed then it sets the existing_config flag. 
The first time that the menuselect.makeopts target of the main Makefile is
called, the menuselect.makeopts file does not exist.  However, if
/etc/asterisk.makeopts or ~/.asterisk.makeopts does, then it will be
processed.  If you use a negative member to flip an option from its default
(i.e. MENUSELECT_PBX=-pbx_gtkconsole) this will happen.  However, because
the existing_config flag hasn't been set then down in line 1431 all options
will be set to their default negating the effect of the options that you
set.  menuselect will then write out a menuselect.makeopts containing all
the default options.

     If you then do "make menuselect.makeopts" a second time, it would
work because menuselect.makeopts exists so the existing_config flag gets
set.
====================================================================== 

---------------------------------------------------------------------- 
 (0099166) svnbot (reporter) - 2009-01-30 17:36
 http://bugs.digium.com/view.php?id=14137#c99166 
---------------------------------------------------------------------- 
Repository: menuselect
Revision: 465

U   branches/1.0/menuselect.c
U   branches/1.0/menuselect.h

------------------------------------------------------------------------
r465 | jpeeler | 2009-01-30 17:36:37 -0600 (Fri, 30 Jan 2009) | 6 lines

(closes issue http://bugs.digium.com/view.php?id=14137)
Reported by: jnemeth

Add the string "asterisk.makeopts" to search for valid makeopts
configuration files in the arguments provided to menuselect. Previously,
the existing_config flag was not getting set causing the defaults to load
when a menuselect.makeopts file was not present, even though a valid
/etc/asterisk.makeopts or ~/.asterisk.makeopts file existed. Technically
the use of strstr is going to allow any valid file with the string
"asterisk.makeopts" in it to work. I believe this is best though since it
avoids any hardcoded paths and the encouraged method of invoking menuselect
is through use of the menuselect makefile targets.


------------------------------------------------------------------------

http://svn.digium.com/view/menuselect?view=rev&revision=465 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-01-30 17:36 svnbot         Checkin                                      
2009-01-30 17:36 svnbot         Note Added: 0099166                          
======================================================================




More information about the asterisk-bugs mailing list