[Home]

Summary:ASTERISK-13387: compilation warning for main/editline/history
Reporter:Dmitry Andrianov (dimas)Labels:
Date Opened:2009-01-17 06:07:39.000-0600Date Closed:2009-03-02 14:29:12.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) bug14264.diff.txt
Description:While building Asterisk I noticed:

history.c: In function 'history_def_add':
history.c:352: warning: implicit declaration of function 'strlcpy'
history.c:353: warning: implicit declaration of function 'strlcat'
  [CC] hash/hash.c -> hash/hash.o

I'm not sure if it affects anything but not having warnings during compilation is definitely the Good Thing.

****** ADDITIONAL INFORMATION ******

consecutiwe makes do not display this warning even if you touch history.c. To get it again you will need:

cd main/editline/
touch history.c
make
Comments:By: James Golovich (jamesgolovich) 2009-01-19 15:20:54.000-0600

Here's a patch that gets rid of the warning.  Since asterisk is providing the strlcat and strlcpy functions we just needed to get the right header in there

By: Mark Michelson (mmichelson) 2009-01-20 16:26:46.000-0600

jamesgolovich: I think that patch is all right except that we only need to include asterisk.h if strlcpy and strlcat don't already exist on the system. From what I understand, FreeBSD, Solaris, and Mac OS X already have these functions available in system headers.

Asterisk's configure script checks for the existence of strlcpy and strlcat. HAVE_STRLCPY and HAVE_STRLCAT will be defined if the functions are already present on the system.

By: Mark Michelson (mmichelson) 2009-01-20 16:28:35.000-0600

An alternate route would be to not use these functions if HAVE_STRLCPY and HAVE_STRLCAT are not defined and instead use strncpy and strncat. You'd just have to subtract 1 from the size argument to guarantee that a null byte is written to the end of the string.

By: James Golovich (jamesgolovich) 2009-01-20 16:31:12.000-0600

Is it worth adding another ifdef check when compat.h already does it:
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t siz);
#endif

#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif

The editline lib that we use also brings their own compatibility (main/editline/np/strlcpy.c + strlcat.c) to provide these but it looks like the checks either don't exist in that configure script or they were intentionally removed since asterisk provides or own

By: Dmitry Andrianov (dimas) 2009-01-20 16:47:10.000-0600

Out curiosity - do you guys know you have three absolutely identical copies of strcompat in the source tree?

agi/strcompat.c
main/strcompat.c
utils/strcompat.c

I would really consider having single copy....

By: Digium Subversion (svnbot) 2009-03-02 14:26:42.000-0600

Repository: asterisk
Revision: 179395

U   branches/1.4/main/editline/configure
U   branches/1.4/main/editline/configure.in
U   branches/1.4/main/editline/np/unvis.c
U   branches/1.4/main/editline/sys.h

------------------------------------------------------------------------
r179395 | qwell | 2009-03-02 14:14:57 -0600 (Mon, 02 Mar 2009) | 5 lines

Remove several silly warnings in editline.  One about a broken preprocessor directive, and another about strlcpy/strlcat.

(closes issue ASTERISK-13387)
Reported by: dimas

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

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

By: Digium Subversion (svnbot) 2009-03-02 14:27:19.000-0600

Repository: asterisk
Revision: 179396

_U  trunk/
U   trunk/main/editline/configure
U   trunk/main/editline/configure.in
U   trunk/main/editline/np/unvis.c
U   trunk/main/editline/sys.h

------------------------------------------------------------------------
r179396 | qwell | 2009-03-02 14:16:51 -0600 (Mon, 02 Mar 2009) | 12 lines

Merged revisions 179395 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r179395 | qwell | 2009-03-02 14:14:57 -0600 (Mon, 02 Mar 2009) | 1 line
 
 Remove several silly warnings in editline.  One about a broken preprocessor directive, and another about strlcpy/strlcat.

 (closes issue ASTERISK-13387)
 Reported by: dimas
........

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

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

By: Digium Subversion (svnbot) 2009-03-02 14:27:49.000-0600

Repository: asterisk
Revision: 179402

_U  branches/1.6.0/
U   branches/1.6.0/main/editline/configure
U   branches/1.6.0/main/editline/configure.in
U   branches/1.6.0/main/editline/np/unvis.c
U   branches/1.6.0/main/editline/sys.h

------------------------------------------------------------------------
r179402 | qwell | 2009-03-02 14:17:55 -0600 (Mon, 02 Mar 2009) | 19 lines

Merged revisions 179396 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r179396 | qwell | 2009-03-02 14:16:51 -0600 (Mon, 02 Mar 2009) | 9 lines
 
 Merged revisions 179395 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r179395 | qwell | 2009-03-02 14:14:57 -0600 (Mon, 02 Mar 2009) | 1 line
   
   Remove several silly warnings in editline.  One about a broken preprocessor directive, and another about strlcpy/strlcat.

   (closes issue ASTERISK-13387)
   Reported by: dimas
 ........
................

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

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

By: Digium Subversion (svnbot) 2009-03-02 14:28:05.000-0600

Repository: asterisk
Revision: 179407

_U  branches/1.6.1/
U   branches/1.6.1/main/editline/configure
U   branches/1.6.1/main/editline/configure.in
U   branches/1.6.1/main/editline/np/unvis.c
U   branches/1.6.1/main/editline/sys.h

------------------------------------------------------------------------
r179407 | qwell | 2009-03-02 14:18:39 -0600 (Mon, 02 Mar 2009) | 19 lines

Merged revisions 179396 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r179396 | qwell | 2009-03-02 14:16:51 -0600 (Mon, 02 Mar 2009) | 9 lines
 
 Merged revisions 179395 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r179395 | qwell | 2009-03-02 14:14:57 -0600 (Mon, 02 Mar 2009) | 1 line
   
   Remove several silly warnings in editline.  One about a broken preprocessor directive, and another about strlcpy/strlcat.

   (closes issue ASTERISK-13387)
   Reported by: dimas
 ........
................

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

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

By: Jason Parker (jparker) 2009-03-02 14:29:12.000-0600

I didn't actually see this issue until after I had committed a fix for it.

I think this is the right way to do this, until we're ready to change how we build editline.