mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #910] Reduce number of tests in autoconf #512
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#512
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @magnumripper on GitHub (Dec 18, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/910
This is merely a suggestion from Solar (although I do agree). We don't have to do it but we can discuss it here.
For example, why probe for strrchr() and snprintf()? I think we don't have alternate code that wouldn't use those anyway. Why probe for bzero()? We should simply consistently use memset() instead. And so on. Can we halve the number of configure tests maybe?
@jfoug commented on GitHub (Dec 18, 2014):
We have to be careful. Note, he mentioned things like snprintf. Well, that function IS overloaded. There are others. Yes, we certainly can audit and reduce this a lot.
@magnumripper commented on GitHub (Dec 18, 2014):
I started grepping for macros and lots of them hit only in the below in jumbo.h.
We could keep these (or just the "no mingw" ones?), or we could remove them for now but keep them in a comment for easy re-adding when actually implemented.
@magnumripper commented on GitHub (Dec 18, 2014):
I think we should move all of them to a dnl comment in configure.ac until actually used.
@jfoug commented on GitHub (Dec 18, 2014):
The dnl method works for me. At least they are there when porting is needed, AND it keeps the 'bloat' out of autoconfig.h and configure which is really all that solar is worried about. Comments in the source are not that material, which is what the dnl end up being in the end.
@magnumripper commented on GitHub (Dec 18, 2014):
I'll assign this issue to myself if/when I start working on it. Please do so if you beat me to it.
@jfoug commented on GitHub (Dec 18, 2014):
Ok, I think these are the initial 'safe' ones:
dnl these extras removed for issue #910
dnl endpwent isascii mkdir rmdir atexit floor
dnl ftruncate gethostbyname gettimeofday inet_ntoa
dnl strrchr strcspn strspn strtol strtoul
The others are used. Now, some we may be able to reduce, we have these big 'blocks'. It may be that we can reduce 'some' of these, but I am not 100% sure.
fseek64 fseeko fseeko64 _fseeki64 lseek64 lseek
ftell64 ftello ftello64 _ftelli64
strcasecmp stricmp strcmpi _stricmp _strcmpi
strncasecmp strnicmp strncmpi _strnicmp _strncmpi
Solar is right about bzero. We could do that with a simple macro. The problem is when we get code from others They often will use bzero, but may not include our header. Their code builds fine, until we get to a system without it. But I guess we get that with anything.
Well, so far, I got rid of 15 more. I will test this on intel flavors, freebsd, solaris, etc and make sure no warnings (or build errors) pop up. I think the next thing we should look at is headers. We also include quite a few of those, but are not 'using' the information just yet.
@magnumripper commented on GitHub (Dec 18, 2014):
I think I saw all fseek/ftell variants being actually used
@magnumripper commented on GitHub (Dec 18, 2014):
But they probably wont check HAVE_BZERO either, so that test wont help anyway. Once we actually do anything with that macro, we can re-add the test.
@magnumripper commented on GitHub (Dec 18, 2014):
Oh, I see now we do have such macro in place. OK, but again just like we can change their code to include our header, we could just as well insert that macro in their source file.
@magnumripper commented on GitHub (Dec 18, 2014):
That's time consuming and inconclusive anyway. Better just
git grep -C1 HAVE_ENDPWENTand see that it has no hits (other than autoconfig.h.in and possibly a comment in jumbo.h), then you know. Do this for all 15 and you're 100% set.@jfoug commented on GitHub (Dec 19, 2014):
I use grep against source itself, vs git, but same end results.
How long did you stay away from your 'puter. I did for 4 hours, lol. Now I am going to work on 910 and the NEON issue.
@magnumripper commented on GitHub (Dec 19, 2014):
I think it was more than one hour but I'm not sure 😎
@jfoug commented on GitHub (Dec 19, 2014):
Check out the patch above. I am not sure we can cut down too much more than that, ATM.
@jfoug commented on GitHub (Dec 19, 2014):
We might also drop 'some' of the type size checks. Here are the current checks:
These are CURRENTLY used:
AC_CHECK_SIZEOF([short]) (SIZEOF_SHORT)
AC_CHECK_SIZEOF([int]) (SIZEOF_INT)
AC_CHECK_SIZEOF([long]) (SIZEOF_LONG)
AC_CHECK_SIZEOF([size_t]) (SIZEOF_SIZE_T
AC_CHECK_SIZEOF([off_t]) (SIZEOF_OFF_T)
These are not currently used, but I think we should still keep them (and start)
AC_CHECK_SIZEOF([long long]) (SIZEOF_LONG_LONG)
AC_CHECK_SIZEOF([int *]) (SIZEOF_INT_P)
AC_CHECK_SIZEOF([long long *]) (SIZEOF_LONG_LONG_P)
AC_CHECK_SIZEOF([void *]) (SIZEOF_VOID_P)
I would think we could safely drop these, I will add dnl to all of them.
AC_CHECK_SIZEOF([char])
AC_CHECK_SIZEOF([unsigned char])
AC_CHECK_SIZEOF([unsigned short])
AC_CHECK_SIZEOF([unsigned])
AC_CHECK_SIZEOF([unsigned int])
AC_CHECK_SIZEOF([double])
AC_CHECK_SIZEOF([long double])
@jfoug commented on GitHub (Dec 19, 2014):
We might be able to remove all of these, and simply put them into jumbo.h. BUT that means jumbo.h must be included to get the goodies, vs having them in autoconfig.h
In jumbo.h, we simply do:
#define SIZEOF_INT (sizeof(int))
That is identical to what is in autoconf.h
#define SIZEOF_INT 4
The difference here, may be in cross compiling. I think that is why they are done that way in autoconfig.h so that they are constant for a cross compile.
@jfoug commented on GitHub (Dec 19, 2014):
I think after
c93d226we have this reduced about as much as we can. There were 15 function checks removed, and 8 size checks removed. That does not sound like much, but it pretty much is everything that is NOT currently being used.@jfoug commented on GitHub (Dec 19, 2014):
I think the only thing left to reduce is the header checks.
@jfoug commented on GitHub (Dec 19, 2014):
These are the header checks not used in code at this time:
OS.h (Removed, wrapped by
__BEOS__already)limits.h (added wrappers)
locale.h (added wrappers)
stddef.h (Removed, too many to worry about right now).
stdlib.h (Removed, too many to worry about right now).
sys/param.h (added wrapper, also !_MSC_VER)
sys/timeb.h (Removed, already wrapped with Windows type wrappers, mscver, cygwin, etc)
termios.h (added wrappers)
wchar.h (Removed, it was wrapped with linux && HAVE_LIBDL)
NOTE, we might want to add wraps for some of these, if the headers are still there (I will look for those now). NOTE all other headers DO have HAVE_xxxx_H somewhere in the code (other than autoconfig.h
OK, if I add a wrapper (say to limits.h) How would I do this:
This will at least correctly build with an AC build, if limits.h is not there.
@jfoug commented on GitHub (Dec 19, 2014):
So these header probes are being removed:
OS.h
stddef.h
stdlib.h
sys/timeb.h
wchar.h
Not a huge number, but these were safe to remove.
@jfoug commented on GitHub (Dec 19, 2014):
I think this issue is done. I will leave it open a day or so, but I think we should stick a fork in it. Things that were 'removed' were simply left in configure.ac but commented out with dnl comments.
@jfoug commented on GitHub (Dec 19, 2014):
These are the commits that trim ./configure down to about bare minimum:
28c1cedc93d226d95a4ffI am closing this now. I do not think we should reduce this much more than we have done. We use the rest.
@magnumripper commented on GitHub (Dec 19, 2014):
I think you did great. Let's not overdo it. If there is a single un-needed test still there, who cares? It should be a lot faster now, even on Solar's big-endian refridgerator.