[asterisk-bugs] [JIRA] (ASTERISK-13271) menuselect sets defaults too late

Corey Farrell (JIRA) noreply at issues.asterisk.org
Fri Mar 27 22:03:34 CDT 2015


    [ https://issues.asterisk.org/jira/browse/ASTERISK-13271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=225676#comment-225676 ] 

Corey Farrell edited comment on ASTERISK-13271 at 3/27/15 10:02 PM:
--------------------------------------------------------------------

I looked into this ticket, and I was able to verify that {{~/.asterisk.makeopts}} was ignored by {{make menuselect}}.  I believe my patch resolves this issue, it would be nice if someone could take a look.  I have not tested with {{/etc/asterisk.makeopts}}, but this patch should cover that.

menuselect.makeopts is created if not present from:
# Copy of file in $HOME if it exists
# Copy of file in /etc if it exists
# Generated defaults by menuselect

So one thought, {{~/.asterisk.makeopts}} and {{/etc/asterisk.makeopts}} do not work in any current release.  For this reason maybe we should only fix this in trunk.  Someone could have one of these files on their system left over from ages ago, it would be a problem for this to suddenly start working.


was (Author: coreyfarrell):
I looked into this ticket, and I was able to verify that {{~/.asterisk.makeopts}} was ignored by {{make menuselect}}.  I believe my patch resolves this issue, it would be nice if someone could take a look.  I have not tested with {{/etc/asterisk.makeopts}}, but this patch should cover that.

menuselect.makeopts is created if not present from:
# Copy of file in \$HOME if it exists
# Copy of file in /etc if it exists
# Generated defaults by menuselect

So one thought, {{~/.asterisk.makeopts}} and {{/etc/asterisk.makeopts}} do not work in any current release.  For this reason maybe we should only fix this in trunk.  Someone could have one of these files on their system left over from ages ago, it would be a problem for this to suddenly start working.

> menuselect sets defaults too late
> ---------------------------------
>
>                 Key: ASTERISK-13271
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-13271
>             Project: Asterisk
>          Issue Type: Bug
>          Components: Utilities/General
>            Reporter: John Nemeth
>            Severity: Minor
>         Attachments: makeopts-fix.patch
>
>
>      The main Makefile contains the following target (which is called at the start of the all target):
> {noformat}
> menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts
>         menuselect/menuselect --check-deps menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
> {noformat}
> 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:
> {code}
> ...
>  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();
> ...
> {code}
> 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.
> *ADDITIONAL INFORMATION*
>      I work around this problem by doing "make menuselect.makeopts" after running configure.  This way when "make all" runs the {{menuselect.makeopts}} target, the {{menuselect.makeopts}} file exists so it works properly.
>      Additionally, it would be nice if you could set a positive option (i.e. {{MENUSELECT_PBX=+pbx_gtkconsole}}) to always enable an option regardless of its current setting (assuming dependencies have been met).



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list