Opened 12 years ago
Last modified 11 years ago
#38582 new enhancement
RFE: update the configure.ac file in base to silence some warnings produced by autoscan
Reported by: | cooljeanius (Eric Gallager) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | base | Version: | 2.1.3 |
Keywords: | haspatch | Cc: | |
Port: |
Description
When running autoscan
in base, it gives the following warnings:
configure.ac: warning: missing AC_CHECK_FUNCS([dup2]) wanted by: src/machista1.0/tests/libmachista-test.c:76 configure.ac: warning: missing AC_CHECK_FUNCS([getcwd]) wanted by: src/darwintracelib1.0/darwintrace.c:403 configure.ac: warning: missing AC_CHECK_FUNCS([lchown]) wanted by: src/pextlib1.0/Pextlib.c:464 configure.ac: warning: missing AC_CHECK_FUNCS([localtime_r]) wanted by: src/programs/daemondo/main.c:128 configure.ac: warning: missing AC_CHECK_FUNCS([memmove]) wanted by: src/pextlib1.0/filemap.c:746 configure.ac: warning: missing AC_CHECK_FUNCS([mkdir]) wanted by: src/darwintracelib1.0/darwintrace.c:829 configure.ac: warning: missing AC_CHECK_FUNCS([munmap]) wanted by: src/machista1.0/libmachista.c:499 configure.ac: warning: missing AC_CHECK_FUNCS([realpath]) wanted by: src/pextlib1.0/realpath.c:67 configure.ac: warning: missing AC_CHECK_FUNCS([regcomp]) wanted by: src/pextlib1.0/strsed.c:584 configure.ac: warning: missing AC_CHECK_FUNCS([rmdir]) wanted by: src/darwintracelib1.0/darwintrace.c:859 configure.ac: warning: missing AC_CHECK_FUNCS([select]) wanted by: src/darwintracelib1.0/darwintrace.c:209 configure.ac: warning: missing AC_CHECK_FUNCS([setenv]) wanted by: src/pextlib1.0/Pextlib.c:408 configure.ac: warning: missing AC_CHECK_FUNCS([socket]) wanted by: src/darwintracelib1.0/darwintrace.c:359 configure.ac: warning: missing AC_CHECK_FUNCS([strchr]) wanted by: src/machista1.0/machista_wrap.c:1381 configure.ac: warning: missing AC_CHECK_FUNCS([strdup]) wanted by: src/cregistry/entry.c:384 configure.ac: warning: missing AC_CHECK_FUNCS([strerror]) wanted by: src/darwintracelib1.0/darwintrace.c:369 configure.ac: warning: missing AC_CHECK_FUNCS([strrchr]) wanted by: src/pextlib1.0/xinstall.c:466 configure.ac: warning: missing AC_CHECK_FUNCS([strstr]) wanted by: src/machista1.0/machista_wrap.c:1383 configure.ac: warning: missing AC_CHECK_FUNCS([strtol]) wanted by: src/pextlib1.0/Pextlib.c:205 configure.ac: warning: missing AC_CHECK_FUNCS([strtoul]) wanted by: src/machista1.0/machista_wrap.c:1820 configure.ac: warning: missing AC_CHECK_FUNCS([utime]) wanted by: src/pextlib1.0/curl.c:438 configure.ac: warning: missing AC_CHECK_HEADERS([mach/mach.h]) wanted by: src/programs/daemondo/main.c:66 configure.ac: warning: missing AC_CHECK_HEADERS([sys/ioctl.h]) wanted by: src/pextlib1.0/tty.c:41 configure.ac: warning: missing AC_CHECK_HEADERS([sys/mount.h]) wanted by: src/pextlib1.0/xinstall.c:50 configure.ac: warning: missing AC_CHECK_HEADERS([sys/param.h]) wanted by: src/darwintracelib1.0/darwintrace.c:70 configure.ac: warning: missing AC_CHECK_HEADERS([sys/time.h]) wanted by: src/pextlib1.0/sha2.c:38 configure.ac: warning: missing AC_CHECK_HEADER_STDBOOL wanted by: src/machista1.0/libmachista.c:247 configure.ac: warning: missing AC_C_INLINE wanted by: src/darwintracelib1.0/darwintrace.c:136 configure.ac: warning: missing AC_FUNC_CHOWN wanted by: src/pextlib1.0/xinstall.c:1077 configure.ac: warning: missing AC_FUNC_FORK wanted by: src/machista1.0/tests/libmachista-test.c:25 configure.ac: warning: missing AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK wanted by: src/darwintracelib1.0/darwintrace.c:721 configure.ac: warning: missing AC_FUNC_MALLOC wanted by: src/cregistry/entry.c:88 configure.ac: warning: missing AC_FUNC_MMAP wanted by: src/machista1.0/libmachista.c:469 configure.ac: warning: missing AC_FUNC_REALLOC wanted by: src/cregistry/util.c:56 configure.ac: warning: missing AC_PROG_AWK wanted by: portmgr/packaging/buildall.sh:44 configure.ac: warning: missing AC_PROG_RANLIB wanted by: src/cregistry/Makefile:5 configure.ac: warning: missing AC_TYPE_MODE_T wanted by: src/darwintracelib1.0/darwintrace.c:646 configure.ac: warning: missing AC_TYPE_OFF_T wanted by: src/pextlib1.0/flock.c:57 configure.ac: warning: missing AC_TYPE_PID_T wanted by: src/machista1.0/tests/libmachista-test.c:25 configure.ac: warning: missing AC_TYPE_SIZE_T wanted by: src/cregistry/entry.c:376 configure.ac: warning: missing AC_TYPE_SSIZE_T wanted by: src/darwintracelib1.0/darwintrace.c:687 configure.ac: warning: missing AC_TYPE_UID_T wanted by: src/pextlib1.0/Pextlib.c:464 configure.ac: warning: missing AC_TYPE_UINT32_T wanted by: src/machista1.0/hashmap.c:52 configure.ac: warning: missing AC_TYPE_UINT8_T wanted by: src/machista1.0/libmachista.c:87
I'm running the most recent autoscan
that MacPorts offers, which is:
gl00b05044:base root# autoscan --version autoscan (GNU Autoconf) 2.69 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+/Autoconf: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David J. MacKenzie and Akim Demaille.
Feel free to add as many of the missing macros as you think makes sense.
Attachments (4)
Change History (11)
comment:1 Changed 12 years ago by cooljeanius (Eric Gallager)
Changed 12 years ago by cooljeanius (Eric Gallager)
Attachment: | patch-configure.ac.diff added |
---|
patch to apply to the configure.ac file in base (after that, regenerate the build system with aclocal -I m4
, autoheader
, and autoconf
)
comment:2 Changed 12 years ago by larryv (Lawrence Velázquez)
Keywords: | haspatch added |
---|
comment:4 Changed 12 years ago by cooljeanius (Eric Gallager)
hm looks like I'll have to update this to include the changes from r104693 now... actually I should probably have done this patch against the configure.ac in trunk in the first place anyway...
comment:5 Changed 12 years ago by jmroot (Joshua Root)
There is absolutely no point adding autoconf checks for this stuff unless we have fallback code for when it's not available. And really, I doubt we care about being that portable.
comment:6 Changed 11 years ago by cooljeanius (Eric Gallager)
I don't think any of these macros can actually fail, so I don't see why they'd need fallback code. They're just for adding more information about the user's system to their config.log
and to their src/config.h
(which I guess MacPorts doesn't use, but it could do so easily...) and to the various other files that autoconf
substitutes stuff in. Also it looks like a lot of the macros currently in configure.ac
were originally added with an older version of autoscan
, this would be just updating those to a more recent version. Anyway I've edited a table into this post showing more about these macros:
Macro | line of file that autoscan mentioned it wanted it for in the latest set of warnings it produced | contents of line mentioned in previous column | context (how the line is used) | human explanation for how adding the macro will be useful (i.e. relevant comments) |
---|---|---|---|---|
AC_CHECK_FUNCS([dup2]) | src/darwintracelib1.0/darwintrace.c:1100 | int dup2(int filedes, int filedes2) { | new function declaration | /* if darwintrace has been initialized, trap attempts to dup2 over our file descriptor */ (this function would only be useful if calls are being made to dup2 in the first place, so check for it)
|
AC_CHECK_FUNCS([getcwd]) | src/darwintracelib1.0/darwintrace.c:642 | if (!getcwd(somepath, sizeof(somepath))) { | condition for an error message | In a path-sending function. Checking for getcwd would ensure that this function works.
|
AC_CHECK_FUNCS([lchown]) | src/pextlib1.0/Pextlib.c:465 | if (lchown(path, (uid_t) user, (gid_t) group) != 0) { | condition for a Tcl error | part of an overall Tcl wrapper around lchown . Checking for this function would ensure that there's actually something to have a wrapper around in the first place.
|
AC_CHECK_FUNCS([localtime_r]) | src/programs/daemondo/main.c:128 | strftime(datestring, sizeof(datestring), "%F %T", localtime_r(×tamp, &tm)); | In a log message function | // Format the date-time stamp (checking for this function would ensure that the log messages have properly formatted timestamps)
|
AC_CHECK_FUNCS([memmove]) | src/pextlib1.0/filemap.c:746 | (void) memmove( | idk really what's going on here... | /* Push the pointers after the current node lower. */ This function is just one of those good ones to check for
|
AC_CHECK_FUNCS([mkdir]) | src/darwintracelib1.0/darwintrace.c:1153 | int mkdir(const char *path, mode_t mode) { | new function declaration | /* Trap attempts to create directories outside the sandbox. */ Make sure there are calls to mkdir to trap in the first place
|
AC_CHECK_FUNCS([munmap]) | src/machista1.0/libmachista.c:499 | munmap(data, st.st_size); | at the end of a function | /* Cleanup */ Another one that's just good to check for
|
AC_CHECK_FUNCS([realpath]) | src/pextlib1.0/realpath.c:67 | res = realpath(path, rpath); | the meat of a function | Allows for Tcl to have a wrapper function around realpath . Only worth having this wrapper function if there is a function to wrap in the first place.
|
AC_CHECK_FUNCS([regcomp]) | src/pextlib1.0/strsed.c:584 | if (regcomp(&exp, from, 0) != 0){ | ifdef ed for use when HS_REGEX is defined. | Helps the strsed Pextlib function do regexes. It is already ifdef ed so the ifdef could simply be changed to if defined(HS_REGEX) && defined(HAVE_REGCOMP) instead.
|
AC_CHECK_FUNCS([rmdir]) | src/darwintracelib1.0/darwintrace.c:1183 | int rmdir(const char *path) { | new function declaration | /* Trap attempts to remove directories outside the sandbox. */ Make sure there are calls to rmdir to trap in the first place
|
AC_CHECK_FUNCS([setenv]) | src/pextlib1.0/Pextlib.c:409 | setenv("MACPORTS_DUMMY", "", 0); | Inside an #ifndef __APPLE__ for Linux environments. | /* Crashes on Linux without this. */ Seeing as this test is for Linux anyways, and Linux is easier to break than OS X is, and it is already inside an #ifndef , the condition could easily be modified to check for HAVE_SETENV as well.
|
AC_CHECK_FUNCS([socket]) | src/darwintracelib1.0/darwintrace.c:589 | if (-1 == (sock = socket(PF_LOCAL, SOCK_STREAM, 0))) { | inside the part where darwintrace sets itself up | cal says that "darwintrace embeds itself in every process executed from a portfile and connects to a unix socket created by macports when trace mode is enabled", so checking the socket function would be good just to help make sure that this will work properly.
|
AC_CHECK_FUNCS([strchr]) | src/machista1.0/machista_wrap.c:1381 | char* where = strchr(cr,':'); | I actually have no clue what is going on here; there are very few comments in this area of the code... | Even though I do not really get what this is used for here, it would still probably be a good idea to check for strchr for this anyways.
|
AC_CHECK_FUNCS([strdup]) | src/cregistry/entry.c:384 | query = strdup("SELECT id FROM registry.ports"); | In a registry searching function | /* build the query */ Checking for strdup for this would help ensure that registry-checking works properly.
|
AC_CHECK_FUNCS([strerror]) | src/macports1.0/sysctl.c:72 | Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(strerror(errno), -1)); | Used for an error that can result from checking sysctl | Checking for strerror for this could improve sysctl checking.
|
AC_CHECK_FUNCS([strrchr]) | src/darwintracelib1.0/darwintrace.c:894 | char *lastSep = strrchr(normalizedpath, '/'); | Helps check paths against the sandbox | /* walk up one directory */ Checking for strrchr for this could help with sandboxing, which currently has some issues: #39850 for example. It would also be good just to check the strrchr function anyways; it can't hurt...
|
AC_CHECK_FUNCS([strstr]) | src/machista1.0/machista_wrap.c:1383 | where = strstr(where, meth->name); | idk | I don't get this file; just check the strstr function anyways...
|
AC_CHECK_FUNCS([strtol]) | src/pextlib1.0/Pextlib.c:206 | pwent = getpwuid(strtol(user, 0, 0)); | in the ExistsuserCmd function | There is no commentary around this, but it would probably be a good idea to check for the strtol function anyways...
|
AC_CHECK_FUNCS([strtoul]) | src/machista1.0/machista_wrap.c:1820 | v = strtoul(nptr, &endptr,0); | something swiggy | /* If v is negative, then this could be a negative number, or an unsigned value which doesn't fit in a signed long, so try to get it as a string so we can distinguish these cases. */ Just check for strtoul for this anyways (and just because, as well)
|
AC_CHECK_FUNCS([utime]) | src/pextlib1.0/curl.c:438 | utime(theFilePath, ×); /* set the time we got */ | For checking curl times | Checking for utime would be good for curl , among other things
|
AC_CHECK_HEADERS([mach/mach.h]) | src/programs/daemondo/main.c:66 | #include <mach/mach.h> | an included header | daemondo does not say what it needs this header for, but I'm assuming it is something important...
|
AC_CHECK_HEADERS([netdb.h]) | src/pextlib1.0/Pextlib.c:49 | #include <netdb.h> | an included header | ? |
AC_CHECK_HEADERS([stddef.h]) | src/pextlib1.0/strlcat.c:23 | #include <stddef.h> | an included header | Just one of those headers that it's good to check for |
AC_CHECK_HEADERS([sys/ioctl.h]) | src/pextlib1.0/tty.c:41 | #include <sys/ioctl.h> | an included header | Check for this header to improve terminal support |
AC_CHECK_HEADERS([sys/mount.h]) | src/pextlib1.0/xinstall.c:50 | #include <sys/mount.h> | an included header | something useful |
AC_CHECK_HEADERS([sys/param.h]) | src/darwintracelib1.0/darwintrace.c:75 | #include <sys/param.h> | an included header | something useful |
AC_CHECK_HEADERS([sys/time.h]) | src/pextlib1.0/sha2.c:38 | #include <sys/time.h> | an included header | something useful |
AC_CHECK_HEADER_STDBOOL | src/machista1.0/libmachista.c:247 | bool universal = false; | In a mach-o parsing function | /* Parse the Mach-O header */ I do not get why autoscan says this macro is needed for this line instead of line 33 which has the actual #include <stdbool.h> on it, but whatever...
|
AC_C_INLINE | src/darwintracelib1.0/darwintrace.c:117 | static inline int __darwintrace_strbeginswith(const char *str, const char *prefix); | looks like a function prototype? | not sure why this uses inline (it looks like regular C to me), but if we're going to be using inline stuff, it'd probably be a good idea to have autoconf check how the compiler handles it... (also throw in the AC_C_PROTOTYPES macro in there while you're at it)
|
AC_C_RESTRICT | src/darwintracelib1.0/darwintrace.c:774 | static void frecv(void *restrict buf, size_t size) { | function declaration | /* Helper function to recieve a number of bytes from the tracelib communication socket and deal with any errors that might occur. */ Using restrict can be good for performance, have autoconf check how the compiler handles it to make sure
|
AC_FUNC_CHOWN | src/pextlib1.0/xinstall.c:1077 | if ((gid != (gid_t)-1 || uid != (uid_t)-1) && chown(path, uid, gid)) | in a condition | Helps build the directory "heirarchy [sic]". Plus checking how chown ing works is probably a good idea anyways.
|
AC_FUNC_FORK | src/machista1.0/tests/libmachista-test.c:25 | pid_t p = fork(); | Tests forking capabilities | "// forking helper ." If we check for fork ing characteristics with autoconf , we might not have to have a separate test file do it for us (?)
|
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK | src/darwintracelib1.0/darwintrace.c:1029 | if (lstat(path, &sb) == 0) { | condition for checking symlinks | /* for symlinks, we want to capture both the original path and the modified one, since for /usr/bin/gcc -> gcc-4.0, both "gcc_select" and "gcc" are contributors */ Checking for this with autoconf could also help with things related to #39850 and stuff...
|
AC_FUNC_MALLOC | src/cregistry/entry.c:88 | reg_entry* e = malloc(sizeof(reg_entry)); | does some sqlite3 conversion for the registry | malloc -ing is just one of those things you should be checking anyways; I'm surprised the configure script doesn't already do this...
|
AC_FUNC_MMAP | src/machista1.0/libmachista.c:469 | if ((data = mmap(NULL, st.st_size, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0)) == MAP_FAILED) { | in mach-o file parser | /* Map file into address space */ Checking how mmap works would be good for this.
|
AC_FUNC_REALLOC | src/cregistry/util.c:56 | new_dst = realloc(*dst, *dst_space * sizeof(char) + 1); | in concatenation function | Again, memory management is just one of those things you check. |
AC_PROG_AWK | portmgr/packaging/buildall.sh:44 | mysz=$(cd /; du -sk $i |awk '{print $1}') | used in making chroot disk image | MacPorts actually uses awk in a lot of places; this should probably be given a value (one that gets substituted in) in mk/macports.autoconf.mk.in and then in either src/port1.0/port_autoconf.tcl.in or src/macports1.0/macports_autoconf.tcl.in (or both), as well.
|
AC_PROG_RANLIB | src/cregistry/Makefile:5 | RANLIB = ranlib | variable definition | this should be substituted in by the configure script instead of set manually
|
AC_TYPE_MODE_T | src/darwintracelib1.0/darwintrace.c:963 | mode_t mode; | used in wrapper for the open function | /* wrapper for open(2) preventing opening files outside the sandbox */ Since it uses the mode_t type in it, this should be checked for
|
AC_TYPE_OFF_T | src/pextlib1.0/flock.c:57 | off_t curpos; | in an ifdef : #if defined(HAVE_LOCKF) && !defined(HAVE_FLOCK) | It wouldn't be too much more to ask to add another condition to this #if : just a simple && defined(HAVE_OFF_T) would do
|
AC_TYPE_PID_T | src/darwintracelib1.0/darwintrace.c:134 | static pid_t __darwintrace_pid = (pid_t) - 1; | global variable? | darwintrace (and daemondo , too, for that matter) uses pid s extensively; check to see how they work
|
AC_TYPE_SIZE_T | src/cregistry/entry.c:376 | size_t query_len, query_space; | variable type | supplements the MP_CHECK_READLINK_IS_P1003_1A macro, which defines the variable "READLINK_IS_NOT_P1003_1A " to 1 "if readlink does not conform with POSIX 1003.1a (where third argument is a size_t and return value is a ssize_t) ". Heck, instead of putting this in the main configure.ac file, you could just AC_REQUIRE it from your definition for your MP_CHECK_READLINK_IS_P1003_1A macro...
|
AC_TYPE_SSIZE_T | src/darwintracelib1.0/darwintrace.c:996 | ssize_t readlink(const char *path, char *buf, size_t bufsiz) { | variable type (used conditionally) | see note for the AC_TYPE_SIZE_T macro above
|
AC_TYPE_UID_T | src/pextlib1.0/Pextlib.c:465 | if (lchown(path, (uid_t) user, (gid_t) group) != 0) { | condition | good to check for user id types |
AC_TYPE_UINT32_T | src/darwintracelib1.0/darwintrace.c:126 | static char *__send(const char *buf, uint32_t len, int answer); | looks like another global variable definition... | Might want to AC_CHECK_SIZEOF it as well, in addition to checking for its existence...
|
AC_TYPE_UINT8_T | src/machista1.0/libmachista.c:87 | if ((((uint8_t *) address) - ((uint8_t *) input->data)) + length > input->length) { | condition | See above |
(coming back to this later...) Edit: should be done now...
(Older) Edit:
And really, I doubt we care about being that portable.
I find that odd considering the project is named MacPorts, after all... :-P
Changed 11 years ago by cooljeanius (Eric Gallager)
Attachment: | patch-missing.scan.diff added |
---|
diff between configure.scan results in OP (MacPorts 2.1.3) and current base (MacPorts 2.2.0)
Changed 11 years ago by cooljeanius (Eric Gallager)
Attachment: | patch-conservatively-configure.ac.diff added |
---|
patch against 2.2 base's configure.ac that just silences the autoscan warnings
Changed 11 years ago by cooljeanius (Eric Gallager)
Attachment: | patch-liberally-configure.ac.diff added |
---|
patch against 2.2 base's configure.ac that includes the changes from the more conservative patch, as well as other macros that I would like to include
comment:7 Changed 11 years ago by cooljeanius (Eric Gallager)
OK I should be done justifying all of these macros by now... there are new patches against the latest base release here now, too.
Attaching a patch next that fixes all of these warnings, plus also makes sure everything is quoted properly, and alphabetizes the header and function checks. (After that the "haspatch" keyword can be added)