Details

    • Type: Bug Bug
    • Status: Closed
    • Severity: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Component/s: Core/PBX
    • Labels:
      None
    • SVN Revision Number:
      144419
    • Mantis ID:
      13557
    • Regression:
      No

      Description

      index is used in main/pbx.c. This breaks compilation under uclibc as it doesn't provide the index function. Replacing this with strchr, which index is an alias for, solves the problem.

                • ADDITIONAL INFORMATION ******

      Will attach a patch.

      1. pbx.c.patch
        0.4 kB
        Nick Peirson
      2. replace_bzero+bcopy.patch
        5 kB
        Nick Peirson

        Activity

        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 144569

        U trunk/apps/app_playback.c
        U trunk/channels/chan_oss.c
        U trunk/funcs/func_cut.c
        U trunk/main/pbx.c

        ------------------------------------------------------------------------
        r144569 | murf | 2008-09-25 17:11:38 -0500 (Thu, 25 Sep 2008) | 14 lines

        (closes issue ASTERISK-12776)
        Reported by: nickpeirson

        The user attached a patch, but the license is not yet
        recorded. I took the liberty of finding and replacing
        ALL index() calls with strchr() calls, and that
        involves more than just main/pbx.c;

        chan_oss, app_playback, func_cut also had calls
        to index(), and I changed them out. 1.4 had no
        references to index() at all.

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

        http://svn.digium.com/view/asterisk?view=rev&revision=144569

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 144569 U trunk/apps/app_playback.c U trunk/channels/chan_oss.c U trunk/funcs/func_cut.c U trunk/main/pbx.c ------------------------------------------------------------------------ r144569 | murf | 2008-09-25 17:11:38 -0500 (Thu, 25 Sep 2008) | 14 lines (closes issue ASTERISK-12776 ) Reported by: nickpeirson The user attached a patch, but the license is not yet recorded. I took the liberty of finding and replacing ALL index() calls with strchr() calls, and that involves more than just main/pbx.c; chan_oss, app_playback, func_cut also had calls to index(), and I changed them out. 1.4 had no references to index() at all. ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=144569
        Hide
        Nick Peirson added a comment -

        Further to the work murf did to remove index more thoroughly than my initially submitted patch, I've further identified calls to bzero and bcopy which are legacy functions and should be replaced with calls to memset and memmove respectively:

        http://www.opengroup.org/onlinepubs/000095399/functions/bzero.html
        http://www.opengroup.org/onlinepubs/000095399/functions/bcopy.html

        The latest patch changes calls from bzero, bcopy to memset, memmove.

        The alternative is to recommend uclibc users to compile uclibc with SuSv3 legacy functions and macros.

        Show
        Nick Peirson added a comment - Further to the work murf did to remove index more thoroughly than my initially submitted patch, I've further identified calls to bzero and bcopy which are legacy functions and should be replaced with calls to memset and memmove respectively: http://www.opengroup.org/onlinepubs/000095399/functions/bzero.html http://www.opengroup.org/onlinepubs/000095399/functions/bcopy.html The latest patch changes calls from bzero, bcopy to memset, memmove. The alternative is to recommend uclibc users to compile uclibc with SuSv3 legacy functions and macros.
        Hide
        Steve Murphy added a comment -

        kpfleming that tons of people are using uclibc with asterisk with much success, and it requires no mods to asterisk to do this. It sounds like you can configure
        uclibc to provide the nec. functions.... check it out and let me know. The index stuff was no big deal, but this involves a ton of changes, and it may not stop with just these 3 funcs. Let's find the "easy way", ok?

        Show
        Steve Murphy added a comment - kpfleming that tons of people are using uclibc with asterisk with much success, and it requires no mods to asterisk to do this. It sounds like you can configure uclibc to provide the nec. functions.... check it out and let me know. The index stuff was no big deal, but this involves a ton of changes, and it may not stop with just these 3 funcs. Let's find the "easy way", ok?
        Hide
        Nick Peirson added a comment -

        You can configure uclibc to provide the necessary functions, which does allow it to compile.

        The reason for proposing the patch is that the necessary functions aren't enabled by default, meaning a little research is required to figure out why it's not compiling. The proposed changes, while there are quite a few, are all one line, and are simple translations which are well documented. The recommended functions, memset and memmove, are used throughout the asterisk codebase, so it's not introducing functions that haven't previously been used. It's just a bit of hosuekeeping really.

        Either way, I'm happy that this bug report should provide a pointer to the solution for people trying to compile asterisk against uclibc, if the patch isn't accepted.

        I can split the patch into one removing bzero and one removing bcopy if that makes it easier to review?

        Show
        Nick Peirson added a comment - You can configure uclibc to provide the necessary functions, which does allow it to compile. The reason for proposing the patch is that the necessary functions aren't enabled by default, meaning a little research is required to figure out why it's not compiling. The proposed changes, while there are quite a few, are all one line, and are simple translations which are well documented. The recommended functions, memset and memmove, are used throughout the asterisk codebase, so it's not introducing functions that haven't previously been used. It's just a bit of hosuekeeping really. Either way, I'm happy that this bug report should provide a pointer to the solution for people trying to compile asterisk against uclibc, if the patch isn't accepted. I can split the patch into one removing bzero and one removing bcopy if that makes it easier to review?
        Hide
        Mark Michelson added a comment -

        Note removed. I'll leave this to murf.

        Show
        Mark Michelson added a comment - Note removed. I'll leave this to murf.
        Hide
        Steve Murphy added a comment -

        THings left to do:

        1. get the rest of the bcopy,bzero occurrences in the source:
        ./channels/console_video.c
        ./channels/console_gui.c
        ./channels/vcodecs.c
        ./main/rtp.c
        ./main/cli.c
        ./channels/chan_usbradio.c
        ./channels/chan_iax2.c
        2. bcopy and bzero will creep back into the source-- we need
        to:
        a. Make a note in the GUIDELINES
        b. put a macro for them that will generate an error into asterisk.h
        or some other worthy header file.
        3. If they are expunged from the source, then they can be removed from
        the configure script (and the .ac, etc). Why check for something
        that won't be used?

        nickpeirson-- don't worry about these items, I've already done them,
        they weren't that much work.

        Show
        Steve Murphy added a comment - THings left to do: 1. get the rest of the bcopy,bzero occurrences in the source: ./channels/console_video.c ./channels/console_gui.c ./channels/vcodecs.c ./main/rtp.c ./main/cli.c ./channels/chan_usbradio.c ./channels/chan_iax2.c 2. bcopy and bzero will creep back into the source-- we need to: a. Make a note in the GUIDELINES b. put a macro for them that will generate an error into asterisk.h or some other worthy header file. 3. If they are expunged from the source, then they can be removed from the configure script (and the .ac, etc). Why check for something that won't be used? nickpeirson-- don't worry about these items, I've already done them, they weren't that much work.
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 147807

        U trunk/channels/chan_iax2.c
        U trunk/channels/chan_oss.c
        U trunk/channels/chan_usbradio.c
        U trunk/channels/console_gui.c
        U trunk/channels/console_video.c
        U trunk/channels/vcodecs.c
        U trunk/configure
        U trunk/configure.ac
        U trunk/doc/CODING-GUIDELINES
        U trunk/include/asterisk/autoconfig.h.in
        U trunk/include/asterisk.h
        U trunk/main/astobj2.c
        U trunk/main/cli.c
        U trunk/main/config.c
        U trunk/main/pbx.c
        U trunk/main/rtp.c
        U trunk/main/translate.c
        U trunk/utils/extconf.c

        ------------------------------------------------------------------------
        r147807 | murf | 2008-10-09 09:07:20 -0500 (Thu, 09 Oct 2008) | 15 lines

        (closes issue ASTERISK-12776)
        Reported by: nickpeirson
        Patches:
        pbx.c.patch uploaded by nickpeirson (license 579)
        replace_bzero+bcopy.patch uploaded by nickpeirson (license 579)
        Tested by: nickpeirson, murf

        1. replaced all refs to bzero and bcopy to memset and memmove instead.
        2. added a note to the CODING-GUIDELINES
        3. add two macros to asterisk.h to prevent bzero, bcopy from creeping
        back into the source
        4. removed bzero from configure, configure.ac, autoconfig.h.in

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

        http://svn.digium.com/view/asterisk?view=rev&revision=147807

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 147807 U trunk/channels/chan_iax2.c U trunk/channels/chan_oss.c U trunk/channels/chan_usbradio.c U trunk/channels/console_gui.c U trunk/channels/console_video.c U trunk/channels/vcodecs.c U trunk/configure U trunk/configure.ac U trunk/doc/CODING-GUIDELINES U trunk/include/asterisk/autoconfig.h.in U trunk/include/asterisk.h U trunk/main/astobj2.c U trunk/main/cli.c U trunk/main/config.c U trunk/main/pbx.c U trunk/main/rtp.c U trunk/main/translate.c U trunk/utils/extconf.c ------------------------------------------------------------------------ r147807 | murf | 2008-10-09 09:07:20 -0500 (Thu, 09 Oct 2008) | 15 lines (closes issue ASTERISK-12776 ) Reported by: nickpeirson Patches: pbx.c.patch uploaded by nickpeirson (license 579) replace_bzero+bcopy.patch uploaded by nickpeirson (license 579) Tested by: nickpeirson, murf 1. replaced all refs to bzero and bcopy to memset and memmove instead. 2. added a note to the CODING-GUIDELINES 3. add two macros to asterisk.h to prevent bzero, bcopy from creeping back into the source 4. removed bzero from configure, configure.ac, autoconfig.h.in ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=147807

          People

          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development