diff -Nru supermin-5.1.17/aclocal.m4 supermin-5.1.18/aclocal.m4 --- supermin-5.1.17/aclocal.m4 2016-11-01 10:56:08.000000000 +0000 +++ supermin-5.1.18/aclocal.m4 2017-07-13 09:32:32.000000000 +0000 @@ -20,9 +20,9 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -dnl serial 11 (pkg-config-0.29) -dnl +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl @@ -63,7 +63,7 @@ dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29]) +[m4_define([PKG_MACROS_VERSION], [0.29.1]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ @@ -296,8 +296,76 @@ AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES + # po.m4 serial 24 (gettext-0.19) -dnl Copyright (C) 1995-2014 Free Software Foundation, Inc. +dnl Copyright (C) 1995-2014, 2016 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -786,6 +854,66 @@ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) +# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_AR([ACT-IF-FAIL]) +# ------------------------- +# Try to determine the archiver interface, and trigger the ar-lib wrapper +# if it is needed. If the detection of archiver interface fails, run +# ACT-IF-FAIL (default is to abort configure with a proper error message). +AC_DEFUN([AM_PROG_AR], +[AC_BEFORE([$0], [LT_INIT])dnl +AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([ar-lib])dnl +AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) +: ${AR=ar} + +AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], + [AC_LANG_PUSH([C]) + am_cv_ar_interface=ar + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], + [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([am_ar_try]) + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + ]) + AC_LANG_POP([C])]) + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + m4_default([$1], + [AC_MSG_ERROR([could not determine $AR interface])]) + ;; +esac +AC_SUBST([AR])dnl +]) + # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. @@ -1906,16 +2034,19 @@ m4_include([m4/fcntl_h.m4]) m4_include([m4/fdopendir.m4]) m4_include([m4/filenamecat.m4]) +m4_include([m4/flexmember.m4]) m4_include([m4/fstat.m4]) m4_include([m4/fts.m4]) m4_include([m4/getcwd.m4]) m4_include([m4/getdtablesize.m4]) +m4_include([m4/getprogname.m4]) m4_include([m4/gettimeofday.m4]) m4_include([m4/gnulib-common.m4]) m4_include([m4/gnulib-comp.m4]) m4_include([m4/i-ring.m4]) m4_include([m4/include_next.m4]) m4_include([m4/largefile.m4]) +m4_include([m4/limits-h.m4]) m4_include([m4/longlong.m4]) m4_include([m4/lstat.m4]) m4_include([m4/malloc.m4]) @@ -1939,6 +2070,7 @@ m4_include([m4/save-cwd.m4]) m4_include([m4/ssize_t.m4]) m4_include([m4/stat.m4]) +m4_include([m4/stdalign.m4]) m4_include([m4/stdbool.m4]) m4_include([m4/stddef_h.m4]) m4_include([m4/stdint.m4]) @@ -1956,3 +2088,4 @@ m4_include([m4/unistd_h.m4]) m4_include([m4/warn-on-use.m4]) m4_include([m4/wchar_t.m4]) +m4_include([m4/wint_t.m4]) diff -Nru supermin-5.1.17/ar-lib supermin-5.1.18/ar-lib --- supermin-5.1.17/ar-lib 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/ar-lib 2017-02-10 06:47:11.000000000 +0000 @@ -0,0 +1,270 @@ +#! /bin/sh +# Wrapper for Microsoft lib.exe + +me=ar-lib +scriptversion=2012-03-01.08; # UTC + +# Copyright (C) 2010-2014 Free Software Foundation, Inc. +# Written by Peter Rosin . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + + +# func_error message +func_error () +{ + echo "$me: $1" 1>&2 + exit 1 +} + +file_conv= + +# func_file_conv build_file +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv in + mingw) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_at_file at_file operation archive +# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE +# for each of them. +# When interpreting the content of the @FILE, do NOT use func_file_conv, +# since the user would need to supply preconverted file names to +# binutils ar, at least for MinGW. +func_at_file () +{ + operation=$2 + archive=$3 + at_file_contents=`cat "$1"` + eval set x "$at_file_contents" + shift + + for member + do + $AR -NOLOGO $operation:"$member" "$archive" || exit $? + done +} + +case $1 in + '') + func_error "no command. Try '$0 --help' for more information." + ;; + -h | --h*) + cat <. # # This program is free software; you can redistribute it and/or modify diff -Nru supermin-5.1.17/config.guess supermin-5.1.18/config.guess --- supermin-5.1.17/config.guess 2014-03-12 19:05:34.000000000 +0000 +++ supermin-5.1.18/config.guess 2016-02-17 14:57:44.000000000 +0000 @@ -1,10 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012, 2013 Free Software Foundation, Inc. +# Copyright 1992-2015 Free Software Foundation, Inc. -timestamp='2012-12-29' +timestamp='2015-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -26,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -52,9 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -2012, 2013 Free Software Foundation, Inc. +Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -136,6 +132,27 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -562,8 +579,9 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -809,7 +827,7 @@ *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -857,21 +875,21 @@ exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -884,59 +902,54 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -955,54 +968,63 @@ #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1235,19 +1257,31 @@ exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1338,154 +1372,6 @@ exit ;; esac -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 < header file. */ #undef HAVE_DIRENT_H @@ -211,6 +240,12 @@ /* Define to 1 if you have the 'getdtablesize' function. */ #undef HAVE_GETDTABLESIZE +/* Define to 1 if you have the 'getexecname' function. */ +#undef HAVE_GETEXECNAME + +/* Define to 1 if you have the 'getprogname' function. */ +#undef HAVE_GETPROGNAME + /* Define to 1 if you have the 'gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY @@ -220,6 +255,9 @@ /* Define if you have librpm */ #undef HAVE_LIBRPM +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + /* Define to 1 if the system has the type 'long long int'. */ #undef HAVE_LONG_LONG_INT @@ -502,6 +540,9 @@ /* Define to 1 if pwrite is declared even after undefining macros. */ #undef HAVE_RAW_DECL_PWRITE +/* Define to 1 if qsort_r is declared even after undefining macros. */ +#undef HAVE_RAW_DECL_QSORT_R + /* Define to 1 if random is declared even after undefining macros. */ #undef HAVE_RAW_DECL_RANDOM @@ -743,6 +784,9 @@ /* Define to 1 if the system has the type 'unsigned long long int'. */ #undef HAVE_UNSIGNED_LONG_LONG_INT +/* Define if you have a global __progname variable */ +#undef HAVE_VAR___PROGNAME + /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H @@ -752,6 +796,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_WINSOCK2_H +/* Define if you have the 'wint_t' type. */ +#undef HAVE_WINT_T + /* Define to 1 if O_NOATIME works. */ #undef HAVE_WORKING_O_NOATIME @@ -771,9 +818,23 @@ slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +#undef MAJOR_IN_MKDEV + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +#undef MAJOR_IN_SYSMACROS + /* Define to a substitute value for mmap()'s MAP_ANONYMOUS flag. */ #undef MAP_ANONYMOUS +/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# undef __USE_MINGW_ANSI_STDIO +#endif + + /* Define to 1 if open() fails to recognize a trailing slash. */ #undef OPEN_TRAILING_SLASH_BUG @@ -809,6 +870,9 @@ 'ptrdiff_t'. */ #undef PTRDIFF_T_SUFFIX +/* Define to 1 if gnulib's dirfd() replacement is used. */ +#undef REPLACE_DIRFD + /* Define to 1 if gnulib's fchdir() replacement is used. */ #undef REPLACE_FCHDIR @@ -848,7 +912,7 @@ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif -/* Enable general extensions on OS X. */ +/* Enable general extensions on macOS. */ #ifndef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE #endif @@ -860,6 +924,34 @@ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE @@ -930,6 +1022,12 @@ /* Define like PROTOTYPES; this can be used by system headers. */ #undef __PROTOTYPES +/* Define to 1 if the system predates C++11. */ +#undef __STDC_CONSTANT_MACROS + +/* Define to 1 if the system predates C++11. */ +#undef __STDC_LIMIT_MACROS + /* Please see the Gnulib manual for how to use these macros. Suppress extern inline with HP-UX cc, as it appears to be broken; see @@ -941,13 +1039,28 @@ 'reference to static identifier "f" in extern inline function'. This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. - Suppress the use of extern inline on problematic Apple configurations. - OS X 10.8 and earlier mishandle it; see, e.g., - . + Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) + on configurations that mistakenly use 'static inline' to implement + functions or macros in standard C headers like . For example, + if isdigit is mistakenly implemented via a static inline function, + a program containing an extern inline function that calls isdigit + may not work since the C standard prohibits extern inline functions + from calling static functions. This bug is known to occur on: + + OS X 10.8 and earlier; see: + http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html + + DragonFly; see + http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + + FreeBSD; see: + http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and for clang but remains for g++; see . - Perhaps Apple will fix this some day. */ -#if (defined __APPLE__ \ + Assume DragonFly and FreeBSD will be similar. */ +#if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ && (defined __header_inline \ ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ && ! defined __clang__) \ @@ -955,19 +1068,20 @@ && (defined __GNUC__ || defined __cplusplus)) \ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ && defined __GNUC__ && ! defined __cplusplus)))) -# define _GL_EXTERN_INLINE_APPLE_BUG +# define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ + && !defined __PGI \ && !(defined __SUNPRO_C && __STDC__))) \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) @@ -981,17 +1095,19 @@ # define _GL_EXTERN_INLINE static _GL_UNUSED #endif -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +/* In GCC 4.6 (inclusive) to 5.1 (exclusive), + suppress bogus "no previous prototype for 'FOO'" + and "no previous declaration for 'FOO'" diagnostics, + when FOO is an inline function in the header; see + and + . */ +#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ # define _GL_INLINE_HEADER_CONST_PRAGMA # else # define _GL_INLINE_HEADER_CONST_PRAGMA \ _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") # endif - /* Suppress GCC's bogus "no previous prototype for 'FOO'" - and "no previous declaration for 'FOO'" diagnostics, - when FOO is an inline function in the header; see - . */ # define _GL_INLINE_HEADER_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ @@ -1052,6 +1168,16 @@ is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED +/* gcc supports the "unused" attribute on possibly unused labels, and + g++ has since version 4.5. Note to support C++ as well as C, + _GL_UNUSED_LABEL should be used with a trailing ; */ +#if !defined __cplusplus || __GNUC__ > 4 \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define _GL_UNUSED_LABEL _GL_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + /* The __pure__ attribute was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) diff -Nru supermin-5.1.17/config.sub supermin-5.1.18/config.sub --- supermin-5.1.17/config.sub 2014-03-12 19:05:34.000000000 +0000 +++ supermin-5.1.18/config.sub 2016-02-17 14:57:44.000000000 +0000 @@ -1,10 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012, 2013 Free Software Foundation, Inc. +# Copyright 1992-2015 Free Software Foundation, Inc. -timestamp='2012-12-29' +timestamp='2015-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -27,7 +25,7 @@ # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -70,9 +68,7 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -2012, 2013 Free Software Foundation, Inc. +Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -256,19 +252,20 @@ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc \ + | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ - | fido | fr30 | frv \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ @@ -286,23 +283,26 @@ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ @@ -313,6 +313,7 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -327,7 +328,10 @@ c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -369,13 +373,13 @@ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ @@ -384,6 +388,7 @@ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ @@ -403,18 +408,22 @@ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ @@ -432,6 +441,7 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -769,6 +779,9 @@ basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -796,7 +809,7 @@ os=-mingw64 ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -824,6 +837,10 @@ basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -832,7 +849,7 @@ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i386-pc + basic_machine=i686-pc os=-msys ;; mvs) @@ -1354,7 +1371,7 @@ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ @@ -1369,14 +1386,14 @@ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1500,9 +1517,6 @@ -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; @@ -1551,6 +1565,9 @@ c4x-* | tic4x-*) os=-coff ;; + c8051-*) + os=-elf + ;; hexagon-*) os=-elf ;; diff -Nru supermin-5.1.17/configure supermin-5.1.18/configure --- supermin-5.1.17/configure 2016-11-01 10:56:08.000000000 +0000 +++ supermin-5.1.18/configure 2017-07-13 09:32:33.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for supermin 5.1.17. +# Generated by GNU Autoconf 2.69 for supermin 5.1.18. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ # Identity of this package. PACKAGE_NAME='supermin' PACKAGE_TARNAME='supermin' -PACKAGE_VERSION='5.1.17' -PACKAGE_STRING='supermin 5.1.17' +PACKAGE_VERSION='5.1.18' +PACKAGE_STRING='supermin 5.1.18' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -688,6 +688,7 @@ HAVE_UNISTD_H NEXT_AS_FIRST_DIRECTIVE_UNISTD_H NEXT_UNISTD_H +UNISTD_H_DEFINES_STRUCT_TIMESPEC PTHREAD_H_DEFINES_STRUCT_TIMESPEC SYS_TIME_H_DEFINES_STRUCT_TIMESPEC TIME_H_DEFINES_STRUCT_TIMESPEC @@ -703,6 +704,7 @@ HAVE_STRPTIME HAVE_NANOSLEEP HAVE_DECL_LOCALTIME_R +GNULIB_TIME_RZ GNULIB_TIME_R GNULIB_TIMEGM GNULIB_STRPTIME @@ -821,6 +823,9 @@ GL_GENERATE_STDINT_H_FALSE GL_GENERATE_STDINT_H_TRUE STDINT_H +HAVE_SYS_INTTYPES_H +HAVE_SYS_BITYPES_H +HAVE_C99_STDINT_H WINT_T_SUFFIX WCHAR_T_SUFFIX SIG_ATOMIC_T_SUFFIX @@ -834,8 +839,6 @@ BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_PTRDIFF_T -HAVE_SYS_BITYPES_H -HAVE_SYS_INTTYPES_H HAVE_STDINT_H NEXT_AS_FIRST_DIRECTIVE_STDINT_H NEXT_STDINT_H @@ -844,17 +847,22 @@ HAVE_WCHAR_H HAVE_UNSIGNED_LONG_LONG_INT HAVE_LONG_LONG_INT +GNULIB_OVERRIDES_WINT_T NEXT_AS_FIRST_DIRECTIVE_STDDEF_H NEXT_STDDEF_H GL_GENERATE_STDDEF_H_FALSE GL_GENERATE_STDDEF_H_TRUE STDDEF_H HAVE_WCHAR_T +HAVE_MAX_ALIGN_T REPLACE_NULL HAVE__BOOL GL_GENERATE_STDBOOL_H_FALSE GL_GENERATE_STDBOOL_H_TRUE STDBOOL_H +GL_GENERATE_STDALIGN_H_FALSE +GL_GENERATE_STDALIGN_H_TRUE +STDALIGN_H APPLE_UNIVERSAL_BUILD UNDEFINE_STRTOK_R REPLACE_STRTOK_R @@ -936,6 +944,7 @@ REPLACE_REALPATH REPLACE_REALLOC REPLACE_RANDOM_R +REPLACE_QSORT_R REPLACE_PUTENV REPLACE_PTSNAME_R REPLACE_PTSNAME @@ -959,6 +968,7 @@ HAVE_RANDOM_R HAVE_RANDOM_H HAVE_RANDOM +HAVE_QSORT_R HAVE_PTSNAME_R HAVE_PTSNAME HAVE_POSIX_OPENPT @@ -987,6 +997,7 @@ GNULIB_REALLOC_POSIX GNULIB_RANDOM_R GNULIB_RANDOM +GNULIB_QSORT_R GNULIB_PUTENV GNULIB_PTSNAME_R GNULIB_PTSNAME @@ -1005,10 +1016,16 @@ GNULIB_CALLOC_POSIX GNULIB_ATOLL GNULIB__EXIT +GL_GENERATE_LIMITS_H_FALSE +GL_GENERATE_LIMITS_H_TRUE +LIMITS_H +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H +NEXT_LIMITS_H NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H NEXT_SYS_TIME_H REPLACE_STRUCT_TIMEVAL REPLACE_GETTIMEOFDAY +HAVE_TIMEZONE_T HAVE_SYS_TIME_H HAVE_STRUCT_TIMEVAL HAVE_GETTIMEOFDAY @@ -1118,9 +1135,11 @@ REPLACE_UNLINKAT REPLACE_UNLINK REPLACE_TTYNAME_R +REPLACE_SYMLINKAT REPLACE_SYMLINK REPLACE_SLEEP REPLACE_RMDIR +REPLACE_READLINKAT REPLACE_READLINK REPLACE_READ REPLACE_PWRITE @@ -1149,6 +1168,7 @@ HAVE_DECL_GETUSERSHELL HAVE_DECL_GETPAGESIZE HAVE_DECL_GETLOGIN_R +HAVE_DECL_GETLOGIN HAVE_DECL_GETDOMAINNAME HAVE_DECL_FDATASYNC HAVE_DECL_FCHDIR @@ -1236,6 +1256,7 @@ GL_COND_LIBTOOL_TRUE RANLIB ARFLAGS +ac_ct_AR AR EGREP GREP @@ -1889,7 +1910,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures supermin 5.1.17 to adapt to many kinds of systems. +\`configure' configures supermin 5.1.18 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1959,7 +1980,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of supermin 5.1.17:";; + short | recursive ) echo "Configuration of supermin 5.1.18:";; esac cat <<\_ACEOF @@ -2068,7 +2089,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -supermin configure 5.1.17 +supermin configure 5.1.18 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2773,7 +2794,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by supermin $as_me 5.1.17, which was +It was created by supermin $as_me 5.1.18, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3068,8 +3089,11 @@ gl_func_list="$gl_func_list fstatfs" gl_header_list="$gl_header_list sys/vfs.h" gl_func_list="$gl_func_list getdtablesize" +gl_func_list="$gl_func_list getprogname" +gl_func_list="$gl_func_list getexecname" gl_header_list="$gl_header_list sys/time.h" gl_func_list="$gl_func_list gettimeofday" +gl_header_list="$gl_header_list limits.h" gl_func_list="$gl_func_list lstat" gl_header_list="$gl_header_list sys/mman.h" gl_func_list="$gl_func_list mprotect" @@ -3077,6 +3101,7 @@ gl_header_list="$gl_header_list stdint.h" gl_func_list="$gl_func_list strdup" gl_func_list="$gl_func_list pipe" +gl_header_list="$gl_header_list sys/types.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -3660,7 +3685,7 @@ # Define the identity of the package. PACKAGE='supermin' - VERSION='5.1.17' + VERSION='5.1.18' cat >>confdefs.h <<_ACEOF @@ -5355,244 +5380,6 @@ EGREP="$ac_cv_path_EGREP" - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Minix Amsterdam compiler" >&5 -$as_echo_n "checking for Minix Amsterdam compiler... " >&6; } -if ${gl_cv_c_amsterdam_compiler+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef __ACK__ -Amsterdam -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Amsterdam" >/dev/null 2>&1; then : - gl_cv_c_amsterdam_compiler=yes -else - gl_cv_c_amsterdam_compiler=no -fi -rm -f conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_amsterdam_compiler" >&5 -$as_echo "$gl_cv_c_amsterdam_compiler" >&6; } - if test -z "$AR"; then - if test $gl_cv_c_amsterdam_compiler = yes; then - AR='cc -c.a' - if test -z "$ARFLAGS"; then - ARFLAGS='-o' - fi - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AR" = x; then - AR="ar" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" -fi - - if test -z "$ARFLAGS"; then - ARFLAGS='cru' - fi - fi - else - if test -z "$ARFLAGS"; then - ARFLAGS='cru' - fi - fi - - - if test -z "$RANLIB"; then - if test $gl_cv_c_amsterdam_compiler = yes; then - RANLIB=':' - else - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - - fi - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : @@ -5785,6 +5572,20 @@ $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + $as_echo "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + $as_echo "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + $as_echo "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + $as_echo "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + $as_echo "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + $as_echo "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + $as_echo "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 @@ -5842,20 +5643,429 @@ -# Check whether --enable-largefile was given. -if test "${enable_largefile+set}" = set; then : - enableval=$enable_largefile; -fi -if test "$enable_largefile" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -$as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if ${ac_cv_sys_largefile_CC+:} false; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Minix Amsterdam compiler" >&5 +$as_echo_n "checking for Minix Amsterdam compiler... " >&6; } +if ${gl_cv_c_amsterdam_compiler+:} false; then : $as_echo_n "(cached) " >&6 else - ac_cv_sys_largefile_CC=no - if test "$GCC" != yes; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __ACK__ +Amsterdam +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Amsterdam" >/dev/null 2>&1; then : + gl_cv_c_amsterdam_compiler=yes +else + gl_cv_c_amsterdam_compiler=no +fi +rm -f conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_amsterdam_compiler" >&5 +$as_echo "$gl_cv_c_amsterdam_compiler" >&6; } + + if test $gl_cv_c_amsterdam_compiler = yes; then + if test -z "$AR"; then + AR='cc -c.a' + fi + if test -z "$ARFLAGS"; then + ARFLAGS='-o' + fi + else + if test -n "$ac_tool_prefix"; then + for ac_prog in ar lib "link -lib" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar lib "link -lib" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 +$as_echo_n "checking the archiver ($AR) interface... " >&6; } +if ${am_cv_ar_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + am_cv_ar_interface=ar + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int some_variable = 0; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=ar + else + am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 + (eval $am_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + am_cv_ar_interface=lib + else + am_cv_ar_interface=unknown + fi + fi + rm -f conftest.lib libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 +$as_echo "$am_cv_ar_interface" >&6; } + +case $am_cv_ar_interface in +ar) + ;; +lib) + # Microsoft lib, so override with the ar-lib wrapper script. + # FIXME: It is wrong to rewrite AR. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__AR in this case, + # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something + # similar. + AR="$am_aux_dir/ar-lib $AR" + ;; +unknown) + as_fn_error $? "could not determine $AR interface" "$LINENO" 5 + ;; +esac + + fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="ar" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + + if test -z "$ARFLAGS"; then + ARFLAGS='cr' + fi + + + + if test -z "$RANLIB"; then + if test $gl_cv_c_amsterdam_compiler = yes; then + RANLIB=':' + else + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + fi + fi + + +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if ${ac_cv_sys_largefile_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, @@ -6046,7 +6256,12 @@ + # Pre-early section. + + + # Code from module absolute-header: + # Code from module assure: # Code from module at-internal: # Code from module bitrotate: # Code from module chdir: @@ -6070,7 +6285,6 @@ # Code from module error: # Code from module exitfail: # Code from module extensions: - # Code from module extern-inline: # Code from module fchdir: # Code from module fcntl: @@ -6080,10 +6294,12 @@ # Code from module fdopendir: # Code from module filename: # Code from module filenamecat-lgpl: + # Code from module flexmember: # Code from module fstat: # Code from module fts: # Code from module getcwd-lgpl: # Code from module getdtablesize: + # Code from module getprogname: # Code from module gettext-h: # Code from module gettimeofday: # Code from module hash: @@ -6092,6 +6308,7 @@ # Code from module intprops: # Code from module largefile: + # Code from module limits-h: # Code from module lstat: # Code from module malloc-posix: # Code from module memchr: @@ -6117,6 +6334,7 @@ # Code from module snippet/warn-on-use: # Code from module ssize_t: # Code from module stat: + # Code from module stdalign: # Code from module stdbool: # Code from module stddef: # Code from module stdint: @@ -6387,6 +6605,7 @@ HAVE_DECL_FCHDIR=1; HAVE_DECL_FDATASYNC=1; HAVE_DECL_GETDOMAINNAME=1; + HAVE_DECL_GETLOGIN=1; HAVE_DECL_GETLOGIN_R=1; HAVE_DECL_GETPAGESIZE=1; HAVE_DECL_GETUSERSHELL=1; @@ -6415,9 +6634,11 @@ REPLACE_PWRITE=0; REPLACE_READ=0; REPLACE_READLINK=0; + REPLACE_READLINKAT=0; REPLACE_RMDIR=0; REPLACE_SLEEP=0; REPLACE_SYMLINK=0; + REPLACE_SYMLINKAT=0; REPLACE_TTYNAME_R=0; REPLACE_UNLINK=0; REPLACE_UNLINKAT=0; @@ -7793,14 +8014,15 @@ else rm -f conftest.sym conftest.file echo >conftest.file - if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; - esac + *-gnu*) + # Guess yes on glibc systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + *) + # If we don't know, assume the worst. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7810,10 +8032,12 @@ main () { struct stat sbuf; - /* Linux will dereference the symlink and fail, as required by - POSIX. That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ - return lstat ("conftest.sym/", &sbuf) == 0; + if (symlink ("conftest.file", "conftest.sym") != 0) + return 1; + /* Linux will dereference the symlink and fail, as required by + POSIX. That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; @@ -7828,11 +8052,6 @@ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - else - # If the 'ln -s' command failed, then we probably don't even - # have an lstat function. - gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" - fi rm -f conftest.sym conftest.file fi @@ -7885,6 +8104,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +# include # if HAVE_UNISTD_H # include # else /* on Windows with MSVC */ @@ -7913,6 +8133,7 @@ return 3; if (f[1] != '\0') return 4; + free (f); return 0; } #endif @@ -7973,6 +8194,29 @@ + + ac_fn_c_check_decl "$LINENO" "getdtablesize" "ac_cv_have_decl_getdtablesize" "$ac_includes_default" +if test "x$ac_cv_have_decl_getdtablesize" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETDTABLESIZE $ac_have_decl +_ACEOF + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 $as_echo_n "checking for C/C++ restrict keyword... " >&6; } if ${ac_cv_c_restrict+:} false; then : @@ -7983,17 +8227,19 @@ for ac_kw in __restrict __restrict__ _Restrict restrict; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; - } +typedef int *int_ptr; + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } + int main () { int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t) + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); + ; return 0; } @@ -8024,6 +8270,7 @@ HAVE_GETTIMEOFDAY=1; HAVE_STRUCT_TIMEVAL=1; HAVE_SYS_TIME_H=1; + HAVE_TIMEZONE_T=0; REPLACE_GETTIMEOFDAY=0; REPLACE_STRUCT_TIMEVAL=0; @@ -8243,56 +8490,191 @@ fi - for gl_func in gettimeofday; do - as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 -$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } -if eval \${$as_gl_Symbol+:} false; then : + for gl_func in gettimeofday; do + as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 +$as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } +if eval \${$as_gl_Symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if HAVE_SYS_TIME_H +# include +#endif +#include + +int +main () +{ +#undef $gl_func + (void) $gl_func; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_gl_Symbol=yes" +else + eval "$as_gl_Symbol=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$as_gl_Symbol + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 +_ACEOF + + eval ac_cv_have_decl_$gl_func=yes +fi + done + + + + + + + + + + + + + + + + + + + + + + + : + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_limits_h='<'limits.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_limits_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_limits_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'limits.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_limits_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_limits_h + gl_cv_next_limits_h='"'$gl_header'"' + else + gl_cv_next_limits_h='<'limits.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_limits_h" >&5 +$as_echo "$gl_cv_next_limits_h" >&6; } + fi + NEXT_LIMITS_H=$gl_cv_next_limits_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'limits.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_limits_h + fi + NEXT_AS_FIRST_DIRECTIVE_LIMITS_H=$gl_next_as_first_directive + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether limits.h has ULLONG_WIDTH etc." >&5 +$as_echo_n "checking whether limits.h has ULLONG_WIDTH etc.... " >&6; } +if ${gl_cv_header_limits_width+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#if HAVE_SYS_TIME_H -# include -#endif -#include - +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + int ullw = ULLONG_WIDTH; int main () { -#undef $gl_func - (void) $gl_func; + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_gl_Symbol=yes" + gl_cv_header_limits_width=yes else - eval "$as_gl_Symbol=no" + gl_cv_header_limits_width=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval ac_res=\$$as_gl_Symbol - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if eval test \"x\$"$as_gl_Symbol"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_RAW_DECL_$gl_func" | $as_tr_cpp` 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_limits_width" >&5 +$as_echo "$gl_cv_header_limits_width" >&6; } + if test "$gl_cv_header_limits_width" = yes; then + LIMITS_H= + else + LIMITS_H=limits.h + fi - eval ac_cv_have_decl_$gl_func=yes + if test -n "$LIMITS_H"; then + GL_GENERATE_LIMITS_H_TRUE= + GL_GENERATE_LIMITS_H_FALSE='#' +else + GL_GENERATE_LIMITS_H_TRUE='#' + GL_GENERATE_LIMITS_H_FALSE= fi - done - - - - - - - - @@ -8319,6 +8701,7 @@ GNULIB_PTSNAME=0; GNULIB_PTSNAME_R=0; GNULIB_PUTENV=0; + GNULIB_QSORT_R=0; GNULIB_RANDOM=0; GNULIB_RANDOM_R=0; GNULIB_REALLOC_POSIX=0; @@ -8347,6 +8730,7 @@ HAVE_POSIX_OPENPT=1; HAVE_PTSNAME=1; HAVE_PTSNAME_R=1; + HAVE_QSORT_R=1; HAVE_RANDOM=1; HAVE_RANDOM_H=1; HAVE_RANDOM_R=1; @@ -8370,6 +8754,7 @@ REPLACE_PTSNAME=0; REPLACE_PTSNAME_R=0; REPLACE_PUTENV=0; + REPLACE_QSORT_R=0; REPLACE_RANDOM_R=0; REPLACE_REALLOC=0; REPLACE_REALPATH=0; @@ -8678,6 +9063,9 @@ + + + gl_cv_c_multiarch=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8728,59 +9116,67 @@ /* end confdefs.h. */ #include - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" + + #ifdef __cplusplus + typedef bool Bool; + #else + typedef _Bool Bool; + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif #endif + #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif - struct s { _Bool s: 1; _Bool t; } s; + struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ - char f[(_Bool) 0.0 == false ? 1 : -1]; + char f[(Bool) 0.0 == false ? 1 : -1]; char g[true]; - char h[sizeof (_Bool)]; + char h[sizeof (Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ - _Bool n[m]; + Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ - _Bool q = true; - _Bool *pq = &q; + Bool q = true; + Bool *pq = &q; + bool *qq = &q; int main () { bool e = &s; - *pq |= q; - *pq |= ! q; + *pq |= q; *pq |= ! q; + *qq |= q; *qq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); + + !m + !n + !o + !p + !q + !pq + !qq); ; return 0; @@ -8808,6 +9204,7 @@ REPLACE_NULL=0; + HAVE_MAX_ALIGN_T=1; HAVE_WCHAR_T=1; @@ -8844,6 +9241,93 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wint_t" >&5 +$as_echo_n "checking for wint_t... " >&6; } +if ${gt_cv_c_wint_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include + wint_t foo = (wchar_t)'\0'; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gt_cv_c_wint_t=yes +else + gt_cv_c_wint_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wint_t" >&5 +$as_echo "$gt_cv_c_wint_t" >&6; } + if test $gt_cv_c_wint_t = yes; then + +$as_echo "#define HAVE_WINT_T 1" >>confdefs.h + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wint_t is too small" >&5 +$as_echo_n "checking whether wint_t is too small... " >&6; } +if ${gl_cv_type_wint_t_too_small+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include +# include +# include +#endif +#include + int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_type_wint_t_too_small=no +else + gl_cv_type_wint_t_too_small=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wint_t_too_small" >&5 +$as_echo "$gl_cv_type_wint_t_too_small" >&6; } + if test $gl_cv_type_wint_t_too_small = yes; then + GNULIB_OVERRIDES_WINT_T=1 + else + GNULIB_OVERRIDES_WINT_T=0 + fi + else + GNULIB_OVERRIDES_WINT_T=0 + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 $as_echo_n "checking for unsigned long long int... " >&6; } if ${ac_cv_type_unsigned_long_long_int+:} false; then : @@ -8973,6 +9457,9 @@ + + + if test $ac_cv_type_long_long_int = yes; then HAVE_LONG_LONG_INT=1 else @@ -9118,6 +9605,8 @@ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 #include /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ #if !(defined WCHAR_MIN && defined WCHAR_MAX) @@ -9208,6 +9697,15 @@ intmax_t i = INTMAX_MAX; uintmax_t j = UINTMAX_MAX; +/* Check that SIZE_MAX has the correct type, if possible. */ +#if 201112 <= __STDC_VERSION__ +int k = _Generic (SIZE_MAX, size_t: 0); +#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) +extern size_t k; +extern __typeof__ (SIZE_MAX) k; +#endif + #include /* for CHAR_BIT */ #define TYPE_MINIMUM(t) \ ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) @@ -9286,6 +9784,8 @@ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 #include @@ -9371,8 +9871,111 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdint_h" >&5 $as_echo "$gl_cv_header_working_stdint_h" >&6; } fi + + HAVE_C99_STDINT_H=0 + HAVE_SYS_BITYPES_H=0 + HAVE_SYS_INTTYPES_H=0 + STDINT_H=stdint.h if test "$gl_cv_header_working_stdint_h" = yes; then - STDINT_H= + HAVE_C99_STDINT_H=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h predates C++11" >&5 +$as_echo_n "checking whether stdint.h predates C++11... " >&6; } +if ${gl_cv_header_stdint_predates_cxx11_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_cv_header_stdint_predates_cxx11_h=yes + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include + + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + +intmax_t im = INTMAX_MAX; +int32_t i32 = INT32_C (0x7fffffff); + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_stdint_predates_cxx11_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_predates_cxx11_h" >&5 +$as_echo "$gl_cv_header_stdint_predates_cxx11_h" >&6; } + + if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then + +$as_echo "#define __STDC_CONSTANT_MACROS 1" >>confdefs.h + + +$as_echo "#define __STDC_LIMIT_MACROS 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h has UINTMAX_WIDTH etc." >&5 +$as_echo_n "checking whether stdint.h has UINTMAX_WIDTH etc.... " >&6; } +if ${gl_cv_header_stdint_width+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_cv_header_stdint_width=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 + #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + int iw = UINTMAX_WIDTH; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_stdint_width=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_width" >&5 +$as_echo "$gl_cv_header_stdint_width" >&6; } + if test "$gl_cv_header_stdint_width" = yes; then + STDINT_H= + fi else for ac_header in sys/inttypes.h sys/bitypes.h do : @@ -9389,19 +9992,12 @@ if test $ac_cv_header_sys_inttypes_h = yes; then HAVE_SYS_INTTYPES_H=1 - else - HAVE_SYS_INTTYPES_H=0 fi - if test $ac_cv_header_sys_bitypes_h = yes; then HAVE_SYS_BITYPES_H=1 - else - HAVE_SYS_BITYPES_H=0 fi - - if test $APPLE_UNIVERSAL_BUILD = 0; then @@ -9695,13 +10291,26 @@ - if test $BITSIZEOF_WINT_T -lt 32; then + if test $GNULIB_OVERRIDES_WINT_T = 1; then BITSIZEOF_WINT_T=32 fi - STDINT_H=stdint.h fi + LIMITS_H=limits.h + if test -n "$LIMITS_H"; then + GL_GENERATE_LIMITS_H_TRUE= + GL_GENERATE_LIMITS_H_FALSE='#' +else + GL_GENERATE_LIMITS_H_TRUE='#' + GL_GENERATE_LIMITS_H_FALSE= +fi + + + + + + if test -n "$STDINT_H"; then GL_GENERATE_STDINT_H_TRUE= GL_GENERATE_STDINT_H_FALSE='#' @@ -10102,6 +10711,7 @@ GNULIB_STRPTIME=0; GNULIB_TIMEGM=0; GNULIB_TIME_R=0; + GNULIB_TIME_RZ=0; HAVE_DECL_LOCALTIME_R=1; HAVE_NANOSLEEP=1; HAVE_STRPTIME=1; @@ -10153,6 +10763,7 @@ TIME_H_DEFINES_STRUCT_TIMESPEC=0 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 + UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 if test $gl_cv_sys_struct_timespec_in_time_h = yes; then TIME_H_DEFINES_STRUCT_TIMESPEC=1 else @@ -10213,6 +10824,36 @@ $as_echo "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; } if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 +$as_echo_n "checking for struct timespec in ... " >&6; } +if ${gl_cv_sys_struct_timespec_in_unistd_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +static struct timespec x; x.tv_sec = x.tv_nsec; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_sys_struct_timespec_in_unistd_h=yes +else + gl_cv_sys_struct_timespec_in_unistd_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_unistd_h" >&5 +$as_echo "$gl_cv_sys_struct_timespec_in_unistd_h" >&6; } + if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then + UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 + fi fi fi fi @@ -10231,6 +10872,7 @@ + if test $gl_cv_have_include_next = yes; then gl_cv_next_time_h='<'time.h'>' else @@ -10542,6 +11184,10 @@ fi fi + case $host_os,$HAVE_CLOSEDIR in + os2*,1) + REPLACE_CLOSEDIR=1;; + esac if test $HAVE_CLOSEDIR = 0 || test $REPLACE_CLOSEDIR = 1; then @@ -10606,6 +11252,7 @@ return 3; if (e->d_ino != st.st_ino) return 4; + closedir (dp); return 0; ; @@ -10881,15 +11528,19 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dirfd_macro" >&5 $as_echo "$gl_cv_func_dirfd_macro" >&6; } - # Use the replacement only if we have no function or macro with that name. - if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no; then - if test $ac_cv_have_decl_dirfd = yes; then - # If the system declares dirfd already, let's declare rpl_dirfd instead. + # Use the replacement if we have no function or macro with that name, + # or if OS/2 kLIBC whose dirfd() does not work. + # Replace only if the system declares dirfd already. + case $ac_cv_func_dirfd,$gl_cv_func_dirfd_macro,$host_os,$ac_cv_have_decl_dirfd in + no,no,*,yes | *,*,os2*,yes) REPLACE_DIRFD=1 - fi - fi - if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no; then +$as_echo "#define REPLACE_DIRFD 1" >>confdefs.h +;; + esac + + if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no \ + || test $REPLACE_DIRFD = 1; then @@ -11024,14 +11675,58 @@ - if test $ac_cv_func_fchdir = no; then - HAVE_FCHDIR=0 - fi + if test $ac_cv_func_fchdir = no; then + HAVE_FCHDIR=0 + fi + + if test $HAVE_FCHDIR = 0; then + REPLACE_DUP=1 + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether dup works" >&5 +$as_echo_n "checking whether dup works... " >&6; } +if ${gl_cv_func_dup_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + gl_cv_func_dup_works='guessing yes' +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include +int +main () +{ +/* On OS/2 kLIBC, dup does not work on a directory fd. */ + int fd = open (".", O_RDONLY); + return fd < 0 ? 1 : dup (fd) < 0 ? 2 : 0; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_dup_works=yes +else + gl_cv_func_dup_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + - if test $HAVE_FCHDIR = 0; then +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dup_works" >&5 +$as_echo "$gl_cv_func_dup_works" >&6; } + case "$gl_cv_func_dup_works" in + *yes) ;; + *) REPLACE_DUP=1 - fi - + ;; + esac if test $REPLACE_DUP = 1; then @@ -11081,49 +11776,78 @@ gl_cv_func_dup2_works="guessing no" ;; cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 gl_cv_func_dup2_works="guessing no" ;; - linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a - # closed fd may yield -EBADF instead of -1 / errno=EBADF. - gl_cv_func_dup2_works="guessing no" ;; - freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF. + aix* | freebsd*) + # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, + # not EBADF. gl_cv_func_dup2_works="guessing no" ;; haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. gl_cv_func_dup2_works="guessing no" ;; + *-android*) # implemented using dup3(), which fails if oldfd == newfd + gl_cv_func_dup2_works="guessing no" ;; + os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. + gl_cv_func_dup2_works="guessing no" ;; *) gl_cv_func_dup2_works="guessing yes" ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include -#include -#include + #include + #include + #include + #include + #include + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + int main () { int result = 0; -#ifdef FD_CLOEXEC - if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) - result |= 1; -#endif - if (dup2 (1, 1) == 0) - result |= 2; -#ifdef FD_CLOEXEC - if (fcntl (1, F_GETFD) != FD_CLOEXEC) - result |= 4; -#endif - close (0); - if (dup2 (0, 0) != -1) - result |= 8; - /* Many gnulib modules require POSIX conformance of EBADF. */ - if (dup2 (2, 1000000) == -1 && errno != EBADF) - result |= 16; - /* Flush out some cygwin core dumps. */ - if (dup2 (2, -1) != -1 || errno != EBADF) - result |= 32; - dup2 (2, 255); - dup2 (2, 256); - return result; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + #ifdef FD_CLOEXEC + if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) + result |= 1; + #endif + if (dup2 (1, 1) != 1) + result |= 2; + #ifdef FD_CLOEXEC + if (fcntl (1, F_GETFD) != FD_CLOEXEC) + result |= 4; + #endif + close (0); + if (dup2 (0, 0) != -1) + result |= 8; + /* Many gnulib modules require POSIX conformance of EBADF. */ + if (dup2 (2, bad_fd) == -1 && errno != EBADF) + result |= 16; + /* Flush out some cygwin core dumps. */ + if (dup2 (2, -1) != -1 || errno != EBADF) + result |= 32; + dup2 (2, 255); + dup2 (2, 256); + /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ + { + int fd = open (".", O_RDONLY); + if (fd == -1) + result |= 64; + else if (dup2 (fd, fd + 1) == -1) + result |= 128; + close (fd); + } + return result; ; return 0; } @@ -11391,26 +12115,54 @@ $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - # Guess that it works on glibc systems - case $host_os in #(( - *-gnu*) gl_cv_func_fcntl_f_dupfd_works="guessing yes";; - *) gl_cv_func_fcntl_f_dupfd_works="guessing no";; + case $host_os in + aix* | cygwin* | haiku*) + gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include #include + #include + #include + #include + #include + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif int main () { int result = 0; - if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; - if (errno != EINVAL) result |= 2; - return result; - + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; + if (errno != EINVAL) result |= 2; + if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; + if (errno != EINVAL) result |= 8; + /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ + { + int fd; + fd = open (".", O_RDONLY); + if (fd == -1) + result |= 16; + else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) + result |= 32; + + close (fd); + } + return result; ; return 0; } @@ -11848,6 +12600,50 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flexible array member" >&5 +$as_echo_n "checking for flexible array member... " >&6; } +if ${ac_cv_c_flexmember+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + struct s { int n; double d[]; }; +int +main () +{ +int m = getchar (); + size_t nbytes = offsetof (struct s, d) + m * sizeof (double); + nbytes += sizeof (struct s) - 1; + nbytes -= nbytes % sizeof (struct s); + struct s *p = malloc (nbytes); + p->d[0] = 0.0; + return p->d != (double *) NULL; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_flexmember=yes +else + ac_cv_c_flexmember=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_flexmember" >&5 +$as_echo "$ac_cv_c_flexmember" >&6; } + if test $ac_cv_c_flexmember = yes; then + +$as_echo "#define FLEXIBLE_ARRAY_MEMBER /**/" >>confdefs.h + + else + $as_echo "#define FLEXIBLE_ARRAY_MEMBER 1" >>confdefs.h + + fi + + @@ -12028,7 +12824,15 @@ - if test $ac_cv_func_getdtablesize = yes; then + + : + + + + + + if test $ac_cv_func_getdtablesize = yes && + test $ac_cv_have_decl_getdtablesize = yes; then # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit # up to an unchangeable hard limit; all other platforms correctly # require setrlimit before getdtablesize() can report a larger value. @@ -12112,6 +12916,106 @@ + : + + + + + + + + + + ac_found=0 + ac_fn_c_check_decl "$LINENO" "program_invocation_name" "ac_cv_have_decl_program_invocation_name" "#include +" +if test "x$ac_cv_have_decl_program_invocation_name" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PROGRAM_INVOCATION_NAME $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + ac_found=1 +fi + + ac_fn_c_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include +" +if test "x$ac_cv_have_decl_program_invocation_short_name" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + ac_found=1 +fi + + ac_fn_c_check_decl "$LINENO" "__argv" "ac_cv_have_decl___argv" "#include +" +if test "x$ac_cv_have_decl___argv" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___ARGV $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + ac_found=1 +fi + + + # Incur the cost of this test only if none of the above worked. + if test $ac_found = 0; then + # On OpenBSD 5.1, using the global __progname variable appears to be + # the only way to implement getprogname. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __progname is defined in default libraries" >&5 +$as_echo_n "checking whether __progname is defined in default libraries... " >&6; } +if ${gl_cv_var___progname+:} false; then : + $as_echo_n "(cached) " >&6 +else + + gl_cv_var___progname= + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern char *__progname; +int +main () +{ +return *__progname; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_var___progname=yes + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_var___progname" >&5 +$as_echo "$gl_cv_var___progname" >&6; } + if test "$gl_cv_var___progname" = yes; then + +$as_echo "#define HAVE_VAR___PROGNAME 1" >>confdefs.h + + fi + fi + + + @@ -12326,6 +13230,7 @@ + : @@ -12558,23 +13463,6 @@ - - : - - - - - - if test $ac_cv_func__set_invalid_parameter_handler = yes; then - HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 - -$as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h - - else - HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 - fi - - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then @@ -12588,8 +13476,6 @@ fi - - if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then @@ -12841,6 +13727,10 @@ fi fi + case $host_os,$HAVE_OPENDIR in + os2*,1) + REPLACE_OPENDIR=1;; + esac if test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1; then @@ -13142,6 +14032,78 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working stdalign.h" >&5 +$as_echo_n "checking for working stdalign.h... " >&6; } +if ${gl_cv_header_working_stdalign_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + + /* Test that alignof yields a result consistent with offsetof. + This catches GCC bug 52023 + . */ + #ifdef __cplusplus + template struct alignof_helper { char a; t b; }; + # define ao(type) offsetof (alignof_helper, b) + #else + # define ao(type) offsetof (struct { char a; type b; }, b) + #endif + char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1]; + char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; + char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; + + /* Test _Alignas only on platforms where gnulib can help. */ + #if \ + ((defined __cplusplus && 201103 <= __cplusplus) \ + || (defined __APPLE__ && defined __MACH__ \ + ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + : __GNUC__) \ + || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \ + || __ICC || 0x5110 <= __SUNPRO_C \ + || 1300 <= _MSC_VER) + struct alignas_test { char c; char alignas (8) alignas_8; }; + char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 + ? 1 : -1]; + #endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_working_stdalign_h=yes +else + gl_cv_header_working_stdalign_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdalign_h" >&5 +$as_echo "$gl_cv_header_working_stdalign_h" >&6; } + + if test $gl_cv_header_working_stdalign_h = yes; then + STDALIGN_H='' + else + STDALIGN_H='stdalign.h' + fi + + + if test -n "$STDALIGN_H"; then + GL_GENERATE_STDALIGN_H_TRUE= + GL_GENERATE_STDALIGN_H_FALSE='#' +else + GL_GENERATE_STDALIGN_H_TRUE='#' + GL_GENERATE_STDALIGN_H_FALSE= +fi + + + # Define two additional variables used in the Makefile substitution. @@ -13172,6 +14134,15 @@ STDDEF_H= + ac_fn_c_check_type "$LINENO" "max_align_t" "ac_cv_type_max_align_t" "#include + +" +if test "x$ac_cv_type_max_align_t" = xyes; then : + +else + HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h +fi + if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h @@ -13293,6 +14264,9 @@ + $as_echo "#define __USE_MINGW_ANSI_STDIO 1" >>confdefs.h + + @@ -13365,6 +14339,48 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which flavor of printf attribute matches inttypes macros" >&5 +$as_echo_n "checking which flavor of printf attribute matches inttypes macros... " >&6; } +if ${gl_cv_func_printf_attribute_flavor+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define __STDC_FORMAT_MACROS 1 + #include + #include + /* For non-mingw systems, compilation will trivially succeed. + For mingw, compilation will succeed for older mingw (system + printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */ + #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1]; + #endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_func_printf_attribute_flavor=system +else + gl_cv_func_printf_attribute_flavor=gnu +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_attribute_flavor" >&5 +$as_echo "$gl_cv_func_printf_attribute_flavor" >&6; } + if test "$gl_cv_func_printf_attribute_flavor" = gnu; then + +$as_echo "#define GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 1" >>confdefs.h + + fi + GNULIB_FSCANF=1 @@ -13517,7 +14533,7 @@ - for gl_func in _Exit atoll canonicalize_file_name getloadavg getsubopt grantpt initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt ptsname ptsname_r random random_r realpath rpmatch secure_getenv setenv setstate setstate_r srandom srandom_r strtod strtoll strtoull unlockpt unsetenv; do + for gl_func in _Exit atoll canonicalize_file_name getloadavg getsubopt grantpt initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps posix_openpt ptsname ptsname_r qsort_r random random_r realpath rpmatch secure_getenv setenv setstate setstate_r srandom srandom_r strtod strtoll strtoull unlockpt unsetenv; do as_gl_Symbol=`$as_echo "gl_cv_have_raw_decl_$gl_func" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gl_func is declared without a macro" >&5 $as_echo_n "checking whether $gl_func is declared without a macro... " >&6; } @@ -14329,6 +15345,38 @@ + + + + + : + + + + + +ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : + +$as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h + +fi + + +if test $ac_cv_header_sys_mkdev_h = no; then + ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : + +$as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h + +fi + + +fi + + + + # Define $(SED). { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 @@ -15577,7 +16625,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: perldoc not found - install perl to make man pages" >&5 $as_echo "$as_me: WARNING: perldoc not found - install perl to make man pages" >&2;} fi - if test "$perldoc" != "no"; then + if test "x$PERLDOC" != "xno"; then HAVE_PERLDOC_TRUE= HAVE_PERLDOC_FALSE='#' else @@ -16085,7 +17133,8 @@ ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +as_dummy="/usr/bin:/bin" +for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -16126,7 +17175,8 @@ ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +as_dummy="/usr/bin:/bin" +for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -16167,7 +17217,8 @@ ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +as_dummy="/usr/bin:/bin" +for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -16208,7 +17259,8 @@ ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH +as_dummy="/usr/bin:/bin" +for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. @@ -17044,6 +18096,14 @@ as_fn_error $? "conditional \"GL_GENERATE_ERRNO_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_STDALIGN_H_TRUE}" && test -z "${GL_GENERATE_STDALIGN_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_STDALIGN_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${GL_GENERATE_STDBOOL_H_TRUE}" && test -z "${GL_GENERATE_STDBOOL_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_STDBOOL_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -17052,6 +18112,10 @@ as_fn_error $? "conditional \"GL_GENERATE_STDDEF_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${GL_GENERATE_STDINT_H_TRUE}" && test -z "${GL_GENERATE_STDINT_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_STDINT_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -17497,7 +18561,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by supermin $as_me 5.1.17, which was +This file was extended by supermin $as_me 5.1.18, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17563,7 +18627,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -supermin config.status 5.1.17 +supermin config.status 5.1.18 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru supermin-5.1.17/configure.ac supermin-5.1.18/configure.ac --- supermin-5.1.17/configure.ac 2016-11-01 10:55:49.000000000 +0000 +++ supermin-5.1.18/configure.ac 2017-07-13 09:32:06.000000000 +0000 @@ -17,7 +17,7 @@ dnl dnl Written by Richard W.M. Jones -AC_INIT([supermin],[5.1.17]) +AC_INIT([supermin],[5.1.18]) AM_INIT_AUTOMAKE(foreign) AC_REQUIRE_AUX_FILE([supermin-test-driver]) @@ -42,6 +42,9 @@ dnl Enable GNU stuff. AC_USE_SYSTEM_EXTENSIONS +dnl Which header file defines major, minor, makedev. +AC_HEADER_MAJOR + dnl Define the host CPU architecture (defines host_cpu). AC_CANONICAL_HOST @@ -90,7 +93,7 @@ if test "x$PERLDOC" = "xno" ; then AC_MSG_WARN([perldoc not found - install perl to make man pages]) fi -AM_CONDITIONAL(HAVE_PERLDOC,[test "$perldoc" != "no"]) +AM_CONDITIONAL(HAVE_PERLDOC,[test "x$PERLDOC" != "xno"]) dnl For yum-rpm handler. AC_PATH_PROG(RPM,[rpm],[no]) @@ -110,10 +113,10 @@ dnl For Debian handler. AC_PATH_PROG(APT_GET,[apt-get],[no]) -AC_PATH_PROG(DPKG,[dpkg],[no]) -AC_PATH_PROG(DPKG_DEB,[dpkg-deb],[no]) -AC_PATH_PROG(DPKG_QUERY,[dpkg-query],[no]) -AC_PATH_PROG(DPKG_DIVERT,[[dpkg-divert]],[no]) +AC_PATH_PROG(DPKG,[dpkg],[no],[/usr/bin:/bin]) +AC_PATH_PROG(DPKG_DEB,[dpkg-deb],[no],[/usr/bin:/bin]) +AC_PATH_PROG(DPKG_QUERY,[dpkg-query],[no],[/usr/bin:/bin]) +AC_PATH_PROG(DPKG_DIVERT,[[dpkg-divert]],[no],[/usr/bin:/bin]) dnl For FrugalWare handler (currently disabled). AC_PATH_PROG(PACMAN_G2,[pacman-g2],[no]) diff -Nru supermin-5.1.17/debian/changelog supermin-5.1.18/debian/changelog --- supermin-5.1.17/debian/changelog 2017-04-28 18:45:45.000000000 +0000 +++ supermin-5.1.18/debian/changelog 2017-07-15 02:33:46.000000000 +0000 @@ -1,3 +1,20 @@ +supermin (5.1.18-1ubuntu1) artful; urgency=medium + + * Merge from Debian Sid (LP: #1704518). Remaining changes: + - Switch to Ubuntu kernel metapackage names in debian/control. + - Add debian/patches/arm-test-build-bash.diff to call supermin with + --host-cpu lpae on armhf. + + -- Simon Quigley Fri, 14 Jul 2017 21:33:46 -0500 + +supermin (5.1.18-1) unstable; urgency=medium + + * New upstream version 5.1.18 + * Drop patches that have been integrated upstream + * Modernize package: Bump Standards-Version, Debhelper compat level + + -- Hilko Bengen Fri, 14 Jul 2017 07:13:44 +0200 + supermin (5.1.17-8ubuntu1) artful; urgency=low * Merge from Debian unstable. Remaining changes: diff -Nru supermin-5.1.17/debian/compat supermin-5.1.18/debian/compat --- supermin-5.1.17/debian/compat 2017-04-15 21:47:03.000000000 +0000 +++ supermin-5.1.18/debian/compat 2017-07-14 05:13:19.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru supermin-5.1.17/debian/control supermin-5.1.18/debian/control --- supermin-5.1.17/debian/control 2017-04-28 18:45:45.000000000 +0000 +++ supermin-5.1.18/debian/control 2017-07-15 02:33:46.000000000 +0000 @@ -4,7 +4,7 @@ Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Debian Libvirt Maintainers Uploaders: Hilko Bengen -Build-Depends: debhelper (>= 9), +Build-Depends: debhelper (>= 10), dh-autoreconf, libc-dev-bin, gawk, pkg-config, @@ -14,10 +14,10 @@ comerr-dev, e2fslibs-dev, cpio, musl-tools [amd64 arm64 armel armhf i386], - augeas-tools, libhivex-bin, + augeas-tools, libhivex-bin, linux-image-generic [!armhf], - linux-image-generic-lpae [armhf], -Standards-Version: 3.9.6 + linux-image-generic-lpae [armhf] +Standards-Version: 4.0.0 Homepage: http://people.redhat.com/~rjones/supermin/ Vcs-Git: git://anonscm.debian.org/pkg-libvirt/supermin.git Vcs-Browser: http://anonscm.debian.org/?p=pkg-libvirt/supermin.git diff -Nru supermin-5.1.17/debian/patches/0001-Add-hppa-hppa64-ppc64el-architectures.patch supermin-5.1.18/debian/patches/0001-Add-hppa-hppa64-ppc64el-architectures.patch --- supermin-5.1.17/debian/patches/0001-Add-hppa-hppa64-ppc64el-architectures.patch 2017-04-15 21:47:03.000000000 +0000 +++ supermin-5.1.18/debian/patches/0001-Add-hppa-hppa64-ppc64el-architectures.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -From: Hilko Bengen -Date: Wed, 27 Aug 2014 23:57:06 +0200 -Subject: Add hppa, hppa64, ppc64el architectures - ---- - src/kernel.ml | 2 ++ - src/utils.ml | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/src/kernel.ml b/src/kernel.ml -index 356ac4b..9b0e8a2 100644 ---- a/src/kernel.ml -+++ b/src/kernel.ml -@@ -30,6 +30,8 @@ let patt_of_cpu host_cpu = - | "ppc" | "powerpc" | "powerpc64" -> ["ppc"; "powerpc"; "powerpc64"] - | "sparc" | "sparc64" -> ["sparc"; "sparc64"] - | "amd64" | "x86_64" -> ["amd64"; "x86_64"] -+ | "parisc" | "parisc64" -> ["hppa"; "hppa64"] -+ | "ppc64el" -> ["powerpc64le"] - | _ when host_cpu.[0] = 'i' && host_cpu.[2] = '8' && host_cpu.[3] = '6' -> ["?86"] - | _ when String.length host_cpu >= 5 && String.sub host_cpu 0 5 = "armv7" -> ["armmp"] - | _ -> [host_cpu] -diff --git a/src/utils.ml b/src/utils.ml -index 4223be4..e3b8742 100644 ---- a/src/utils.ml -+++ b/src/utils.ml -@@ -183,6 +183,8 @@ let compare_architecture a1 a2 = - | a when string_prefix "armv6" a -> 32 - | a when string_prefix "armv7" a -> 32 - | a when string_prefix "armv8" a -> 64 -+ | "hppa" | "parisc" -> 32 -+ | "hppa64" | "parisc64" -> 64 - | "ppc" | "ppc32" -> 32 - | a when string_prefix "ppc64" a -> 64 - | "sparc" | "sparc32" -> 32 diff -Nru supermin-5.1.17/debian/patches/0002-Look-for-dpkg-only-in-specified-usr-bin-bin.patch supermin-5.1.18/debian/patches/0002-Look-for-dpkg-only-in-specified-usr-bin-bin.patch --- supermin-5.1.17/debian/patches/0002-Look-for-dpkg-only-in-specified-usr-bin-bin.patch 2016-11-12 13:37:56.000000000 +0000 +++ supermin-5.1.18/debian/patches/0002-Look-for-dpkg-only-in-specified-usr-bin-bin.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -From: Hilko Bengen -Date: Fri, 11 Nov 2016 10:06:19 +0100 -Subject: Look for dpkg* only in specified /usr/bin, /bin - ---- - configure.ac | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 3a0d25d..72ffb92 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -110,10 +110,10 @@ AC_PATH_PROG(URPMI,[urpmi],[no], [$PATH$PATH_SEPARATOR/usr/sbin]) - - dnl For Debian handler. - AC_PATH_PROG(APT_GET,[apt-get],[no]) --AC_PATH_PROG(DPKG,[dpkg],[no]) --AC_PATH_PROG(DPKG_DEB,[dpkg-deb],[no]) --AC_PATH_PROG(DPKG_QUERY,[dpkg-query],[no]) --AC_PATH_PROG(DPKG_DIVERT,[[dpkg-divert]],[no]) -+AC_PATH_PROG(DPKG,[dpkg],[no],[/usr/bin:/bin]) -+AC_PATH_PROG(DPKG_DEB,[dpkg-deb],[no],[/usr/bin:/bin]) -+AC_PATH_PROG(DPKG_QUERY,[dpkg-query],[no],[/usr/bin:/bin]) -+AC_PATH_PROG(DPKG_DIVERT,[[dpkg-divert]],[no],[/usr/bin:/bin]) - - dnl For FrugalWare handler (currently disabled). - AC_PATH_PROG(PACMAN_G2,[pacman-g2],[no]) diff -Nru supermin-5.1.17/debian/patches/arm-test-build-bash.diff supermin-5.1.18/debian/patches/arm-test-build-bash.diff --- supermin-5.1.17/debian/patches/arm-test-build-bash.diff 2016-01-17 20:09:34.000000000 +0000 +++ supermin-5.1.18/debian/patches/arm-test-build-bash.diff 2017-07-15 02:33:46.000000000 +0000 @@ -1,8 +1,6 @@ Description: test-build-bash.sh: On armhf, call supermin with --host-cpu lpae. Author: Matthias Klose -Index: b/tests/test-build-bash.sh -=================================================================== --- a/tests/test-build-bash.sh +++ b/tests/test-build-bash.sh @@ -34,6 +34,9 @@ test "$USE_NETWORK" = 1 || USE_INSTALLED diff -Nru supermin-5.1.17/debian/patches/series supermin-5.1.18/debian/patches/series --- supermin-5.1.17/debian/patches/series 2017-04-28 18:45:45.000000000 +0000 +++ supermin-5.1.18/debian/patches/series 2017-07-15 02:33:46.000000000 +0000 @@ -1,3 +1 @@ -0001-Add-hppa-hppa64-ppc64el-architectures.patch -0002-Look-for-dpkg-only-in-specified-usr-bin-bin.patch arm-test-build-bash.diff diff -Nru supermin-5.1.17/depcomp supermin-5.1.18/depcomp --- supermin-5.1.17/depcomp 2014-03-12 19:05:34.000000000 +0000 +++ supermin-5.1.18/depcomp 2016-02-17 14:57:44.000000000 +0000 @@ -3,7 +3,7 @@ scriptversion=2013-05-30.07; # UTC -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/examples/Makefile.in supermin-5.1.18/examples/Makefile.in --- supermin-5.1.17/examples/Makefile.in 2016-11-01 10:56:09.000000000 +0000 +++ supermin-5.1.18/examples/Makefile.in 2017-07-13 09:32:34.000000000 +0000 @@ -122,17 +122,19 @@ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopendir.m4 $(top_srcdir)/m4/filenamecat.m4 \ - $(top_srcdir)/m4/fstat.m4 $(top_srcdir)/m4/fts.m4 \ - $(top_srcdir)/m4/getcwd.m4 $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/fstat.m4 \ + $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ + $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/getprogname.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/largefile.m4 \ - $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lstat.m4 \ - $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \ - $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ - $(top_srcdir)/m4/msvc-inval.m4 \ + $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ + $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/mmap-anon.m4 \ + $(top_srcdir)/m4/mode_t.m4 $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/ocaml.m4 $(top_srcdir)/m4/off_t.m4 \ $(top_srcdir)/m4/onceonly.m4 $(top_srcdir)/m4/open.m4 \ @@ -140,16 +142,16 @@ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/save-cwd.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ - $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio_h.m4 \ - $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strdup.m4 \ - $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ - $(top_srcdir)/m4/sys_socket_h.m4 \ + $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ + $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \ + $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/time_h.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -338,6 +340,7 @@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_OPENAT = @GNULIB_OPENAT@ GNULIB_OPENDIR = @GNULIB_OPENDIR@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -354,6 +357,7 @@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_PUTS = @GNULIB_PUTS@ GNULIB_PWRITE = @GNULIB_PWRITE@ +GNULIB_QSORT_R = @GNULIB_QSORT_R@ GNULIB_RANDOM = @GNULIB_RANDOM@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ @@ -405,6 +409,7 @@ GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ GNULIB_TIME_R = @GNULIB_TIME_R@ +GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ @@ -431,6 +436,7 @@ GREP = @GREP@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ @@ -446,6 +452,7 @@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -501,6 +508,7 @@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ @@ -528,6 +536,7 @@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ @@ -570,6 +579,7 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -598,6 +608,7 @@ LIBRPM_CFLAGS = @LIBRPM_CFLAGS@ LIBRPM_LIBS = @LIBRPM_LIBS@ LIBS = @LIBS@ +LIMITS_H = @LIMITS_H@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ @@ -608,6 +619,7 @@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ @@ -621,6 +633,7 @@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ @@ -734,9 +747,11 @@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ @@ -765,6 +780,7 @@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ @@ -788,6 +804,7 @@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDALIGN_H = @STDALIGN_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ @@ -795,6 +812,7 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ URPMI = @URPMI@ @@ -812,6 +830,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ diff -Nru supermin-5.1.17/.gitignore supermin-5.1.18/.gitignore --- supermin-5.1.17/.gitignore 2016-02-17 16:11:24.000000000 +0000 +++ supermin-5.1.18/.gitignore 2017-03-01 12:13:45.000000000 +0000 @@ -14,6 +14,7 @@ pod2htm?.tmp /aclocal.m4 +/ar-lib /arg-nonnull.h /autom4te.cache /c++defs.h @@ -39,7 +40,7 @@ /snippet/ /src/.depend /src/config.ml -/src/ext2init-bin.S +/src/format-ext2-init-bin.S /src/supermin /src/supermin.1 /src/supermin-link.sh diff -Nru supermin-5.1.17/init/init.c supermin-5.1.18/init/init.c --- supermin-5.1.17/init/init.c 2016-10-23 08:45:38.000000000 +0000 +++ supermin-5.1.18/init/init.c 2017-04-25 13:36:51.000000000 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -40,7 +41,13 @@ #include #include #include + +#if MAJOR_IN_MKDEV +#include +#elif MAJOR_IN_SYSMACROS #include +/* else it's in sys/types.h, included above */ +#endif /* Maximum time to wait for the root device to appear (seconds). * @@ -83,6 +90,11 @@ static void insmod (const char *filename); static void delete_initramfs_files (void); static void show_directory (const char *dir); +static void parse_root_uuid (const char *uuid, unsigned char *raw_uuid); +static int hexdigit (char d); +static int find_fs_uuid (const unsigned char *raw_uuid, int *major, int *minor); +static int parse_dev_file (const char *path, int *major, int *minor); +static void virtio_warning (uint64_t delay_ns, const char *what); static char cmdline[1024]; static char line[1024]; @@ -90,6 +102,21 @@ int main () { + FILE *fp; + char *root; + size_t len; + int dax = 0; + uint64_t delay_ns; + int major, minor; + const char *mount_options = ""; + +#define NANOSLEEP(ns) do { \ + struct timespec t; \ + t.tv_sec = delay_ns / 1000000000; \ + t.tv_nsec = delay_ns % 1000000000; \ + nanosleep (&t, NULL); \ + } while(0) + mount_proc (); fprintf (stderr, "supermin: ext2 mini initrd starting up: " @@ -126,7 +153,7 @@ exit (EXIT_FAILURE); } - FILE *fp = fopen ("/modules", "r"); + fp = fopen ("/modules", "r"); if (fp == NULL) { perror ("fopen: /modules"); exit (EXIT_FAILURE); @@ -148,20 +175,20 @@ } fclose (fp); - /* Look for the ext2 filesystem device. It's always the last one - * that was added. Modern versions of libguestfs supply the - * expected name of the root device on the command line - * ("root=/dev/..."). For virtio-scsi this is required, because we - * must wait for the device to appear after the module is loaded. + /* Look for the ext2 filesystem root device specified as root=... + * on the kernel command line. */ - char *root, *path; - size_t len; - int dax = 0; root = strstr (cmdline, "root="); - if (root) { + if (!root) { + fprintf (stderr, "supermin: missing root= parameter on the command line\n"); + exit (EXIT_FAILURE); + } + root += 5; + + if (strncmp (root, "/dev/", 5) == 0) { + char *path; + root += 5; - if (strncmp (root, "/dev/", 5) == 0) - root += 5; if (strncmp (root, "pmem", 4) == 0) dax = 1; len = strcspn (root, " "); @@ -169,76 +196,52 @@ asprintf (&path, "/sys/block/%s/dev", root); - uint64_t delay_ns = 250000; - int virtio_message = 0; - while (delay_ns <= MAX_ROOT_WAIT * UINT64_C(1000000000)) { - fp = fopen (path, "r"); - if (fp != NULL) - goto found; - - if (delay_ns > 1000000000) { - fprintf (stderr, - "supermin: waiting another %" PRIu64 " ns for %s to appear\n", - delay_ns, path); - if (!virtio_message) { - fprintf (stderr, - "This usually means your kernel doesn't support virtio, or supermin was unable\n" - "to load some kernel modules (see module loading messages above).\n"); - virtio_message = 1; - } + for (delay_ns = 250000; + delay_ns <= MAX_ROOT_WAIT * UINT64_C(1000000000); + delay_ns *= 2) { + if (parse_dev_file (path, &major, &minor) != -1) { + if (!quiet) + fprintf (stderr, "supermin: picked %s (%d:%d) as root device\n", + path, major, minor); + break; } - struct timespec t; - t.tv_sec = delay_ns / 1000000000; - t.tv_nsec = delay_ns % 1000000000; - nanosleep (&t, NULL); - delay_ns *= 2; + virtio_warning (delay_ns, path); + NANOSLEEP (delay_ns); } - } - else { - path = strdup ("/sys/block/xdx/dev"); - char class[3] = { 'v', 's', 'h' }; - size_t i, j; - fp = NULL; - for (i = 0; i < sizeof class; ++i) { - for (j = 'z'; j >= 'a'; --j) { - path[11] = class[i]; - path[13] = j; - fp = fopen (path, "r"); - if (fp != NULL) - goto found; - } - } + free (path); } + else if (strncmp (root, "UUID=", 5) == 0) { + unsigned char raw_uuid[16]; - fprintf (stderr, - "supermin: no ext2 root device found\n" - "Please include FULL verbose output in your bug report.\n"); - exit (EXIT_FAILURE); + root += 5; + parse_root_uuid (root, raw_uuid); - found: - if (!quiet) - fprintf (stderr, "supermin: picked %s as root device\n", path); + for (delay_ns = 250000; + delay_ns <= MAX_ROOT_WAIT * UINT64_C(1000000000); + delay_ns *= 2) { + if (find_fs_uuid (raw_uuid, &major, &minor) != -1) { + if (!quiet) + fprintf (stderr, "supermin: picked %d:%d as root device\n", + major, minor); + break; + } - fgets (line, sizeof line, fp); - int major = atoi (line); - char *p = line + strcspn (line, ":") + 1; - int minor = atoi (p); + virtio_warning (delay_ns, "root UUID"); + NANOSLEEP (delay_ns); + } + } + else { + fprintf (stderr, "supermin: unknown root= parameter on the command line\n"); + exit (EXIT_FAILURE); + } - fclose (fp); if (umount ("/sys") == -1) { perror ("umount: /sys"); exit (EXIT_FAILURE); } - /* Make current process the controlling process of the tty. */ - setsid (); -#ifdef TIOCSCTTY - if (ioctl (0, TIOCSCTTY, 1) == -1) - perror ("ioctl: TIOCSCTTY"); -#endif - if (!quiet) fprintf (stderr, "supermin: creating /dev/root as block special %d:%d\n", major, minor); @@ -249,7 +252,7 @@ } /* Construct the filesystem mount options. */ - const char *mount_options = ""; + mount_options = ""; if (dax) mount_options = "dax"; @@ -304,27 +307,30 @@ insmod (const char *filename) { size_t size; + int fd; + struct stat st; + char *buf; + size_t offset; if (!quiet) fprintf (stderr, "supermin: internal insmod %s\n", filename); - int fd = open (filename, O_RDONLY); + fd = open (filename, O_RDONLY); if (fd == -1) { fprintf (stderr, "insmod: open: %s: %m\n", filename); exit (EXIT_FAILURE); } - struct stat st; if (fstat (fd, &st) == -1) { perror ("insmod: fstat"); exit (EXIT_FAILURE); } size = st.st_size; - char *buf = malloc (size); + buf = malloc (size); if (buf == NULL) { fprintf (stderr, "insmod: malloc (%s, %zu bytes): %m\n", filename, size); exit (EXIT_FAILURE); } - size_t offset = 0; + offset = 0; do { ssize_t rc = read (fd, buf + offset, size - offset); if (rc == -1) { @@ -503,3 +509,145 @@ closedir (dir); chdir ("/"); } + +static void +parse_root_uuid (const char *root, unsigned char *raw_uuid) +{ + size_t i; + + i = 0; + while (i < 16) { + if (*root == '-') { + ++root; + continue; + } + if (!isxdigit (root[0]) || !isxdigit (root[1])) { + fprintf (stderr, "supermin: root UUID is not a 16 byte UUID string\n"); + exit (EXIT_FAILURE); + } + raw_uuid[i] = hexdigit (root[0]) * 0x10 + hexdigit (root[1]); + ++i; + root += 2; + } + + if (*root && isxdigit (*root)) { + fprintf (stderr, "supermin: root UUID is longer than 16 bytes\n"); + exit (EXIT_FAILURE); + } +} + +static int +hexdigit (char d) +{ + switch (d) { + case '0'...'9': return d - '0'; + case 'a'...'f': return d - 'a' + 10; + case 'A'...'F': return d - 'A' + 10; + default: return -1; + } +} + +/* Search every block device under /sys/block to see if we can find + * one which contains a filesystem with the matching volume UUID. + */ +static int +find_fs_uuid (const unsigned char *raw_uuid, int *major, int *minor) +{ + DIR *dir; + struct dirent *d; + unsigned char uuid[16]; + + dir = opendir ("/sys/block"); + if (!dir) { + perror ("/sys/block"); + return -1; + } + + while ((d = readdir (dir)) != NULL) { + int fd = -1; + char *path = NULL; + + if (d->d_name[0] == '.') + goto cont; + + asprintf (&path, "/sys/block/%s/dev", d->d_name); + + if (parse_dev_file (path, major, minor) == -1) + goto cont; + + /* We have to make a dummy inode so we can open the device. */ + unlink ("/dev/disk"); + if (mknod ("/dev/disk", S_IFBLK|0700, makedev (*major, *minor)) == -1) { + perror ("mknod"); + goto cont; + } + + fd = open ("/dev/disk", O_RDONLY); + if (fd == -1) { + perror ("open"); + goto cont; + } + + if (pread (fd, uuid, sizeof uuid, 0x468) != sizeof uuid) { + /*perror ("pread"); - not an error, the device might just be small */ + goto cont; + } + + if (memcmp (uuid, raw_uuid, sizeof uuid) != 0) + goto cont; + + close (fd); + free (path); + closedir (dir); + unlink ("/dev/disk"); + return 0; + + cont: + if (fd >= 0) close (fd); + free (path); + } + + closedir (dir); + + return -1; +} + +/* Parse a /sys/block/X/dev file and extract the major:minor numbers. */ +static int +parse_dev_file (const char *path, int *major, int *minor) +{ + FILE *fp; + char *p; + + fp = fopen (path, "r"); + if (fp == NULL) + return -1; + + fgets (line, sizeof line, fp); + *major = atoi (line); + p = line + strcspn (line, ":") + 1; + *minor = atoi (p); + + fclose (fp); + + return 0; +} + +static void +virtio_warning (uint64_t delay_ns, const char *what) +{ + static int virtio_message = 0; + + if (delay_ns > 1000000000) { + fprintf (stderr, + "supermin: waiting another %" PRIu64 " ns for %s to appear\n", + delay_ns, what); + + if (!virtio_message) { + fprintf (stderr, + "This usually means your kernel doesn't support virtio, or supermin was unable\n" + "to load some kernel modules (see module loading messages above).\n"); + virtio_message = 1; + } + } +} diff -Nru supermin-5.1.17/init/Makefile.in supermin-5.1.18/init/Makefile.in --- supermin-5.1.17/init/Makefile.in 2016-11-01 10:56:09.000000000 +0000 +++ supermin-5.1.18/init/Makefile.in 2017-07-13 09:32:34.000000000 +0000 @@ -124,17 +124,19 @@ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopendir.m4 $(top_srcdir)/m4/filenamecat.m4 \ - $(top_srcdir)/m4/fstat.m4 $(top_srcdir)/m4/fts.m4 \ - $(top_srcdir)/m4/getcwd.m4 $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/fstat.m4 \ + $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ + $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/getprogname.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/largefile.m4 \ - $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lstat.m4 \ - $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \ - $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ - $(top_srcdir)/m4/msvc-inval.m4 \ + $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ + $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/mmap-anon.m4 \ + $(top_srcdir)/m4/mode_t.m4 $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/ocaml.m4 $(top_srcdir)/m4/off_t.m4 \ $(top_srcdir)/m4/onceonly.m4 $(top_srcdir)/m4/open.m4 \ @@ -142,16 +144,16 @@ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/save-cwd.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ - $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio_h.m4 \ - $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strdup.m4 \ - $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ - $(top_srcdir)/m4/sys_socket_h.m4 \ + $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ + $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \ + $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/time_h.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -384,6 +386,7 @@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_OPENAT = @GNULIB_OPENAT@ GNULIB_OPENDIR = @GNULIB_OPENDIR@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -400,6 +403,7 @@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_PUTS = @GNULIB_PUTS@ GNULIB_PWRITE = @GNULIB_PWRITE@ +GNULIB_QSORT_R = @GNULIB_QSORT_R@ GNULIB_RANDOM = @GNULIB_RANDOM@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ @@ -451,6 +455,7 @@ GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ GNULIB_TIME_R = @GNULIB_TIME_R@ +GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ @@ -477,6 +482,7 @@ GREP = @GREP@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ @@ -492,6 +498,7 @@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -547,6 +554,7 @@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ @@ -574,6 +582,7 @@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ @@ -616,6 +625,7 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -644,6 +654,7 @@ LIBRPM_CFLAGS = @LIBRPM_CFLAGS@ LIBRPM_LIBS = @LIBRPM_LIBS@ LIBS = @LIBS@ +LIMITS_H = @LIMITS_H@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ @@ -654,6 +665,7 @@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ @@ -667,6 +679,7 @@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ @@ -780,9 +793,11 @@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ @@ -811,6 +826,7 @@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ @@ -834,6 +850,7 @@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDALIGN_H = @STDALIGN_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ @@ -841,6 +858,7 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ URPMI = @URPMI@ @@ -858,6 +876,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ diff -Nru supermin-5.1.17/install-sh supermin-5.1.18/install-sh --- supermin-5.1.17/install-sh 2014-03-12 19:05:34.000000000 +0000 +++ supermin-5.1.18/install-sh 2016-02-17 14:57:44.000000000 +0000 @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2011-11-20.07; # UTC +scriptversion=2013-12-25.23; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -41,19 +41,15 @@ # This script is compatible with the BSD install script, but was written # from scratch. +tab=' ' nl=' ' -IFS=" "" $nl" +IFS=" $tab$nl" -# set DOITPROG to echo to test this script +# Set DOITPROG to "echo" to test this script. -# Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi +doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. @@ -68,17 +64,6 @@ rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - posix_mkdir= # Desired mode of installed file. @@ -97,7 +82,7 @@ dst_arg= copy_on_change=false -no_target_directory= +is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE @@ -137,46 +122,57 @@ -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" - shift;; + shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -o) chowncmd="$chownprog $2" - shift;; + shift;; -s) stripcmd=$stripprog;; - -t) dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; - -T) no_target_directory=true;; + -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; - --) shift - break;; + --) shift + break;; - -*) echo "$0: invalid option: $1" >&2 - exit 1;; + -*) echo "$0: invalid option: $1" >&2 + exit 1;; *) break;; esac shift done +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. @@ -208,6 +204,15 @@ fi if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 @@ -223,16 +228,16 @@ *[0-7]) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw='% 200' + u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw=,u+rw + u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac @@ -269,41 +274,15 @@ # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - + dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi @@ -314,74 +293,74 @@ if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; esac if $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else @@ -391,53 +370,51 @@ # directory the slow way, step by step, checking for races as we go. case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; esac - eval "$initialize_posix_glob" - oIFS=$IFS IFS=/ - $posix_glob set -f + set -f set fnord $dstdir shift - $posix_glob set +f + set +f IFS=$oIFS prefixes= for d do - test X"$d" = X && continue + test X"$d" = X && continue - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ done if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true fi fi fi @@ -472,15 +449,12 @@ # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - + set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then @@ -493,24 +467,24 @@ # to itself, or perhaps because mv is so ancient that it does not # support -f. { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 diff -Nru supermin-5.1.17/lib/assure.h supermin-5.1.18/lib/assure.h --- supermin-5.1.17/lib/assure.h 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/lib/assure.h 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,37 @@ +/* Run-time assert-like macros. + + Copyright (C) 2014-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paul Eggert. */ + +#ifndef _GL_ASSURE_H +#define _GL_ASSURE_H + +#include + +/* Check E's value at runtime, and report an error and abort if not. + However, do nothng if NDEBUG is defined. + + Unlike standard 'assert', this macro always compiles E even when NDEBUG + is defined, so as to catch typos and avoid some GCC warnings. */ + +#ifdef NDEBUG +# define assure(E) ((void) (0 && (E))) +#else +# define assure(E) assert (E) +#endif + +#endif diff -Nru supermin-5.1.17/lib/basename-lgpl.c supermin-5.1.18/lib/basename-lgpl.c --- supermin-5.1.17/lib/basename-lgpl.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/basename-lgpl.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* basename.c -- return the last element in a file name - Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/bitrotate.h supermin-5.1.18/lib/bitrotate.h --- supermin-5.1.17/lib/bitrotate.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/bitrotate.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* bitrotate.h - Rotate bits in integers - Copyright (C) 2008-2014 Free Software Foundation, Inc. + Copyright (C) 2008-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/chdir-long.c supermin-5.1.18/lib/chdir-long.c --- supermin-5.1.17/lib/chdir-long.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/chdir-long.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* provide a chdir function that tries not to fail due to ENAMETOOLONG - Copyright (C) 2004-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,7 +20,6 @@ #include "chdir-long.h" -#include #include #include #include @@ -28,6 +27,8 @@ #include #include +#include "assure.h" + #ifndef PATH_MAX # error "compile this file only if your system defines PATH_MAX" #endif @@ -60,7 +61,7 @@ if (0 <= cdb->fd) { bool close_fail = close (cdb->fd); - assert (! close_fail); + assure (! close_fail); } } @@ -122,8 +123,8 @@ /* If DIR is the empty string, then the chdir above must have failed and set errno to ENOENT. */ - assert (0 < len); - assert (PATH_MAX <= len); + assure (0 < len); + assure (PATH_MAX <= len); /* Count leading slashes. */ n_leading_slash = strspn (dir, "/"); @@ -158,8 +159,8 @@ dir += n_leading_slash; } - assert (*dir != '/'); - assert (dir <= dir_end); + assure (*dir != '/'); + assure (dir <= dir_end); while (PATH_MAX <= dir_end - dir) { @@ -175,7 +176,7 @@ } *slash = '\0'; - assert (slash - dir < PATH_MAX); + assure (slash - dir < PATH_MAX); err = cdb_advance_fd (&cdb, dir); *slash = '/'; if (err != 0) @@ -211,8 +212,6 @@ # include "closeout.h" # include "error.h" -char *program_name; - int main (int argc, char *argv[]) { @@ -220,7 +219,6 @@ size_t n = 0; int len; - program_name = argv[0]; atexit (close_stdout); len = getline (&line, &n, stdin); diff -Nru supermin-5.1.17/lib/chdir-long.h supermin-5.1.18/lib/chdir-long.h --- supermin-5.1.17/lib/chdir-long.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/chdir-long.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* provide a chdir function that tries not to fail due to ENAMETOOLONG - Copyright (C) 2004-2005, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2005, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/cloexec.c supermin-5.1.18/lib/cloexec.c --- supermin-5.1.17/lib/cloexec.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/cloexec.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* closexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 1991, 2004-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 1991, 2004-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/cloexec.h supermin-5.1.18/lib/cloexec.h --- supermin-5.1.17/lib/cloexec.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/cloexec.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* closexec.c - set or clear the close-on-exec descriptor flag - Copyright (C) 2004, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2004, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/close.c supermin-5.1.18/lib/close.c --- supermin-5.1.17/lib/close.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/close.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* close replacement. - Copyright (C) 2008-2014 Free Software Foundation, Inc. + Copyright (C) 2008-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/closedir.c supermin-5.1.18/lib/closedir.c --- supermin-5.1.17/lib/closedir.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/closedir.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* Stop reading the entries of a directory. - Copyright (C) 2006-2014 Free Software Foundation, Inc. + Copyright (C) 2006-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ int closedir (DIR *dirp) { -# if REPLACE_FCHDIR +# if REPLACE_FCHDIR || REPLACE_DIRFD int fd = dirfd (dirp); # endif int retval; @@ -49,6 +49,10 @@ retval = closedir (dirp); +# ifdef __KLIBC__ + if (!retval) + _gl_unregister_dirp_fd (fd); +# endif #else if (dirp->current != INVALID_HANDLE_VALUE) diff -Nru supermin-5.1.17/lib/creat-safer.c supermin-5.1.18/lib/creat-safer.c --- supermin-5.1.17/lib/creat-safer.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/creat-safer.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Invoke creat, but avoid some glitches. - Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/cycle-check.c supermin-5.1.18/lib/cycle-check.c --- supermin-5.1.17/lib/cycle-check.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/cycle-check.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* help detect directory cycles efficiently - Copyright (C) 2003-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2003-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,15 +19,15 @@ #include +#include "cycle-check.h" + #include #include #include -#include #include - #include -#include "cycle-check.h" +#include "assure.h" #define CC_MAGIC 9827862 @@ -57,7 +57,7 @@ bool cycle_check (struct cycle_check_state *state, struct stat const *sb) { - assert (state->magic == CC_MAGIC); + assure (state->magic == CC_MAGIC); /* If the current directory ever happens to be the same as the one we last recorded for the cycle detection, diff -Nru supermin-5.1.17/lib/cycle-check.h supermin-5.1.18/lib/cycle-check.h --- supermin-5.1.17/lib/cycle-check.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/cycle-check.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* help detect directory cycles efficiently - Copyright (C) 2003-2004, 2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2003-2004, 2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/dirent--.h supermin-5.1.18/lib/dirent--.h --- supermin-5.1.17/lib/dirent--.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dirent--.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Like dirent.h, but redefine some names to avoid glitches. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,3 +21,4 @@ #undef opendir #define opendir opendir_safer +#define GNULIB_defined_opendir 1 diff -Nru supermin-5.1.17/lib/dirent.in.h supermin-5.1.18/lib/dirent.in.h --- supermin-5.1.17/lib/dirent.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dirent.in.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* A GNU-like . - Copyright (C) 2006-2014 Free Software Foundation, Inc. + Copyright (C) 2006-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -77,6 +77,7 @@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef opendir # define opendir rpl_opendir +# define GNULIB_defined_opendir 1 # endif _GL_FUNCDECL_RPL (opendir, DIR *, (const char *dir_name) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (opendir, DIR *, (const char *dir_name)); @@ -128,6 +129,7 @@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # undef closedir # define closedir rpl_closedir +# define GNULIB_defined_closedir 1 # endif _GL_FUNCDECL_RPL (closedir, int, (DIR *dirp) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (closedir, int, (DIR *dirp)); @@ -156,6 +158,13 @@ # endif _GL_FUNCDECL_RPL (dirfd, int, (DIR *) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (dirfd, int, (DIR *)); + +# ifdef __KLIBC__ +/* Gnulib internal hooks needed to maintain the dirfd metadata. */ +_GL_EXTERN_C int _gl_register_dirp_fd (int fd, DIR *dirp) + _GL_ARG_NONNULL ((2)); +_GL_EXTERN_C void _gl_unregister_dirp_fd (int fd); +# endif # else # if defined __cplusplus && defined GNULIB_NAMESPACE && defined dirfd /* dirfd is defined as a macro and not as a function. diff -Nru supermin-5.1.17/lib/dirent-private.h supermin-5.1.18/lib/dirent-private.h --- supermin-5.1.17/lib/dirent-private.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dirent-private.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* Private details of the DIR type. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/dirent-safer.h supermin-5.1.18/lib/dirent-safer.h --- supermin-5.1.17/lib/dirent-safer.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dirent-safer.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Invoke dirent-like functions, but avoid some glitches. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/dirfd.c supermin-5.1.18/lib/dirfd.c --- supermin-5.1.17/lib/dirfd.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dirfd.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* dirfd.c -- return the file descriptor associated with an open DIR* - Copyright (C) 2001, 2006, 2008-2014 Free Software Foundation, Inc. + Copyright (C) 2001, 2006, 2008-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,11 +22,77 @@ #include #include +#ifdef __KLIBC__ +# include +# include + +static struct dirp_fd_list +{ + DIR *dirp; + int fd; + struct dirp_fd_list *next; +} *dirp_fd_start = NULL; + +/* Register fd associated with dirp to dirp_fd_list. */ +int +_gl_register_dirp_fd (int fd, DIR *dirp) +{ + struct dirp_fd_list *new_dirp_fd = malloc (sizeof *new_dirp_fd); + if (!new_dirp_fd) + return -1; + + new_dirp_fd->dirp = dirp; + new_dirp_fd->fd = fd; + new_dirp_fd->next = dirp_fd_start; + + dirp_fd_start = new_dirp_fd; + + return 0; +} + +/* Unregister fd from dirp_fd_list with closing it */ +void +_gl_unregister_dirp_fd (int fd) +{ + struct dirp_fd_list *dirp_fd; + struct dirp_fd_list *dirp_fd_prev; + + for (dirp_fd_prev = NULL, dirp_fd = dirp_fd_start; dirp_fd; + dirp_fd_prev = dirp_fd, dirp_fd = dirp_fd->next) + { + if (dirp_fd->fd == fd) + { + if (dirp_fd_prev) + dirp_fd_prev->next = dirp_fd->next; + else /* dirp_fd == dirp_fd_start */ + dirp_fd_start = dirp_fd_start->next; + + close (fd); + free (dirp_fd); + break; + } + } +} +#endif + int dirfd (DIR *dir_p) { int fd = DIR_TO_FD (dir_p); if (fd == -1) +#ifndef __KLIBC__ errno = ENOTSUP; +#else + { + struct dirp_fd_list *dirp_fd; + + for (dirp_fd = dirp_fd_start; dirp_fd; dirp_fd = dirp_fd->next) + if (dirp_fd->dirp == dir_p) + return dirp_fd->fd; + + errno = EINVAL; + } +#endif + return fd; } diff -Nru supermin-5.1.17/lib/dirname.h supermin-5.1.18/lib/dirname.h --- supermin-5.1.17/lib/dirname.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dirname.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Take file names apart into directory and base names. - Copyright (C) 1998, 2001, 2003-2006, 2009-2014 Free Software Foundation, + Copyright (C) 1998, 2001, 2003-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -31,6 +31,10 @@ # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 # endif +#ifdef __cplusplus +extern "C" { +#endif + # if GNULIB_DIRNAME char *base_name (char const *file); char *dir_name (char const *file); @@ -43,4 +47,8 @@ bool strip_trailing_slashes (char *file); +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* not DIRNAME_H_ */ diff -Nru supermin-5.1.17/lib/dirname-lgpl.c supermin-5.1.18/lib/dirname-lgpl.c --- supermin-5.1.17/lib/dirname-lgpl.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dirname-lgpl.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* dirname.c -- return all but the last element in a file name - Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software + Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/dosname.h supermin-5.1.18/lib/dosname.h --- supermin-5.1.17/lib/dosname.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dosname.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* File names on MS-DOS/Windows systems. - Copyright (C) 2000-2001, 2004-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2000-2001, 2004-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/dup2.c supermin-5.1.18/lib/dup2.c --- supermin-5.1.17/lib/dup2.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dup2.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor to a specified file descriptor. - Copyright (C) 1999, 2004-2007, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 1999, 2004-2007, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -85,6 +85,57 @@ # define dup2 ms_windows_dup2 +# elif defined __KLIBC__ + +# include + +static int +klibc_dup2dirfd (int fd, int desired_fd) +{ + int tempfd; + int dupfd; + + tempfd = open ("NUL", O_RDONLY); + if (tempfd == -1) + return -1; + + if (tempfd == desired_fd) + { + close (tempfd); + + char path[_MAX_PATH]; + if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) + return -1; + + return open(path, O_RDONLY); + } + + dupfd = klibc_dup2dirfd (fd, desired_fd); + + close (tempfd); + + return dupfd; +} + +static int +klibc_dup2 (int fd, int desired_fd) +{ + int dupfd; + struct stat sbuf; + + dupfd = dup2 (fd, desired_fd); + if (dupfd == -1 && errno == ENOTSUP \ + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + close (desired_fd); + + return klibc_dup2dirfd (fd, desired_fd); + } + + return dupfd; +} + +# define dup2 klibc_dup2 # endif int diff -Nru supermin-5.1.17/lib/dup.c supermin-5.1.18/lib/dup.c --- supermin-5.1.17/lib/dup.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dup.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Duplicate an open file descriptor. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,6 +45,31 @@ return result; } +#elif defined __KLIBC__ +# include +# include + +# include + +static int +dup_nothrow (int fd) +{ + int dupfd; + struct stat sbuf; + + dupfd = dup (fd); + if (dupfd == -1 && errno == ENOTSUP \ + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + char path[_MAX_PATH]; + + /* Get a path from fd */ + if (!__libc_Back_ioFHToPath (fd, path, sizeof (path))) + dupfd = open (path, O_RDONLY); + } + + return dupfd; +} #else # define dup_nothrow dup #endif diff -Nru supermin-5.1.17/lib/dup-safer.c supermin-5.1.18/lib/dup-safer.c --- supermin-5.1.17/lib/dup-safer.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/dup-safer.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Invoke dup, but avoid some glitches. - Copyright (C) 2001, 2004-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2001, 2004-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/errno.in.h supermin-5.1.18/lib/errno.in.h --- supermin-5.1.17/lib/errno.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/errno.in.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* A POSIX-like . - Copyright (C) 2008-2014 Free Software Foundation, Inc. + Copyright (C) 2008-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/error.c supermin-5.1.18/lib/error.c --- supermin-5.1.17/lib/error.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/error.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* Error handler for noninteractive utilities - Copyright (C) 1990-1998, 2000-2007, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 1990-1998, 2000-2007, 2009-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software: you can redistribute it and/or modify @@ -39,6 +39,11 @@ # include # include # define mbsrtowcs __mbsrtowcs +# define USE_UNLOCKED_IO 0 +# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b) +# define _GL_ARG_NONNULL(a) +#else +# include "getprogname.h" #endif #if USE_UNLOCKED_IO @@ -72,14 +77,14 @@ extern void __error_at_line (int status, int errnum, const char *file_name, unsigned int line_number, const char *message, ...) - __attribute__ ((__format__ (__printf__, 5, 6)));; + __attribute__ ((__format__ (__printf__, 5, 6))); # define error __error # define error_at_line __error_at_line # include -# define fflush(s) INTUSE(_IO_fflush) (s) +# define fflush(s) _IO_fflush (s) # undef putc -# define putc(c, fp) INTUSE(_IO_putc) (c, fp) +# define putc(c, fp) _IO_putc (c, fp) # include @@ -110,9 +115,7 @@ # endif # endif -/* The calling program should define program_name and set it to the - name of the executing program. */ -extern char *program_name; +#define program_name getprogname () # if HAVE_STRERROR_R || defined strerror_r # define __strerror_r strerror_r @@ -171,7 +174,7 @@ #if defined HAVE_STRERROR_R || _LIBC char errbuf[1024]; -# if STRERROR_R_CHAR_P || _LIBC +# if _LIBC || STRERROR_R_CHAR_P s = __strerror_r (errnum, errbuf, sizeof errbuf); # else if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) @@ -201,7 +204,6 @@ #if _LIBC if (_IO_fwide (stderr, 0) > 0) { -# define ALLOCA_LIMIT 2000 size_t len = strlen (message) + 1; wchar_t *wmessage = NULL; mbstate_t st; @@ -237,7 +239,7 @@ if (res != len) break; - if (__builtin_expect (len >= SIZE_MAX / 2, 0)) + if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0)) { /* This really should not happen if everything is fine. */ res = (size_t) -1; @@ -342,7 +344,10 @@ if (old_line_number == line_number && (file_name == old_file_name - || strcmp (old_file_name, file_name) == 0)) + || (old_file_name != NULL + && file_name != NULL + && strcmp (old_file_name, file_name) == 0))) + /* Simply return and print nothing. */ return; @@ -374,10 +379,10 @@ } #if _LIBC - __fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ", + __fxprintf (NULL, file_name != NULL ? "%s:%u: " : " ", file_name, line_number); #else - fprintf (stderr, file_name != NULL ? "%s:%d: " : " ", + fprintf (stderr, file_name != NULL ? "%s:%u: " : " ", file_name, line_number); #endif diff -Nru supermin-5.1.17/lib/error.h supermin-5.1.18/lib/error.h --- supermin-5.1.17/lib/error.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/error.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* Declaration for error-reporting function - Copyright (C) 1995-1997, 2003, 2006, 2008-2014 Free Software Foundation, + Copyright (C) 1995-1997, 2003, 2006, 2008-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -31,6 +31,16 @@ # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ #endif +/* On mingw, the flavor of printf depends on whether the extensions module + * is in use; the check for determines the witness macro. */ +#ifndef _GL_ATTRIBUTE_SPEC_PRINTF +# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU +# define _GL_ATTRIBUTE_SPEC_PRINTF __gnu_printf__ +# else +# define _GL_ATTRIBUTE_SPEC_PRINTF __printf__ +# endif +#endif + #ifdef __cplusplus extern "C" { #endif @@ -40,11 +50,11 @@ If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ extern void error (int __status, int __errnum, const char *__format, ...) - _GL_ATTRIBUTE_FORMAT ((__printf__, 3, 4)); + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 3, 4)); extern void error_at_line (int __status, int __errnum, const char *__fname, unsigned int __lineno, const char *__format, ...) - _GL_ATTRIBUTE_FORMAT ((__printf__, 5, 6)); + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF, 5, 6)); /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this diff -Nru supermin-5.1.17/lib/exitfail.c supermin-5.1.18/lib/exitfail.c --- supermin-5.1.17/lib/exitfail.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/exitfail.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2002-2003, 2005-2007, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/exitfail.h supermin-5.1.18/lib/exitfail.h --- supermin-5.1.17/lib/exitfail.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/exitfail.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Failure exit status - Copyright (C) 2002, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2002, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/fchdir.c supermin-5.1.18/lib/fchdir.c --- supermin-5.1.17/lib/fchdir.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fchdir.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* fchdir replacement. - Copyright (C) 2006-2014 Free Software Foundation, Inc. + Copyright (C) 2006-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,6 @@ /* Specification. */ #include -#include #include #include #include @@ -29,6 +28,7 @@ #include #include +#include "assure.h" #include "dosname.h" #include "filenamecat.h" @@ -132,7 +132,7 @@ { struct stat statbuf; - assert (0 <= fd); + assure (0 <= fd); if (REPLACE_OPEN_DIRECTORY || (fstat (fd, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))) { @@ -156,7 +156,7 @@ int _gl_register_dup (int oldfd, int newfd) { - assert (0 <= oldfd && 0 <= newfd && oldfd != newfd); + assure (0 <= oldfd && 0 <= newfd && oldfd != newfd); if (oldfd < dirs_allocated && dirs[oldfd].name) { /* Duplicated a directory; must ensure newfd is allocated. */ diff -Nru supermin-5.1.17/lib/fcntl.c supermin-5.1.18/lib/fcntl.c --- supermin-5.1.17/lib/fcntl.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fcntl.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Provide file descriptor control. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -89,8 +89,25 @@ inherit, /* InheritHandle */ DUPLICATE_SAME_ACCESS)) /* Options */ { - /* TODO: Translate GetLastError () into errno. */ - errno = EMFILE; + switch (GetLastError ()) + { + case ERROR_TOO_MANY_OPEN_FILES: + errno = EMFILE; + break; + case ERROR_INVALID_HANDLE: + case ERROR_INVALID_TARGET_HANDLE: + case ERROR_DIRECT_ACCESS_HANDLE: + errno = EBADF; + break; + case ERROR_INVALID_PARAMETER: + case ERROR_INVALID_FUNCTION: + case ERROR_INVALID_ACCESS: + errno = EINVAL; + break; + default: + errno = EACCES; + break; + } result = -1; break; } @@ -98,7 +115,6 @@ if (duplicated_fd < 0) { CloseHandle (new_handle); - errno = EMFILE; result = -1; break; } @@ -146,6 +162,93 @@ } #endif /* W32 */ +#ifdef __KLIBC__ + +# define INCL_DOS +# include + +static int +klibc_fcntl (int fd, int action, /* arg */...) +{ + va_list arg_ptr; + int arg; + struct stat sbuf; + int result = -1; + + va_start (arg_ptr, action); + arg = va_arg (arg_ptr, int); + result = fcntl (fd, action, arg); + /* EPERM for F_DUPFD, ENOTSUP for others */ + if (result == -1 && (errno == EPERM || errno == ENOTSUP) + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + ULONG ulMode; + + switch (action) + { + case F_DUPFD: + /* Find available fd */ + while (fcntl (arg, F_GETFL) != -1 || errno != EBADF) + arg++; + + result = dup2 (fd, arg); + break; + + /* Using underlying APIs is right ? */ + case F_GETFD: + if (DosQueryFHState (fd, &ulMode)) + break; + + result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; + break; + + case F_SETFD: + if (arg & ~FD_CLOEXEC) + break; + + if (DosQueryFHState (fd, &ulMode)) + break; + + if (arg & FD_CLOEXEC) + ulMode |= OPEN_FLAGS_NOINHERIT; + else + ulMode &= ~OPEN_FLAGS_NOINHERIT; + + /* Filter supported flags. */ + ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR + | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT); + + if (DosSetFHState (fd, ulMode)) + break; + + result = 0; + break; + + case F_GETFL: + result = 0; + break; + + case F_SETFL: + if (arg != 0) + break; + + result = 0; + break; + + default : + errno = EINVAL; + break; + } + } + + va_end (arg_ptr); + + return result; +} + +# define fcntl klibc_fcntl +#endif + /* Perform the specified ACTION on the file descriptor FD, possibly using the argument ARG further described below. This replacement handles the following actions, and forwards all others on to the diff -Nru supermin-5.1.17/lib/fcntl--.h supermin-5.1.18/lib/fcntl--.h --- supermin-5.1.17/lib/fcntl--.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fcntl--.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Like fcntl.h, but redefine some names to avoid glitches. - Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/fcntl.in.h supermin-5.1.18/lib/fcntl.in.h --- supermin-5.1.17/lib/fcntl.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fcntl.in.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Like , but with non-working flags defined to 0. - Copyright (C) 2006-2014 Free Software Foundation, Inc. + Copyright (C) 2006-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ extern "C" { ... } block, which leads to errors in C++ mode with the overridden from gnulib. These errors are known to be gone with g++ version >= 4.3. */ -#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) # include #endif #@INCLUDE_NEXT@ @NEXT_FCNTL_H@ @@ -53,7 +53,7 @@ extern "C" { ... } block, which leads to errors in C++ mode with the overridden from gnulib. These errors are known to be gone with g++ version >= 4.3. */ -#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) # include #endif /* The include_next requires a split double-inclusion guard. */ @@ -186,6 +186,22 @@ /* Fix up the O_* macros. */ +/* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT + to values outside 'int' range, so omit these misdefinitions. + But avoid namespace pollution on non-AIX systems. */ +#ifdef _AIX +# include +# if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX) +# undef O_CLOEXEC +# endif +# if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX) +# undef O_NOFOLLOW +# endif +# if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX) +# undef O_TTY_INIT +# endif +#endif + #if !defined O_DIRECT && defined O_DIRECTIO /* Tru64 spells it 'O_DIRECTIO'. */ # define O_DIRECT O_DIRECTIO diff -Nru supermin-5.1.17/lib/fcntl-safer.h supermin-5.1.18/lib/fcntl-safer.h --- supermin-5.1.17/lib/fcntl-safer.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fcntl-safer.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Invoke fcntl-like functions, but avoid some glitches. - Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/fd-hook.c supermin-5.1.18/lib/fd-hook.c --- supermin-5.1.17/lib/fd-hook.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fd-hook.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. Written by Bruno Haible , 2009. This program is free software: you can redistribute it and/or modify it diff -Nru supermin-5.1.17/lib/fd-hook.h supermin-5.1.18/lib/fd-hook.h --- supermin-5.1.17/lib/fd-hook.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fd-hook.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* Hook for making making file descriptor functions close(), ioctl() extensible. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff -Nru supermin-5.1.17/lib/fdopendir.c supermin-5.1.18/lib/fdopendir.c --- supermin-5.1.17/lib/fdopendir.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fdopendir.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* provide a replacement fdopendir function - Copyright (C) 2004-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -62,6 +62,41 @@ If this function returns successfully, FD is under control of the dirent.h system, and the caller should not close or modify the state of FD other than by the dirent.h functions. */ +# ifdef __KLIBC__ +# include + +DIR * +fdopendir (int fd) +{ + char path[_MAX_PATH]; + DIR *dirp; + + /* Get a path from fd */ + if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) + return NULL; + + dirp = opendir (path); + if (!dirp) + return NULL; + + /* Unregister fd registered by opendir() */ + _gl_unregister_dirp_fd (dirfd (dirp)); + + /* Register our fd */ + if (_gl_register_dirp_fd (fd, dirp)) + { + int saved_errno = errno; + + closedir (dirp); + + errno = saved_errno; + + dirp = NULL; + } + + return dirp; +} +# else DIR * fdopendir (int fd) { @@ -84,6 +119,7 @@ return dir; } +# endif /* Like fdopendir, except that if OLDER_DUPFD is not -1, it is known to be a dup of FD which is less than FD - 1 and which will be @@ -93,7 +129,7 @@ That way, barring race conditions, fd_clone_opendir returns a stream whose file descriptor is FD. - If REPLACE_CHDIR or CWD is null, use opendir ("/proc/self/fd/...", + If REPLACE_FCHDIR or CWD is null, use opendir ("/proc/self/fd/...", falling back on fchdir metadata. Otherwise, CWD is a saved version of the working directory; use fchdir/opendir(".")/restore_cwd(CWD). */ static DIR * @@ -156,7 +192,16 @@ if (! dir && EXPECTED_ERRNO (saved_errno)) { char const *name = _gl_directory_name (fd); - return (name ? opendir (name) : NULL); + DIR *dp = name ? opendir (name) : NULL; + + /* The caller has done an elaborate dance to arrange for opendir to + consume just the right file descriptor. If dirfd returns -1, + though, we're on a system like mingw where opendir does not + consume a file descriptor. Consume it via 'dup' instead. */ + if (dp && dirfd (dp) < 0) + dup (fd); + + return dp; } # endif errno = saved_errno; diff -Nru supermin-5.1.17/lib/fd-safer.c supermin-5.1.18/lib/fd-safer.c --- supermin-5.1.17/lib/fd-safer.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fd-safer.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Return a safer copy of a file descriptor. - Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/filenamecat.h supermin-5.1.18/lib/filenamecat.h --- supermin-5.1.17/lib/filenamecat.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/filenamecat.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2014 Free Software + Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/filenamecat-lgpl.c supermin-5.1.18/lib/filenamecat-lgpl.c --- supermin-5.1.17/lib/filenamecat-lgpl.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/filenamecat-lgpl.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Concatenate two arbitrary file names. - Copyright (C) 1996-2007, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 1996-2007, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/filename.h supermin-5.1.18/lib/filename.h --- supermin-5.1.17/lib/filename.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/filename.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* Basic filename support macros. - Copyright (C) 2001-2004, 2007-2014 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2007-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/flexmember.h supermin-5.1.18/lib/flexmember.h --- supermin-5.1.17/lib/flexmember.h 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/lib/flexmember.h 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,42 @@ +/* Sizes of structs with flexible array members. + + Copyright 2016-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Written by Paul Eggert. */ + +#include + +/* Nonzero multiple of alignment of TYPE, suitable for FLEXSIZEOF below. + On older platforms without _Alignof, use a pessimistic bound that is + safe in practice even if FLEXIBLE_ARRAY_MEMBER is 1. + On newer platforms, use _Alignof to get a tighter bound. */ + +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 +# define FLEXALIGNOF(type) (sizeof (type) & ~ (sizeof (type) - 1)) +#else +# define FLEXALIGNOF(type) _Alignof (type) +#endif + +/* Upper bound on the size of a struct of type TYPE with a flexible + array member named MEMBER that is followed by N bytes of other data. + This is not simply sizeof (TYPE) + N, since it may require + alignment on unusually picky C11 platforms, and + FLEXIBLE_ARRAY_MEMBER may be 1 on pre-C11 platforms. + Yield a value less than N if and only if arithmetic overflow occurs. */ + +#define FLEXSIZEOF(type, member, n) \ + ((offsetof (type, member) + FLEXALIGNOF (type) - 1 + (n)) \ + & ~ (FLEXALIGNOF (type) - 1)) diff -Nru supermin-5.1.17/lib/fstat.c supermin-5.1.18/lib/fstat.c --- supermin-5.1.17/lib/fstat.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fstat.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* fstat() replacement. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/fts.c supermin-5.1.18/lib/fts.c --- supermin-5.1.17/lib/fts.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fts.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Traverse a file hierarchy. - Copyright (C) 2004-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,9 +46,9 @@ #include -#if defined(LIBC_SCCS) && !defined(lint) +#if defined LIBC_SCCS && !defined GCC_LINT && !defined lint static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; -#endif /* LIBC_SCCS and not lint */ +#endif #include "fts_.h" @@ -62,7 +62,9 @@ #endif #include #include +#include #include +#include #include #include #include @@ -74,6 +76,7 @@ /* FIXME - use fcntl(F_DUPFD_CLOEXEC)/openat(O_CLOEXEC) once they are supported. */ # include "cloexec.h" +# include "flexmember.h" # include "openat.h" # include "same-inode.h" #endif @@ -189,7 +192,7 @@ #endif #ifdef NDEBUG -# define fts_assert(expr) ((void) 0) +# define fts_assert(expr) ((void) (0 && (expr))) #else # define fts_assert(expr) \ do \ @@ -663,6 +666,7 @@ # define S_MAGIC_TMPFS 0x1021994 # define S_MAGIC_NFS 0x6969 # define S_MAGIC_REISERFS 0x52654973 +# define S_MAGIC_XFS 0x58465342 # define S_MAGIC_PROC 0x9FA0 /* Return false if it is easy to determine the file system type of @@ -718,13 +722,20 @@ /* List here the file system types that lack usable dirent.d_type info, yet for which the optimization does apply. */ case S_MAGIC_REISERFS: + case S_MAGIC_XFS: return true; + /* Explicitly list here any other file system type for which the + optimization is not applicable, but need documentation. */ + case S_MAGIC_NFS: + /* NFS provides usable dirent.d_type but not necessarily for all entries + of large directories, so as per + NFS should return true. However st_nlink values are not accurate on + all implementations as per . */ + /* fall through */ case S_MAGIC_PROC: - /* Explicitly listing this or any other file system type for which - the optimization is not applicable is not necessary, but we leave - it here to document the risk. Per http://bugs.debian.org/143111, - /proc may have bogus stat.st_nlink values. */ + /* Per /proc may have + bogus stat.st_nlink values. */ /* fall through */ default: return false; @@ -1079,9 +1090,6 @@ } } else if (p->fts_flags & FTS_SYMFOLLOW) { if (FCHDIR(sp, p->fts_symfd)) { - int saved_errno = errno; - (void)close(p->fts_symfd); - __set_errno (saved_errno); p->fts_errno = errno; SET(FTS_STOP); } @@ -1091,9 +1099,15 @@ p->fts_errno = errno; SET(FTS_STOP); } - p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP; - if (p->fts_errno == 0) - LEAVE_DIR (sp, p, "3"); + + /* If the directory causes a cycle, preserve the FTS_DC flag and keep + the corresponding dev/ino pair in the hash table. It is going to be + removed when leaving the original directory. */ + if (p->fts_info != FTS_DC) { + p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP; + if (p->fts_errno == 0) + LEAVE_DIR (sp, p, "3"); + } return ISSET(FTS_STOP) ? NULL : p; } @@ -1293,6 +1307,7 @@ int dir_fd; FTSENT *cur = sp->fts_cur; bool continue_readdir = !!cur->fts_dirp; + size_t max_entries; /* When cur->fts_dirp is non-NULL, that means we should continue calling readdir on that existing DIR* pointer @@ -1354,8 +1369,7 @@ function. But when no such function is specified, we can read entries in batches that are large enough to help us with inode- sorting, yet not so large that we risk exhausting memory. */ - size_t max_entries = (sp->fts_compar == NULL - ? FTS_MAX_READDIR_ENTRIES : SIZE_MAX); + max_entries = sp->fts_compar ? SIZE_MAX : FTS_MAX_READDIR_ENTRIES; /* * Nlinks is the number of possible entries of type directory in the @@ -1447,19 +1461,30 @@ nitems = 0; while (cur->fts_dirp) { bool is_dir; + size_t d_namelen; + __set_errno (0); struct dirent *dp = readdir(cur->fts_dirp); - if (dp == NULL) + if (dp == NULL) { + if (errno) { + cur->fts_errno = errno; + /* If we've not read any items yet, treat + the error as if we can't access the dir. */ + cur->fts_info = (continue_readdir || nitems) + ? FTS_ERR : FTS_DNR; + } break; + } if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) continue; - if ((p = fts_alloc (sp, dp->d_name, - _D_EXACT_NAMLEN (dp))) == NULL) + d_namelen = _D_EXACT_NAMLEN (dp); + p = fts_alloc (sp, dp->d_name, d_namelen); + if (!p) goto mem1; - if (_D_EXACT_NAMLEN (dp) >= maxlen) { + if (d_namelen >= maxlen) { /* include space for NUL */ oldaddr = sp->fts_path; - if (! fts_palloc(sp, _D_EXACT_NAMLEN (dp) + len + 1)) { + if (! fts_palloc(sp, d_namelen + len + 1)) { /* * No more memory. Save * errno, free up the current structure and the @@ -1483,7 +1508,7 @@ maxlen = sp->fts_pathlen - len; } - new_len = len + _D_EXACT_NAMLEN (dp); + new_len = len + d_namelen; if (new_len < len) { /* * In the unlikely event that we would end up @@ -1607,7 +1632,8 @@ /* If didn't find anything, return NULL. */ if (!nitems) { - if (type == BREAD) + if (type == BREAD + && cur->fts_info != FTS_DNR && cur->fts_info != FTS_ERR) cur->fts_info = FTS_DP; fts_lfree(head); return (NULL); @@ -1900,7 +1926,7 @@ * The file name is a variable length array. Allocate the FTSENT * structure and the file name in one chunk. */ - len = sizeof(FTSENT) + namelen; + len = FLEXSIZEOF(FTSENT, fts_name, namelen + 1); if ((p = malloc(len)) == NULL) return (NULL); diff -Nru supermin-5.1.17/lib/fts-cycle.c supermin-5.1.18/lib/fts-cycle.c --- supermin-5.1.17/lib/fts-cycle.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fts-cycle.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Detect cycles in file tree walks. - Copyright (C) 2003-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2003-2006, 2009-2017 Free Software Foundation, Inc. Written by Jim Meyering. diff -Nru supermin-5.1.17/lib/fts_.h supermin-5.1.18/lib/fts_.h --- supermin-5.1.17/lib/fts_.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/fts_.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Traverse a file hierarchy. - Copyright (C) 2004-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,7 +51,13 @@ # ifdef _LIBC # include +# if __STDC_VERSION__ < 199901L +# define __FLEXIBLE_ARRAY_MEMBER 1 +# else +# define __FLEXIBLE_ARRAY_MEMBER +# endif # else +# define __FLEXIBLE_ARRAY_MEMBER FLEXIBLE_ARRAY_MEMBER # undef __THROW # define __THROW # undef __BEGIN_DECLS @@ -243,7 +249,7 @@ unsigned short int fts_instr; /* fts_set() instructions */ struct stat fts_statp[1]; /* stat(2) information */ - char fts_name[1]; /* file name */ + char fts_name[__FLEXIBLE_ARRAY_MEMBER]; /* file name */ } FTSENT; #ifndef __GNUC_PREREQ diff -Nru supermin-5.1.17/lib/getcwd-lgpl.c supermin-5.1.18/lib/getcwd-lgpl.c --- supermin-5.1.17/lib/getcwd-lgpl.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/getcwd-lgpl.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2014 Free Software Foundation, Inc. +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. This file is part of gnulib. This program is free software: you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/getdtablesize.c supermin-5.1.18/lib/getdtablesize.c --- supermin-5.1.17/lib/getdtablesize.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/getdtablesize.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* getdtablesize() function for platforms that don't have it. - Copyright (C) 2008-2014 Free Software Foundation, Inc. + Copyright (C) 2008-2017 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -84,24 +84,38 @@ return dtablesize; } -#elif HAVE_GETDTABLESIZE +#else +# include # include -# undef getdtablesize + +# ifndef RLIM_SAVED_CUR +# define RLIM_SAVED_CUR RLIM_INFINITY +# endif +# ifndef RLIM_SAVED_MAX +# define RLIM_SAVED_MAX RLIM_INFINITY +# endif + +# ifdef __CYGWIN__ + /* Cygwin 1.7.25 auto-increases the RLIMIT_NOFILE soft limit until it + hits the compile-time constant hard limit of 3200. We might as + well just report the hard limit. */ +# define rlim_cur rlim_max +# endif int -rpl_getdtablesize(void) +getdtablesize (void) { - /* To date, this replacement is only compiled for Cygwin 1.7.25, - which auto-increased the RLIMIT_NOFILE soft limit until it - hits the compile-time constant hard limit of 3200. Although - that version of cygwin supported a child process inheriting - a smaller soft limit, the smaller limit is not enforced, so - we might as well just report the hard limit. */ struct rlimit lim; - if (!getrlimit (RLIMIT_NOFILE, &lim) && lim.rlim_max != RLIM_INFINITY) - return lim.rlim_max; - return getdtablesize (); + + if (getrlimit (RLIMIT_NOFILE, &lim) == 0 + && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX + && lim.rlim_cur != RLIM_INFINITY + && lim.rlim_cur != RLIM_SAVED_CUR + && lim.rlim_cur != RLIM_SAVED_MAX) + return lim.rlim_cur; + + return INT_MAX; } #endif diff -Nru supermin-5.1.17/lib/getprogname.c supermin-5.1.18/lib/getprogname.c --- supermin-5.1.17/lib/getprogname.c 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/lib/getprogname.c 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,185 @@ +/* Program name management. + Copyright (C) 2016-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "getprogname.h" + +#include /* get program_invocation_name declaration */ +#include /* get __argv declaration */ + +#ifdef _AIX +# include +# include +# include +#endif + +#ifdef __MVS__ +# ifndef _OPEN_SYS +# define _OPEN_SYS +# endif +# include +# include +#endif + +#ifdef __hpux +# include +# include +# include +# include +#endif + +#ifdef __sgi +# include +# include +# include +# include +# include +#endif + +#include "dirname.h" + +#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ +char const * +getprogname (void) +{ +# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* glibc, BeOS */ + /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ + return program_invocation_short_name; +# elif HAVE_DECL_PROGRAM_INVOCATION_NAME /* glibc, BeOS */ + /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ + return last_component (program_invocation_name); +# elif HAVE_GETEXECNAME /* Solaris */ + /* http://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */ + const char *p = getexecname (); + if (!p) + p = "?"; + return last_component (p); +# elif HAVE_DECL___ARGV /* mingw, MSVC */ + /* https://msdn.microsoft.com/en-us/library/dn727674.aspx */ + const char *p = __argv && __argv[0] ? __argv[0] : "?"; + return last_component (p); +# elif HAVE_VAR___PROGNAME /* OpenBSD, QNX */ + /* http://man.openbsd.org/style.9 */ + /* http://www.qnx.de/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fp%2F__progname.html */ + /* Be careful to declare this only when we absolutely need it + (OpenBSD 5.1), rather than when it's available. Otherwise, + its mere declaration makes program_invocation_short_name + malfunction (have zero length) with Fedora 25's glibc. */ + extern char *__progname; + const char *p = __progname; + return p && p[0] ? p : "?"; +# elif _AIX /* AIX */ + /* Idea by Bastien ROUCARIÈS, + http://lists.gnu.org/archive/html/bug-gnulib/2010-12/msg00095.html + Reference: http:// + ibm.biz/knowctr#ssw_aix_53/com.ibm.aix.basetechref/doc/basetrf1/getprocs.htm + */ + static char *p; + static int first = 1; + if (first) + { + first = 0; + pid_t pid = getpid (); + struct procentry64 procs; + p = (0 < getprocs64 (&procs, sizeof procs, NULL, 0, &pid, 1) + ? strdup (procs.pi_comm) + : NULL); + if (!p) + p = "?"; + } + return p; +# elif defined __hpux + static char *p; + static int first = 1; + if (first) + { + first = 0; + pid_t pid = getpid (); + struct pst_status status; + p = (0 < pstat_getproc (&status, sizeof status, 0, pid) + ? strdup (status.pst_ucomm) + : NULL); + if (!p) + p = "?"; + } + return p; +# elif __MVS__ /* z/OS */ + /* https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/rtwgetp.htm */ + static char *p = "?"; + static int first = 1; + if (first) + { + pid_t pid = getpid (); + int token; + W_PSPROC buf; + first = 0; + memset (&buf, 0, sizeof(buf)); + buf.ps_cmdptr = (char *) malloc (buf.ps_cmdlen = PS_CMDBLEN_LONG); + buf.ps_conttyptr = (char *) malloc (buf.ps_conttylen = PS_CONTTYBLEN); + buf.ps_pathptr = (char *) malloc (buf.ps_pathlen = PS_PATHBLEN); + if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr) + { + for (token = 0; token >= 0; + token = w_getpsent (token, &buf, sizeof(buf))) + { + if (token > 0 && buf.ps_pid == pid) + { + char *s = strdup (last_component (buf.ps_pathptr)); + if (s) + p = s; + break; + } + } + } + free (buf.ps_cmdptr); + free (buf.ps_conttyptr); + free (buf.ps_pathptr); + } + return p; +# elif defined __sgi /* IRIX */ + char filename[50]; + int fd; + + sprintf (filename, "/proc/pinfo/%d", (int) getpid ()); + fd = open (filename, O_RDONLY); + if (0 <= fd) + { + prpsinfo_t buf; + int ioctl_ok = 0 <= ioctl (fd, PIOCPSINFO, &buf); + close (fd); + if (ioctl_ok) + { + char *name = buf.pr_fname; + char *namesize = sizeof buf.pr_fname; + char *namenul = memchr (name, '\0', namesize); + size_t namelen = namenul ? namenul - name : namesize; + char *namecopy = malloc (namelen + 1); + if (namecopy) + { + namecopy[namelen] = 0; + return memcpy (namecopy, name, namelen); + } + } + } + return NULL; +# else +# error "getprogname module not ported to this OS" +# endif +} + +#endif diff -Nru supermin-5.1.17/lib/getprogname.h supermin-5.1.18/lib/getprogname.h --- supermin-5.1.17/lib/getprogname.h 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/lib/getprogname.h 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,40 @@ +/* Program name management. + Copyright (C) 2016-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _GL_GETPROGNAME_H +#define _GL_GETPROGNAME_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Return the base name of the executing program. + On native Windows this will usually end in ".exe" or ".EXE". */ +#ifndef HAVE_GETPROGNAME +extern char const *getprogname (void) +# ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME + _GL_ATTRIBUTE_PURE +# endif + ; +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff -Nru supermin-5.1.17/lib/gettext.h supermin-5.1.18/lib/gettext.h --- supermin-5.1.17/lib/gettext.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/gettext.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU . - Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2014 Free Software + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -225,15 +225,17 @@ if (msg_ctxt_id != NULL) #endif { + int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcgettext (domain, msg_ctxt_id, category); + found_translation = (translation != msg_ctxt_id); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif - if (translation != msg_ctxt_id) + if (found_translation) return translation; } return msgid; @@ -271,15 +273,17 @@ if (msg_ctxt_id != NULL) #endif { + int found_translation; memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); msg_ctxt_id[msgctxt_len - 1] = '\004'; memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS if (msg_ctxt_id != buf) free (msg_ctxt_id); #endif - if (!(translation == msg_ctxt_id || translation == msgid_plural)) + if (found_translation) return translation; } return (n == 1 ? msgid : msgid_plural); diff -Nru supermin-5.1.17/lib/gettimeofday.c supermin-5.1.18/lib/gettimeofday.c --- supermin-5.1.17/lib/gettimeofday.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/gettimeofday.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* Provide gettimeofday for systems that don't have it or for which it's broken. - Copyright (C) 2001-2003, 2005-2007, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2007, 2009-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/hash.c supermin-5.1.18/lib/hash.c --- supermin-5.1.17/lib/hash.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/hash.c 2017-03-01 12:02:16.000000000 +0000 @@ -1,6 +1,6 @@ /* hash - hashing table processing. - Copyright (C) 1998-2004, 2006-2007, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 1998-2004, 2006-2007, 2009-2017 Free Software Foundation, Inc. Written by Jim Meyering, 1992. @@ -1116,14 +1116,6 @@ return 1; } -/* hash_insert0 is the deprecated name for hash_insert_if_absent. - . */ -int -hash_insert0 (Hash_table *table, void const *entry, void const **matched_ent) -{ - return hash_insert_if_absent (table, entry, matched_ent); -} - /* If ENTRY matches an entry already in the hash table, return the pointer to the entry from the table. Otherwise, insert ENTRY and return ENTRY. Return NULL if the storage required for insertion cannot be allocated. diff -Nru supermin-5.1.17/lib/hash.h supermin-5.1.18/lib/hash.h --- supermin-5.1.17/lib/hash.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/hash.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* hash - hashing table processing. - Copyright (C) 1998-1999, 2001, 2003, 2009-2014 Free Software Foundation, + Copyright (C) 1998-1999, 2001, 2003, 2009-2017 Free Software Foundation, Inc. Written by Jim Meyering , 1998. @@ -96,10 +96,6 @@ bool hash_rehash (Hash_table *, size_t) _GL_ATTRIBUTE_WUR; void *hash_insert (Hash_table *, const void *) _GL_ATTRIBUTE_WUR; -/* Deprecate this interface. It has been renamed to hash_insert_if_absent. */ -int hash_insert0 (Hash_table *table, /* FIXME: remove in 2013 */ - const void *entry, - const void **matched_ent) _GL_ATTRIBUTE_DEPRECATED; int hash_insert_if_absent (Hash_table *table, const void *entry, const void **matched_ent); void *hash_delete (Hash_table *, const void *); diff -Nru supermin-5.1.17/lib/intprops.h supermin-5.1.18/lib/intprops.h --- supermin-5.1.17/lib/intprops.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/intprops.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,10 +1,10 @@ /* intprops.h -- properties of integer types - Copyright (C) 2001-2005, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2001-2017 Free Software Foundation, Inc. - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -21,9 +21,9 @@ #define _GL_INTPROPS_H #include +#include -/* Return an integer value, converted to the same type as the integer - expression E after integer type promotion. V is the unconverted value. */ +/* Return a value with the common real type of E and V and the value of V. */ #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) /* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see @@ -37,59 +37,72 @@ an integer. */ #define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) -/* True if negative values of the signed integer type T use two's - complement, ones' complement, or signed magnitude representation, - respectively. Much GNU code assumes two's complement, but some - people like to be portable to all possible C hosts. */ -#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) - -/* True if the signed integer expression E uses two's complement. */ -#define _GL_INT_TWOS_COMPLEMENT(e) (~ _GL_INT_CONVERT (e, 0) == -1) - -/* True if the arithmetic type T is signed. */ +/* True if the real type T is signed. */ #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) -/* Return 1 if the integer expression E, after integer promotion, has - a signed type. */ -#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) +/* Return 1 if the real expression E, after promotion, has a + signed or floating type. */ +#define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) -/* Minimum and maximum values for integer types and expressions. These - macros have undefined behavior if T is signed and has padding bits. - If this is a problem for you, please let us know how to fix it for - your host. */ +/* Minimum and maximum values for integer types and expressions. */ + +/* The width in bits of the integer type or expression T. + Padding bits are not supported; this is checked at compile-time below. */ +#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) /* The maximum and minimum values for the integer type T. */ -#define TYPE_MINIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ - : ~ TYPE_MAXIMUM (t))) +#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t)) #define TYPE_MAXIMUM(t) \ ((t) (! TYPE_SIGNED (t) \ ? (t) -1 \ - : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) + : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) /* The maximum and minimum values for the type of the expression E, after integer promotion. E should not have side effects. */ #define _GL_INT_MINIMUM(e) \ - (_GL_INT_SIGNED (e) \ - ? - _GL_INT_TWOS_COMPLEMENT (e) - _GL_SIGNED_INT_MAXIMUM (e) \ + (EXPR_SIGNED (e) \ + ? ~ _GL_SIGNED_INT_MAXIMUM (e) \ : _GL_INT_CONVERT (e, 0)) #define _GL_INT_MAXIMUM(e) \ - (_GL_INT_SIGNED (e) \ + (EXPR_SIGNED (e) \ ? _GL_SIGNED_INT_MAXIMUM (e) \ : _GL_INT_NEGATE_CONVERT (e, 1)) #define _GL_SIGNED_INT_MAXIMUM(e) \ - (((_GL_INT_CONVERT (e, 1) << (sizeof ((e) + 0) * CHAR_BIT - 2)) - 1) * 2 + 1) + (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1) +/* Work around OpenVMS incompatibility with C99. */ +#if !defined LLONG_MAX && defined __INT64_MAX +# define LLONG_MAX __INT64_MAX +# define LLONG_MIN __INT64_MIN +#endif + +/* This include file assumes that signed types are two's complement without + padding bits; the above macros have undefined behavior otherwise. + If this is a problem for you, please let us know how to fix it for your host. + As a sanity check, test the assumption for some signed types that + bounds. */ +verify (TYPE_MINIMUM (signed char) == SCHAR_MIN); +verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX); +verify (TYPE_MINIMUM (short int) == SHRT_MIN); +verify (TYPE_MAXIMUM (short int) == SHRT_MAX); +verify (TYPE_MINIMUM (int) == INT_MIN); +verify (TYPE_MAXIMUM (int) == INT_MAX); +verify (TYPE_MINIMUM (long int) == LONG_MIN); +verify (TYPE_MAXIMUM (long int) == LONG_MAX); +#ifdef LLONG_MAX +verify (TYPE_MINIMUM (long long int) == LLONG_MIN); +verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); +#endif +/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ +#ifdef UINT_WIDTH +verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); +#endif -/* Return 1 if the __typeof__ keyword works. This could be done by +/* Does the __typeof__ keyword work? This could be done by 'configure', but for now it's easier to do it by hand. */ -#if (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ +#if (2 <= __GNUC__ \ + || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ || (0x5110 <= __SUNPRO_C && !__STDC__)) # define _GL_HAVE___TYPEOF__ 1 #else @@ -118,8 +131,7 @@ signed, this macro may overestimate the true bound by one byte when applied to unsigned types of size 2, 4, 16, ... bytes. */ #define INT_STRLEN_BOUND(t) \ - (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT \ - - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + _GL_SIGNED_TYPE_OR_EXPR (t)) /* Bound on buffer size needed to represent an integer type or expression T, @@ -224,24 +236,38 @@ ? (a) < (min) >> (b) \ : (max) >> (b) < (a)) +/* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ +#define _GL_HAS_BUILTIN_OVERFLOW (5 <= __GNUC__) + +/* True if __builtin_add_overflow_p (A, B, C) works. */ +#define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) /* The _GL*_OVERFLOW macros have the same restrictions as the *_RANGE_OVERFLOW macros, except that they do not assume that operands (e.g., A and B) have the same type as MIN and MAX. Instead, they assume that the result (e.g., A + B) has that type. */ -#define _GL_ADD_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ - : (a) < 0 ? (b) <= (a) + (b) \ - : (b) < 0 ? (a) <= (a) + (b) \ - : (a) + (b) < (b)) -#define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ - : (a) < 0 ? 1 \ - : (b) < 0 ? (a) - (b) <= (a) \ - : (a) < (b)) -#define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ - (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ - || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) +#else +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? (b) <= (a) + (b) \ + : (b) < 0 ? (a) <= (a) + (b) \ + : (a) + (b) < (b)) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? 1 \ + : (b) < 0 ? (a) - (b) <= (a) \ + : (a) < (b)) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ + || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#endif #define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ : (a) < 0 ? (b) <= (a) + (b) - 1 \ @@ -263,22 +289,29 @@ : (a) % - (b)) \ == 0) - -/* Integer overflow checks. +/* Check for integer overflow, and report low order bits of answer. The INT__OVERFLOW macros return 1 if the corresponding C operators might not yield numerically correct answers due to arithmetic overflow. - They work correctly on all known practical hosts, and do not rely + The INT__WRAPV macros also store the low-order bits of the answer. + These macros work correctly on all known practical hosts, and do not rely on undefined behavior due to signed arithmetic overflow. - Example usage: + Example usage, assuming A and B are long int: - long int i = ...; - long int j = ...; - if (INT_MULTIPLY_OVERFLOW (i, j)) - printf ("multiply would overflow"); + if (INT_MULTIPLY_OVERFLOW (a, b)) + printf ("result would overflow\n"); else - printf ("product is %ld", i * j); + printf ("result is %ld (no overflow)\n", a * b); + + Example usage with WRAPV flavor: + + long int result; + bool overflow = INT_MULTIPLY_WRAPV (a, b, &result); + printf ("result is %ld (%s)\n", result, + overflow ? "after overflow" : "no overflow"); + + Restrictions on these macros: These macros do not check for all possible numerical problems or undefined or unspecified behavior: they do not check for division @@ -287,6 +320,9 @@ These macros may evaluate their arguments zero or multiple times, so the arguments should not have side effects. + The WRAPV macros are not constant expressions. They support only + +, binary -, and *. The result type must be signed. + These macros are tuned for their last argument being a constant. Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, @@ -296,8 +332,12 @@ _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) #define INT_SUBTRACT_OVERFLOW(a, b) \ _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) -#define INT_NEGATE_OVERFLOW(a) \ - INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) +#else +# define INT_NEGATE_OVERFLOW(a) \ + INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#endif #define INT_MULTIPLY_OVERFLOW(a, b) \ _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) #define INT_DIVIDE_OVERFLOW(a, b) \ @@ -317,4 +357,102 @@ _GL_INT_MINIMUM (0 * (b) + (a)), \ _GL_INT_MAXIMUM (0 * (b) + (a))) +/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R. + Return 1 if the result overflows. See above for restrictions. */ +#define INT_ADD_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, +, __builtin_add_overflow, INT_ADD_OVERFLOW) +#define INT_SUBTRACT_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, -, __builtin_sub_overflow, INT_SUBTRACT_OVERFLOW) +#define INT_MULTIPLY_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, *, __builtin_mul_overflow, INT_MULTIPLY_OVERFLOW) + +/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 + https://llvm.org/bugs/show_bug.cgi?id=25390 + For now, assume all versions of GCC-like compilers generate bogus + warnings for _Generic. This matters only for older compilers that + lack __builtin_add_overflow. */ +#if __GNUC__ +# define _GL__GENERIC_BOGUS 1 +#else +# define _GL__GENERIC_BOGUS 0 +#endif + +/* Store the low-order bits of A B into *R, where OP specifies + the operation. BUILTIN is the builtin operation, and OVERFLOW the + overflow predicate. Return 1 if the result overflows. See above + for restrictions. */ +#if _GL_HAS_BUILTIN_OVERFLOW +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) builtin (a, b, r) +#elif 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ + (_Generic \ + (*(r), \ + signed char: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + signed char, SCHAR_MIN, SCHAR_MAX), \ + short int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + short int, SHRT_MIN, SHRT_MAX), \ + int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX), \ + long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX), \ + long long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX))) +#else +# define _GL_INT_OP_WRAPV(a, b, r, op, builtin, overflow) \ + (sizeof *(r) == sizeof (signed char) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned char, \ + signed char, SCHAR_MIN, SCHAR_MAX) \ + : sizeof *(r) == sizeof (short int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned short int, \ + short int, SHRT_MIN, SHRT_MAX) \ + : sizeof *(r) == sizeof (int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX) \ + : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow)) +# ifdef LLONG_MAX +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + (sizeof *(r) == sizeof (long int) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX)) +# else +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) +# endif +#endif + +/* Store the low-order bits of A B into *R, where the operation + is given by OP. Use the unsigned type UT for calculation to avoid + overflow problems. *R's type is T, with extremal values TMIN and + TMAX. T must be a signed integer type. Return 1 if the result + overflows. */ +#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ + (sizeof ((a) op (b)) < sizeof (t) \ + ? _GL_INT_OP_CALC1 ((t) (a), (t) (b), r, op, overflow, ut, t, tmin, tmax) \ + : _GL_INT_OP_CALC1 (a, b, r, op, overflow, ut, t, tmin, tmax)) +#define _GL_INT_OP_CALC1(a, b, r, op, overflow, ut, t, tmin, tmax) \ + ((overflow (a, b) \ + || (EXPR_SIGNED ((a) op (b)) && ((a) op (b)) < (tmin)) \ + || (tmax) < ((a) op (b))) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t, tmin, tmax), 0)) + +/* Return A B, where the operation is given by OP. Use the + unsigned type UT for calculation to avoid overflow problems. + Convert the result to type T without overflow by subtracting TMIN + from large values before converting, and adding it afterwards. + Compilers can optimize all the operations except OP. */ +#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t, tmin, tmax) \ + (((ut) (a) op (ut) (b)) <= (tmax) \ + ? (t) ((ut) (a) op (ut) (b)) \ + : ((t) (((ut) (a) op (ut) (b)) - (tmin)) + (tmin))) + #endif /* _GL_INTPROPS_H */ diff -Nru supermin-5.1.17/lib/i-ring.c supermin-5.1.18/lib/i-ring.c --- supermin-5.1.17/lib/i-ring.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/i-ring.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* a simple ring buffer - Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/i-ring.h supermin-5.1.18/lib/i-ring.h --- supermin-5.1.17/lib/i-ring.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/i-ring.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* definitions for a simple ring buffer - Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/limits.in.h supermin-5.1.18/lib/limits.in.h --- supermin-5.1.17/lib/limits.in.h 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/lib/limits.in.h 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,63 @@ +/* A GNU-like . + + Copyright 2016-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 3, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +#ifndef _@GUARD_PREFIX@_LIMITS_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_LIMITS_H@ + +#ifndef _@GUARD_PREFIX@_LIMITS_H +#define _@GUARD_PREFIX@_LIMITS_H + +/* The number of usable bits in an unsigned or signed integer type + with minimum value MIN and maximum value MAX, as an int expression + suitable in #if. Cover all known practical hosts. This + implementation exploits the fact that MAX is 1 less than a power of + 2, and merely counts the number of 1 bits in MAX; "COBn" means + "count the number of 1 bits in the low-order n bits"). */ +#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max)) +#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n)) +#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n)) +#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n)) +#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n)) +#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) +#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) + +/* Macros specified by ISO/IEC TS 18661-1:2014. */ + +#if (! defined ULLONG_WIDTH \ + && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) +# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) +# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) +# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) +# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX) +# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX) +# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX) +# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX) +# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX) +# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) +# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) +# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) +#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ + +#endif /* _@GUARD_PREFIX@_LIMITS_H */ +#endif /* _@GUARD_PREFIX@_LIMITS_H */ diff -Nru supermin-5.1.17/lib/lstat.c supermin-5.1.18/lib/lstat.c --- supermin-5.1.17/lib/lstat.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/lstat.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Work around a bug of lstat on some systems - Copyright (C) 1997-2006, 2008-2014 Free Software Foundation, Inc. + Copyright (C) 1997-2006, 2008-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/Makefile.am supermin-5.1.18/lib/Makefile.am --- supermin-5.1.17/lib/Makefile.am 2014-03-12 19:05:45.000000000 +0000 +++ supermin-5.1.18/lib/Makefile.am 2017-03-01 12:09:18.000000000 +0000 @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl fts +# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl fts sys_types AUTOMAKE_OPTIONS = 1.9.6 gnits @@ -57,6 +57,13 @@ ## end gnulib module absolute-header +## begin gnulib module assure + + +EXTRA_DIST += assure.h + +## end gnulib module assure + ## begin gnulib module at-internal @@ -364,6 +371,13 @@ ## end gnulib module filenamecat-lgpl +## begin gnulib module flexmember + + +EXTRA_DIST += flexmember.h + +## end gnulib module flexmember + ## begin gnulib module fstat @@ -400,6 +414,12 @@ ## end gnulib module getdtablesize +## begin gnulib module getprogname + +libgnu_a_SOURCES += getprogname.h getprogname.c + +## end gnulib module getprogname + ## begin gnulib module gettext-h libgnu_a_SOURCES += gettext.h @@ -438,6 +458,34 @@ ## end gnulib module intprops +## begin gnulib module limits-h + +BUILT_SOURCES += $(LIMITS_H) + +# We need the following in order to create when the system +# doesn't have one that is compatible with GNU. +if GL_GENERATE_LIMITS_H +limits.h: limits.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ + < $(srcdir)/limits.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +limits.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += limits.h limits.h-t + +EXTRA_DIST += limits.in.h + +## end gnulib module limits-h + ## begin gnulib module lstat @@ -679,6 +727,29 @@ ## end gnulib module stat +## begin gnulib module stdalign + +BUILT_SOURCES += $(STDALIGN_H) + +# We need the following in order to create when the system +# doesn't have one that works. +if GL_GENERATE_STDALIGN_H +stdalign.h: stdalign.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + cat $(srcdir)/stdalign.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +stdalign.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += stdalign.h stdalign.h-t + +EXTRA_DIST += stdalign.in.h + +## end gnulib module stdalign + ## begin gnulib module stdbool BUILT_SOURCES += $(STDBOOL_H) @@ -717,6 +788,7 @@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ + -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ < $(srcdir)/stddef.in.h; \ @@ -748,6 +820,7 @@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ + -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ @@ -769,6 +842,7 @@ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ < $(srcdir)/stdint.in.h; \ } > $@-t && \ mv $@-t $@ @@ -943,6 +1017,7 @@ -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \ -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ + -e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \ -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ @@ -972,6 +1047,7 @@ -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \ -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ + -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ @@ -994,6 +1070,7 @@ -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ @@ -1281,10 +1358,12 @@ -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ + -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ + -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ @@ -1294,6 +1373,7 @@ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ @@ -1386,7 +1466,6 @@ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ - -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ @@ -1408,6 +1487,7 @@ -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN''@|$(HAVE_DECL_GETLOGIN)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ @@ -1437,9 +1517,11 @@ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ + -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ + -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ diff -Nru supermin-5.1.17/lib/Makefile.in supermin-5.1.18/lib/Makefile.in --- supermin-5.1.17/lib/Makefile.in 2016-11-01 10:56:09.000000000 +0000 +++ supermin-5.1.18/lib/Makefile.in 2017-07-13 09:32:34.000000000 +0000 @@ -14,7 +14,7 @@ @SET_MAKE@ -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl fts +# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl fts sys_types @@ -129,17 +129,19 @@ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopendir.m4 $(top_srcdir)/m4/filenamecat.m4 \ - $(top_srcdir)/m4/fstat.m4 $(top_srcdir)/m4/fts.m4 \ - $(top_srcdir)/m4/getcwd.m4 $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/fstat.m4 \ + $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ + $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/getprogname.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/largefile.m4 \ - $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lstat.m4 \ - $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \ - $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ - $(top_srcdir)/m4/msvc-inval.m4 \ + $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ + $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/mmap-anon.m4 \ + $(top_srcdir)/m4/mode_t.m4 $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/ocaml.m4 $(top_srcdir)/m4/off_t.m4 \ $(top_srcdir)/m4/onceonly.m4 $(top_srcdir)/m4/open.m4 \ @@ -147,16 +149,16 @@ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/save-cwd.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ - $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio_h.m4 \ - $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strdup.m4 \ - $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ - $(top_srcdir)/m4/sys_socket_h.m4 \ + $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ + $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \ + $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/time_h.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ @@ -177,10 +179,10 @@ dirname-lgpl.$(OBJEXT) basename-lgpl.$(OBJEXT) \ stripslash.$(OBJEXT) exitfail.$(OBJEXT) creat-safer.$(OBJEXT) \ open-safer.$(OBJEXT) fd-hook.$(OBJEXT) \ - filenamecat-lgpl.$(OBJEXT) hash.$(OBJEXT) i-ring.$(OBJEXT) \ - openat-die.$(OBJEXT) openat-safer.$(OBJEXT) save-cwd.$(OBJEXT) \ - unistd.$(OBJEXT) dup-safer.$(OBJEXT) fd-safer.$(OBJEXT) \ - pipe-safer.$(OBJEXT) + filenamecat-lgpl.$(OBJEXT) getprogname.$(OBJEXT) \ + hash.$(OBJEXT) i-ring.$(OBJEXT) openat-die.$(OBJEXT) \ + openat-safer.$(OBJEXT) save-cwd.$(OBJEXT) unistd.$(OBJEXT) \ + dup-safer.$(OBJEXT) fd-safer.$(OBJEXT) pipe-safer.$(OBJEXT) libgnu_a_OBJECTS = $(am_libgnu_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) AM_V_P = $(am__v_P_@AM_V@) @@ -441,6 +443,7 @@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_OPENAT = @GNULIB_OPENAT@ GNULIB_OPENDIR = @GNULIB_OPENDIR@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -457,6 +460,7 @@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_PUTS = @GNULIB_PUTS@ GNULIB_PWRITE = @GNULIB_PWRITE@ +GNULIB_QSORT_R = @GNULIB_QSORT_R@ GNULIB_RANDOM = @GNULIB_RANDOM@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ @@ -508,6 +512,7 @@ GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ GNULIB_TIME_R = @GNULIB_TIME_R@ +GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ @@ -534,6 +539,7 @@ GREP = @GREP@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ @@ -549,6 +555,7 @@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -604,6 +611,7 @@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ @@ -631,6 +639,7 @@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ @@ -673,6 +682,7 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -701,6 +711,7 @@ LIBRPM_CFLAGS = @LIBRPM_CFLAGS@ LIBRPM_LIBS = @LIBRPM_LIBS@ LIBS = @LIBS@ +LIMITS_H = @LIMITS_H@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ @@ -711,6 +722,7 @@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ @@ -724,6 +736,7 @@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ @@ -837,9 +850,11 @@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ @@ -868,6 +883,7 @@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ @@ -891,6 +907,7 @@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDALIGN_H = @STDALIGN_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ @@ -898,6 +915,7 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ URPMI = @URPMI@ @@ -915,6 +933,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -971,26 +990,27 @@ noinst_HEADERS = noinst_LIBRARIES = libgnu.a noinst_LTLIBRARIES = -EXTRA_DIST = openat-priv.h openat-proc.c chdir-long.c chdir-long.h \ - cloexec.h close.c closedir.c dirent-private.h cycle-check.h \ - dev-ino.h dirent.in.h dirent--.h dirent-safer.h dirfd.c \ - dirname.h dosname.h dup.c dup2.c errno.in.h error.c error.h \ - exitfail.h fchdir.c fcntl.c fcntl.in.h fcntl--.h fcntl-safer.h \ - fd-hook.h fdopendir.c filename.h filenamecat.h fstat.c \ - fts-cycle.c fts.c fts_.h getcwd-lgpl.c getdtablesize.c \ - gettimeofday.c hash.h i-ring.h intprops.h lstat.c malloc.c \ - memchr.c memchr.valgrind mempcpy.c memrchr.c msvc-inval.c \ - msvc-inval.h msvc-nothrow.c msvc-nothrow.h open.c openat.c \ - openat.h fcntl--.h fcntl-safer.h dirent-private.h opendir.c \ - pathmax.h dirent-private.h readdir.c realloc.c same-inode.h \ - save-cwd.h $(top_srcdir)/./snippet/_Noreturn.h \ +EXTRA_DIST = assure.h openat-priv.h openat-proc.c chdir-long.c \ + chdir-long.h cloexec.h close.c closedir.c dirent-private.h \ + cycle-check.h dev-ino.h dirent.in.h dirent--.h dirent-safer.h \ + dirfd.c dirname.h dosname.h dup.c dup2.c errno.in.h error.c \ + error.h exitfail.h fchdir.c fcntl.c fcntl.in.h fcntl--.h \ + fcntl-safer.h fd-hook.h fdopendir.c filename.h filenamecat.h \ + flexmember.h fstat.c fts-cycle.c fts.c fts_.h getcwd-lgpl.c \ + getdtablesize.c gettimeofday.c hash.h i-ring.h intprops.h \ + limits.in.h lstat.c malloc.c memchr.c memchr.valgrind \ + mempcpy.c memrchr.c msvc-inval.c msvc-inval.h msvc-nothrow.c \ + msvc-nothrow.h open.c openat.c openat.h fcntl--.h \ + fcntl-safer.h dirent-private.h opendir.c pathmax.h \ + dirent-private.h readdir.c realloc.c same-inode.h save-cwd.h \ + $(top_srcdir)/./snippet/_Noreturn.h \ $(top_srcdir)/./snippet/arg-nonnull.h \ $(top_srcdir)/./snippet/c++defs.h \ - $(top_srcdir)/./snippet/warn-on-use.h stat.c stdbool.in.h \ - stddef.in.h stdint.in.h stdio.in.h stdlib.in.h strdup.c \ - strerror.c strerror-override.c strerror-override.h string.in.h \ - sys_stat.in.h sys_time.in.h sys_types.in.h time.in.h \ - unistd.in.h unistd--.h unistd-safer.h verify.h \ + $(top_srcdir)/./snippet/warn-on-use.h stat.c stdalign.in.h \ + stdbool.in.h stddef.in.h stdint.in.h stdio.in.h stdlib.in.h \ + strdup.c strerror.c strerror-override.c strerror-override.h \ + string.in.h sys_stat.in.h sys_time.in.h sys_types.in.h \ + time.in.h unistd.in.h unistd--.h unistd-safer.h verify.h \ xalloc-oversized.h # The BUILT_SOURCES created by this Makefile snippet are not used via #include @@ -1002,16 +1022,17 @@ # statements but through direct file reference. Therefore this snippet must be # present in all Makefile.am that need it. This is ensured by the applicability # 'all' defined above. -BUILT_SOURCES = dirent.h $(ERRNO_H) fcntl.h arg-nonnull.h c++defs.h \ - warn-on-use.h $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h \ - stdlib.h string.h sys/stat.h sys/time.h sys/types.h time.h \ - unistd.h +BUILT_SOURCES = dirent.h $(ERRNO_H) fcntl.h $(LIMITS_H) arg-nonnull.h \ + c++defs.h warn-on-use.h $(STDALIGN_H) $(STDBOOL_H) $(STDDEF_H) \ + $(STDINT_H) stdio.h stdlib.h string.h sys/stat.h sys/time.h \ + sys/types.h time.h unistd.h SUFFIXES = MOSTLYCLEANFILES = core *.stackdump dirent.h dirent.h-t errno.h \ - errno.h-t fcntl.h fcntl.h-t arg-nonnull.h arg-nonnull.h-t \ - c++defs.h c++defs.h-t warn-on-use.h warn-on-use.h-t stdbool.h \ - stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdio.h \ - stdio.h-t stdlib.h stdlib.h-t string.h string.h-t sys/stat.h \ + errno.h-t fcntl.h fcntl.h-t limits.h limits.h-t arg-nonnull.h \ + arg-nonnull.h-t c++defs.h c++defs.h-t warn-on-use.h \ + warn-on-use.h-t stdalign.h stdalign.h-t stdbool.h stdbool.h-t \ + stddef.h stddef.h-t stdint.h stdint.h-t stdio.h stdio.h-t \ + stdlib.h stdlib.h-t string.h string.h-t sys/stat.h \ sys/stat.h-t sys/time.h sys/time.h-t sys/types.h sys/types.h-t \ time.h time.h-t unistd.h unistd.h-t MOSTLYCLEANDIRS = sys @@ -1023,9 +1044,9 @@ libgnu_a_SOURCES = bitrotate.h bitrotate.c cloexec.c cycle-check.c \ opendir-safer.c dirname-lgpl.c basename-lgpl.c stripslash.c \ exitfail.c creat-safer.c open-safer.c fd-hook.c \ - filenamecat-lgpl.c gettext.h hash.c i-ring.c openat-die.c \ - openat-safer.c save-cwd.c unistd.c dup-safer.c fd-safer.c \ - pipe-safer.c + filenamecat-lgpl.c getprogname.h getprogname.c gettext.h \ + hash.c i-ring.c openat-die.c openat-safer.c save-cwd.c \ + unistd.c dup-safer.c fd-safer.c pipe-safer.c libgnu_a_LIBADD = $(gl_LIBOBJS) libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) EXTRA_libgnu_a_SOURCES = openat-proc.c chdir-long.c close.c closedir.c \ @@ -1134,6 +1155,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fts.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcwd-lgpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdtablesize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getprogname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i-ring.Po@am__quote@ @@ -1550,6 +1572,22 @@ < $(srcdir)/fcntl.in.h; \ } > $@-t && \ mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that is compatible with GNU. +@GL_GENERATE_LIMITS_H_TRUE@limits.h: limits.in.h $(top_builddir)/config.status +@GL_GENERATE_LIMITS_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_LIMITS_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ +@GL_GENERATE_LIMITS_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ < $(srcdir)/limits.in.h; \ +@GL_GENERATE_LIMITS_H_TRUE@ } > $@-t && \ +@GL_GENERATE_LIMITS_H_TRUE@ mv $@-t $@ +@GL_GENERATE_LIMITS_H_FALSE@limits.h: $(top_builddir)/config.status +@GL_GENERATE_LIMITS_H_FALSE@ rm -f $@ # The arg-nonnull.h that gets inserted into generated .h files is the same as # build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut # off. @@ -1577,6 +1615,17 @@ > $@-t && \ mv $@-t $@ +# We need the following in order to create when the system +# doesn't have one that works. +@GL_GENERATE_STDALIGN_H_TRUE@stdalign.h: stdalign.in.h $(top_builddir)/config.status +@GL_GENERATE_STDALIGN_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_STDALIGN_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ +@GL_GENERATE_STDALIGN_H_TRUE@ cat $(srcdir)/stdalign.in.h; \ +@GL_GENERATE_STDALIGN_H_TRUE@ } > $@-t && \ +@GL_GENERATE_STDALIGN_H_TRUE@ mv $@-t $@ +@GL_GENERATE_STDALIGN_H_FALSE@stdalign.h: $(top_builddir)/config.status +@GL_GENERATE_STDALIGN_H_FALSE@ rm -f $@ + # We need the following in order to create when the system # doesn't have one that works. @GL_GENERATE_STDBOOL_H_TRUE@stdbool.h: stdbool.in.h $(top_builddir)/config.status @@ -1598,6 +1647,7 @@ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ @GL_GENERATE_STDDEF_H_TRUE@ < $(srcdir)/stddef.in.h; \ @@ -1617,6 +1667,7 @@ @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ @@ -1638,6 +1689,7 @@ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''GNULIB_OVERRIDES_WINT_T''@/$(GNULIB_OVERRIDES_WINT_T)/g' \ @GL_GENERATE_STDINT_H_TRUE@ < $(srcdir)/stdint.in.h; \ @GL_GENERATE_STDINT_H_TRUE@ } > $@-t && \ @GL_GENERATE_STDINT_H_TRUE@ mv $@-t $@ @@ -1792,6 +1844,7 @@ -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \ -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ + -e 's/@''GNULIB_QSORT_R''@/$(GNULIB_QSORT_R)/g' \ -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \ -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ @@ -1821,6 +1874,7 @@ -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \ -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ + -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ @@ -1843,6 +1897,7 @@ -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \ -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \ -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ + -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \ -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \ -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ @@ -2057,10 +2112,12 @@ -e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \ -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \ -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \ + -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \ -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ + -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ @@ -2070,6 +2127,7 @@ -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ @@ -2152,7 +2210,6 @@ -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ - -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ @@ -2174,6 +2231,7 @@ -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN''@|$(HAVE_DECL_GETLOGIN)|g' \ -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ @@ -2203,9 +2261,11 @@ -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ + -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \ -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ + -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ diff -Nru supermin-5.1.17/lib/malloc.c supermin-5.1.18/lib/malloc.c --- supermin-5.1.17/lib/malloc.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/malloc.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* malloc() function that is glibc compatible. - Copyright (C) 1997-1998, 2006-2007, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 1997-1998, 2006-2007, 2009-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/memchr.c supermin-5.1.18/lib/memchr.c --- supermin-5.1.17/lib/memchr.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/memchr.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2014 +/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2017 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), diff -Nru supermin-5.1.17/lib/mempcpy.c supermin-5.1.18/lib/mempcpy.c --- supermin-5.1.17/lib/mempcpy.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/mempcpy.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Copy memory area and return pointer after last written byte. - Copyright (C) 2003, 2007, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2003, 2007, 2009-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/memrchr.c supermin-5.1.18/lib/memrchr.c --- supermin-5.1.17/lib/memrchr.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/memrchr.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* memrchr -- find the last occurrence of a byte in a memory block - Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2014 Free Software + Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2017 Free Software Foundation, Inc. Based on strlen implementation by Torbjorn Granlund (tege@sics.se), diff -Nru supermin-5.1.17/lib/msvc-inval.c supermin-5.1.18/lib/msvc-inval.c --- supermin-5.1.17/lib/msvc-inval.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/msvc-inval.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/msvc-inval.h supermin-5.1.18/lib/msvc-inval.h --- supermin-5.1.17/lib/msvc-inval.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/msvc-inval.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Invalid parameter handler for MSVC runtime libraries. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/msvc-nothrow.c supermin-5.1.18/lib/msvc-nothrow.c --- supermin-5.1.17/lib/msvc-nothrow.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/msvc-nothrow.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/msvc-nothrow.h supermin-5.1.18/lib/msvc-nothrow.h --- supermin-5.1.17/lib/msvc-nothrow.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/msvc-nothrow.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Wrappers that don't throw invalid parameter notifications with MSVC runtime libraries. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/openat.c supermin-5.1.18/lib/openat.c --- supermin-5.1.17/lib/openat.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/openat.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* provide a replacement openat function - Copyright (C) 2004-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/openat-die.c supermin-5.1.18/lib/openat-die.c --- supermin-5.1.17/lib/openat-die.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/openat-die.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Report a save- or restore-cwd failure in our openat replacement and then exit. - Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ #include "gettext.h" #define _(msgid) gettext (msgid) -void +_Noreturn void openat_save_fail (int errnum) { #ifndef GNULIB_LIBPOSIX @@ -49,7 +49,7 @@ during an openat emulation. The caller must ensure that fd 2 is not a just-opened fd, even when openat_safer is not in use. */ -void +_Noreturn void openat_restore_fail (int errnum) { #ifndef GNULIB_LIBPOSIX diff -Nru supermin-5.1.17/lib/openat.h supermin-5.1.18/lib/openat.h --- supermin-5.1.17/lib/openat.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/openat.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* provide a replacement openat function - Copyright (C) 2004-2006, 2008-2014 Free Software Foundation, Inc. + Copyright (C) 2004-2006, 2008-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/openat-priv.h supermin-5.1.18/lib/openat-priv.h --- supermin-5.1.17/lib/openat-priv.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/openat-priv.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Internals for openat-like functions. - Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/openat-proc.c supermin-5.1.18/lib/openat-proc.c --- supermin-5.1.17/lib/openat-proc.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/openat-proc.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Create /proc/self/fd-related names for subfiles of open directories. - Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,32 +30,21 @@ #include #include +#ifdef __KLIBC__ +# include +#endif + #include "intprops.h" -/* The results of open() in this file are not used with fchdir, - and we do not leak fds to any single-threaded code that could use stdio, - therefore save some unnecessary work in fchdir.c. - FIXME - if the kernel ever adds support for multi-thread safety for - avoiding standard fds, then we should use open_safer. */ -#undef open -#undef close - -#define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/%s" - -#define PROC_SELF_FD_NAME_SIZE_BOUND(len) \ - (sizeof PROC_SELF_FD_FORMAT - sizeof "%d%s" \ - + INT_STRLEN_BOUND (int) + (len) + 1) - - -/* Set BUF to the expansion of PROC_SELF_FD_FORMAT, using FD and FILE - respectively for %d and %s. If successful, return BUF if the - result fits in BUF, dynamically allocated memory otherwise. But - return NULL if /proc is not reliable, either because the operating - system support is lacking or because memory is low. */ +/* Set BUF to the name of the subfile of the directory identified by + FD, where the subfile is named FILE. If successful, return BUF if + the result fits in BUF, dynamically allocated memory otherwise. + Return NULL (setting errno) on error. */ char * openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file) { - static int proc_status = 0; + char *result = buf; + int dirlen; /* Make sure the caller gets ENOENT when appropriate. */ if (!*file) @@ -64,47 +53,82 @@ return buf; } - if (! proc_status) - { - /* Set PROC_STATUS to a positive value if /proc/self/fd is - reliable, and a negative value otherwise. Solaris 10 - /proc/self/fd mishandles "..", and any file name might expand - to ".." after symbolic link expansion, so avoid /proc/self/fd - if it mishandles "..". Solaris 10 has openat, but this - problem is exhibited on code that built on Solaris 8 and - running on Solaris 10. */ - - int proc_self_fd = open ("/proc/self/fd", - O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK); - if (proc_self_fd < 0) - proc_status = -1; - else - { - /* Detect whether /proc/self/fd/%i/../fd exists, where %i is the - number of a file descriptor open on /proc/self/fd. On Linux, - that name resolves to /proc/self/fd, which was opened above. - However, on Solaris, it may resolve to /proc/self/fd/fd, which - cannot exist, since all names in /proc/self/fd are numeric. */ - char dotdot_buf[PROC_SELF_FD_NAME_SIZE_BOUND (sizeof "../fd" - 1)]; - sprintf (dotdot_buf, PROC_SELF_FD_FORMAT, proc_self_fd, "../fd"); - proc_status = access (dotdot_buf, F_OK) ? -1 : 1; - close (proc_self_fd); - } - } +#ifndef __KLIBC__ +# define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/" + { + enum { + PROC_SELF_FD_DIR_SIZE_BOUND + = (sizeof PROC_SELF_FD_FORMAT - (sizeof "%d" - 1) + + INT_STRLEN_BOUND (int)) + }; + + static int proc_status = 0; + if (! proc_status) + { + /* Set PROC_STATUS to a positive value if /proc/self/fd is + reliable, and a negative value otherwise. Solaris 10 + /proc/self/fd mishandles "..", and any file name might expand + to ".." after symbolic link expansion, so avoid /proc/self/fd + if it mishandles "..". Solaris 10 has openat, but this + problem is exhibited on code that built on Solaris 8 and + running on Solaris 10. */ + + int proc_self_fd = open ("/proc/self/fd", + O_SEARCH | O_DIRECTORY | O_NOCTTY | O_NONBLOCK); + if (proc_self_fd < 0) + proc_status = -1; + else + { + /* Detect whether /proc/self/fd/%i/../fd exists, where %i is the + number of a file descriptor open on /proc/self/fd. On Linux, + that name resolves to /proc/self/fd, which was opened above. + However, on Solaris, it may resolve to /proc/self/fd/fd, which + cannot exist, since all names in /proc/self/fd are numeric. */ + char dotdot_buf[PROC_SELF_FD_DIR_SIZE_BOUND + sizeof "../fd" - 1]; + sprintf (dotdot_buf, PROC_SELF_FD_FORMAT "../fd", proc_self_fd); + proc_status = access (dotdot_buf, F_OK) ? -1 : 1; + close (proc_self_fd); + } + } + + if (proc_status < 0) + return NULL; + else + { + size_t bufsize = PROC_SELF_FD_DIR_SIZE_BOUND + strlen (file); + if (OPENAT_BUFFER_SIZE < bufsize) + { + result = malloc (bufsize); + if (! result) + return NULL; + } + + dirlen = sprintf (result, PROC_SELF_FD_FORMAT, fd); + } + } +#else + /* OS/2 kLIBC provides a function to retrieve a path from a fd. */ + { + char dir[_MAX_PATH]; + size_t bufsize; + + if (__libc_Back_ioFHToPath (fd, dir, sizeof dir)) + return NULL; + + dirlen = strlen (dir); + bufsize = dirlen + 1 + strlen (file) + 1; /* 1 for '/', 1 for null */ + if (OPENAT_BUFFER_SIZE < bufsize) + { + result = malloc (bufsize); + if (! result) + return NULL; + } + + strcpy (result, dir); + result[dirlen++] = '/'; + } +#endif - if (proc_status < 0) - return NULL; - else - { - size_t bufsize = PROC_SELF_FD_NAME_SIZE_BOUND (strlen (file)); - char *result = buf; - if (OPENAT_BUFFER_SIZE < bufsize) - { - result = malloc (bufsize); - if (! result) - return NULL; - } - sprintf (result, PROC_SELF_FD_FORMAT, fd, file); - return result; - } + strcpy (result + dirlen, file); + return result; } diff -Nru supermin-5.1.17/lib/openat-safer.c supermin-5.1.18/lib/openat-safer.c --- supermin-5.1.17/lib/openat-safer.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/openat-safer.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Invoke openat, but avoid some glitches. - Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/open.c supermin-5.1.18/lib/open.c --- supermin-5.1.17/lib/open.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/open.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Open a descriptor to a file. - Copyright (C) 2007-2014 Free Software Foundation, Inc. + Copyright (C) 2007-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/opendir.c supermin-5.1.18/lib/opendir.c --- supermin-5.1.17/lib/opendir.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/opendir.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Start reading the entries of a directory. - Copyright (C) 2006-2014 Free Software Foundation, Inc. + Copyright (C) 2006-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,6 +40,11 @@ # include #endif +#ifdef __KLIBC__ +# include +# include +#endif + DIR * opendir (const char *dir_name) { @@ -51,6 +56,22 @@ if (dirp == NULL) return NULL; +# ifdef __KLIBC__ + { + int fd = open (dir_name, O_RDONLY); + if (fd == -1 || _gl_register_dirp_fd (fd, dirp)) + { + int saved_errno = errno; + + close (fd); + closedir (dirp); + + errno = saved_errno; + + return NULL; + } + } +# endif #else char dir_name_mask[MAX_PATH + 1 + 1 + 1]; diff -Nru supermin-5.1.17/lib/opendir-safer.c supermin-5.1.18/lib/opendir-safer.c --- supermin-5.1.17/lib/opendir-safer.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/opendir-safer.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Invoke opendir, but avoid some glitches. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/open-safer.c supermin-5.1.18/lib/open-safer.c --- supermin-5.1.17/lib/open-safer.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/open-safer.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Invoke open, but avoid some glitches. - Copyright (C) 2005-2006, 2008-2014 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/pathmax.h supermin-5.1.18/lib/pathmax.h --- supermin-5.1.17/lib/pathmax.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/pathmax.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Define PATH_MAX somehow. Requires sys/types.h. - Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2014 Free Software + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/pipe-safer.c supermin-5.1.18/lib/pipe-safer.c --- supermin-5.1.17/lib/pipe-safer.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/pipe-safer.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Invoke pipe, but avoid some glitches. - Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/readdir.c supermin-5.1.18/lib/readdir.c --- supermin-5.1.17/lib/readdir.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/readdir.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Read the next entry of a directory. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/realloc.c supermin-5.1.18/lib/realloc.c --- supermin-5.1.17/lib/realloc.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/realloc.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* realloc() function that is glibc compatible. - Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2014 Free Software + Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/same-inode.h supermin-5.1.18/lib/same-inode.h --- supermin-5.1.17/lib/same-inode.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/same-inode.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ -/* Determine whether two stat buffers refer to the same file. +/* Determine whether two stat buffers are known to refer to the same file. - Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,6 +24,10 @@ && (a).st_ino[1] == (b).st_ino[1] \ && (a).st_ino[2] == (b).st_ino[2] \ && (a).st_dev == (b).st_dev) +# elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +/* On MinGW, struct stat lacks necessary info, so always return 0. + Callers can use !a.st_ino to deduce that the information is unknown. */ +# define SAME_INODE(a, b) 0 # else # define SAME_INODE(a, b) \ ((a).st_ino == (b).st_ino \ diff -Nru supermin-5.1.17/lib/save-cwd.c supermin-5.1.18/lib/save-cwd.c --- supermin-5.1.17/lib/save-cwd.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/save-cwd.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* save-cwd.c -- Save and restore current working directory. - Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2014 Free Software + Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/save-cwd.h supermin-5.1.18/lib/save-cwd.h --- supermin-5.1.17/lib/save-cwd.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/save-cwd.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Save and restore current working directory. - Copyright (C) 1995, 1997-1998, 2003, 2009-2014 Free Software Foundation, + Copyright (C) 1995, 1997-1998, 2003, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/stat.c supermin-5.1.18/lib/stat.c --- supermin-5.1.17/lib/stat.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/stat.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Work around platform bugs in stat. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/stdalign.in.h supermin-5.1.18/lib/stdalign.in.h --- supermin-5.1.17/lib/stdalign.in.h 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/lib/stdalign.in.h 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,121 @@ +/* A substitute for ISO C11 . + + Copyright 2011-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +/* Written by Paul Eggert and Bruno Haible. */ + +#ifndef _GL_STDALIGN_H +#define _GL_STDALIGN_H + +/* ISO C11 for platforms that lack it. + + References: + ISO C11 (latest free draft + ) + sections 6.5.3.4, 6.7.5, 7.15. + C++11 (latest free draft + ) + section 18.10. */ + +/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment + requirement of a structure member (i.e., slot or field) that is of + type TYPE, as an integer constant expression. + + This differs from GCC's __alignof__ operator, which can yield a + better-performing alignment for an object of that type. For + example, on x86 with GCC, __alignof__ (double) and __alignof__ + (long long) are 8, whereas alignof (double) and alignof (long long) + are 4 unless the option '-malign-double' is used. + + The result cannot be used as a value for an 'enum' constant, if you + want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. + + Include for offsetof. */ +#include + +/* FreeBSD 9.1 , included by and lots of other + standard headers, defines conflicting implementations of _Alignas + and _Alignof that are no better than ours; override them. */ +#undef _Alignas +#undef _Alignof + +/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 + . */ +#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ + || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9))) +# ifdef __cplusplus +# if 201103 <= __cplusplus +# define _Alignof(type) alignof (type) +# else + template struct __alignof_helper { char __a; __t __b; }; +# define _Alignof(type) offsetof (__alignof_helper, __b) +# endif +# else +# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) +# endif +#endif +#if ! (defined __cplusplus && 201103 <= __cplusplus) +# define alignof _Alignof +#endif +#define __alignof_is_defined 1 + +/* alignas (A), also known as _Alignas (A), aligns a variable or type + to the alignment A, where A is an integer constant expression. For + example: + + int alignas (8) foo; + struct s { int a; int alignas (8) bar; }; + + aligns the address of FOO and the offset of BAR to be multiples of 8. + + A should be a power of two that is at least the type's alignment + and at most the implementation's alignment limit. This limit is + 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable + to MSVC through at least version 10.0, A should be an integer + constant, as MSVC does not support expressions such as 1 << 3. + To be portable to Sun C 5.11, do not align auto variables to + anything stricter than their default alignment. + + The following C11 requirements are not supported here: + + - If A is zero, alignas has no effect. + - alignas can be used multiple times; the strictest one wins. + - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). + + */ + +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 +# if defined __cplusplus && 201103 <= __cplusplus +# define _Alignas(a) alignas (a) +# elif ((defined __APPLE__ && defined __MACH__ \ + ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + : __GNUC__) \ + || 061200 <= __HP_cc || 061200 <= __HP_aCC \ + || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__) +# define _Alignas(a) __attribute__ ((__aligned__ (a))) +# elif 1300 <= _MSC_VER +# define _Alignas(a) __declspec (align (a)) +# endif +#endif +#if ((defined _Alignas && ! (defined __cplusplus && 201103 <= __cplusplus)) \ + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) +# define alignas _Alignas +#endif +#if defined alignas || (defined __cplusplus && 201103 <= __cplusplus) +# define __alignas_is_defined 1 +#endif + +#endif /* _GL_STDALIGN_H */ diff -Nru supermin-5.1.17/lib/stdbool.in.h supermin-5.1.18/lib/stdbool.in.h --- supermin-5.1.17/lib/stdbool.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/stdbool.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2003, 2006-2014 Free Software Foundation, Inc. +/* Copyright (C) 2001-2003, 2006-2017 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/stddef.in.h supermin-5.1.18/lib/stddef.in.h --- supermin-5.1.17/lib/stddef.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/stddef.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* A substitute for POSIX 2008 , for platforms that have issues. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,7 +39,6 @@ # if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) # ifdef __need_wint_t -# undef _@GUARD_PREFIX@_STDDEF_H # define _GL_STDDEF_WINT_T # endif # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ @@ -54,33 +53,58 @@ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ -# ifndef _@GUARD_PREFIX@_STDDEF_H -# define _@GUARD_PREFIX@_STDDEF_H - /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ -#if @REPLACE_NULL@ -# undef NULL -# ifdef __cplusplus +# if (@REPLACE_NULL@ \ + && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T)) +# undef NULL +# ifdef __cplusplus /* ISO C++ says that the macro NULL must expand to an integer constant expression, hence '((void *) 0)' is not allowed in C++. */ -# if __GNUG__ >= 3 +# if __GNUG__ >= 3 /* GNU C++ has a __null macro that behaves like an integer ('int' or 'long') but has the same size as a pointer. Use that, to avoid warnings. */ -# define NULL __null -# else -# define NULL 0L +# define NULL __null +# else +# define NULL 0L +# endif +# else +# define NULL ((void *) 0) +# endif # endif -# else -# define NULL ((void *) 0) -# endif -#endif + +# ifndef _@GUARD_PREFIX@_STDDEF_H +# define _@GUARD_PREFIX@_STDDEF_H /* Some platforms lack wchar_t. */ #if !@HAVE_WCHAR_T@ # define wchar_t int #endif +/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is + a hack in case the configure-time test was done with g++ even though + we are currently compiling with gcc. */ +#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) +/* On the x86, the maximum storage alignment of double, long, etc. is 4, + but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, + and the C11 standard allows this. Work around this problem by + using __alignof__ (which returns 8 for double) rather than _Alignof + (which returns 4), and align each union member accordingly. */ +# ifdef __GNUC__ +# define _GL_STDDEF_ALIGNAS(type) \ + __attribute__ ((__aligned__ (__alignof__ (type)))) +# else +# define _GL_STDDEF_ALIGNAS(type) /* */ +# endif +typedef union +{ + char *__p _GL_STDDEF_ALIGNAS (char *); + double __d _GL_STDDEF_ALIGNAS (double); + long double __ld _GL_STDDEF_ALIGNAS (long double); + long int __i _GL_STDDEF_ALIGNAS (long int); +} max_align_t; +#endif + # endif /* _@GUARD_PREFIX@_STDDEF_H */ # endif /* _@GUARD_PREFIX@_STDDEF_H */ #endif /* __need_XXX */ diff -Nru supermin-5.1.17/lib/stdint.in.h supermin-5.1.18/lib/stdint.in.h --- supermin-5.1.17/lib/stdint.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/stdint.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001-2002, 2004-2014 Free Software Foundation, Inc. +/* Copyright (C) 2001-2002, 2004-2017 Free Software Foundation, Inc. Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. This file is part of gnulib. @@ -38,8 +38,7 @@ other system header files; just include the system's . Ideally we should test __BIONIC__ here, but it is only defined after has been included; hence test __ANDROID__ instead. */ -#if defined __ANDROID__ \ - && defined _SYS_TYPES_H_ && !defined __need_size_t +#if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H # @INCLUDE_NEXT@ @NEXT_STDINT_H@ #else @@ -80,54 +79,60 @@ #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H #define _@GUARD_PREFIX@_STDINT_H +/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, + LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ +#include + +/* Override WINT_MIN and WINT_MAX if gnulib's or overrides + wint_t. */ +#if @GNULIB_OVERRIDES_WINT_T@ +# undef WINT_MIN +# undef WINT_MAX +# define WINT_MIN 0x0U +# define WINT_MAX 0xffffffffU +#endif + +#if ! @HAVE_C99_STDINT_H@ + /* defines some of the stdint.h types as well, on glibc, IRIX 6.5, and OpenBSD 3.8 (via ). AIX 5.2 isn't needed and causes troubles. Mac OS X 10.4.6 includes (which is us), but relies on the system definitions, so include after @NEXT_STDINT_H@. */ -#if @HAVE_SYS_TYPES_H@ && ! defined _AIX -# include -#endif - -/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, - LONG_MIN, LONG_MAX, ULONG_MAX. */ -#include +# if @HAVE_SYS_TYPES_H@ && ! defined _AIX +# include +# endif -#if @HAVE_INTTYPES_H@ +# if @HAVE_INTTYPES_H@ /* In OpenBSD 3.8, includes , which defines int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. also defines intptr_t and uintptr_t. */ -# include -#elif @HAVE_SYS_INTTYPES_H@ +# include +# elif @HAVE_SYS_INTTYPES_H@ /* Solaris 7 has the types except the *_fast*_t types, and the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ -# include -#endif +# include +# endif -#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ +# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ /* Linux libc4 >= 4.6.7 and libc5 have a that defines int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is included by . */ -# include -#endif +# include +# endif -#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H +# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* Minimum and maximum values for an integer type under the usual assumption. Return an unspecified value if BITS == 0, adding a check to pacify picky compilers. */ -#define _STDINT_MIN(signed, bits, zero) \ - ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) +# define _STDINT_MIN(signed, bits, zero) \ + ((signed) ? ~ _STDINT_MAX (signed, bits, zero) : (zero)) -#define _STDINT_MAX(signed, bits, zero) \ - ((signed) \ - ? ~ _STDINT_MIN (signed, bits, zero) \ - : /* The expression for the unsigned case. The subtraction of (signed) \ - is a nop in the unsigned case and avoids "signed integer overflow" \ - warnings in the signed case. */ \ - ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) +# define _STDINT_MAX(signed, bits, zero) \ + (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) #if !GNULIB_defined_stdint_types @@ -136,26 +141,26 @@ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. */ -#undef int8_t -#undef uint8_t +# undef int8_t +# undef uint8_t typedef signed char gl_int8_t; typedef unsigned char gl_uint8_t; -#define int8_t gl_int8_t -#define uint8_t gl_uint8_t +# define int8_t gl_int8_t +# define uint8_t gl_uint8_t -#undef int16_t -#undef uint16_t +# undef int16_t +# undef uint16_t typedef short int gl_int16_t; typedef unsigned short int gl_uint16_t; -#define int16_t gl_int16_t -#define uint16_t gl_uint16_t +# define int16_t gl_int16_t +# define uint16_t gl_uint16_t -#undef int32_t -#undef uint32_t +# undef int32_t +# undef uint32_t typedef int gl_int32_t; typedef unsigned int gl_uint32_t; -#define int32_t gl_int32_t -#define uint32_t gl_uint32_t +# define int32_t gl_int32_t +# define uint32_t gl_uint32_t /* If the system defines INT64_MAX, assume int64_t works. That way, if the underlying platform defines int64_t to be a 64-bit long long @@ -163,54 +168,54 @@ int, which would mess up C++ name mangling. We must use #ifdef rather than #if, to avoid an error with HP-UX 10.20 cc. */ -#ifdef INT64_MAX -# define GL_INT64_T -#else +# ifdef INT64_MAX +# define GL_INT64_T +# else /* Do not undefine int64_t if gnulib is not being used with 64-bit types, since otherwise it breaks platforms like Tandem/NSK. */ -# if LONG_MAX >> 31 >> 31 == 1 -# undef int64_t +# if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t typedef long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -# elif defined _MSC_VER -# undef int64_t +# define int64_t gl_int64_t +# define GL_INT64_T +# elif defined _MSC_VER +# undef int64_t typedef __int64 gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T -# elif @HAVE_LONG_LONG_INT@ -# undef int64_t +# define int64_t gl_int64_t +# define GL_INT64_T +# elif @HAVE_LONG_LONG_INT@ +# undef int64_t typedef long long int gl_int64_t; -# define int64_t gl_int64_t -# define GL_INT64_T +# define int64_t gl_int64_t +# define GL_INT64_T +# endif # endif -#endif -#ifdef UINT64_MAX -# define GL_UINT64_T -#else -# if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# undef uint64_t -typedef unsigned long int gl_uint64_t; -# define uint64_t gl_uint64_t +# ifdef UINT64_MAX # define GL_UINT64_T -# elif defined _MSC_VER -# undef uint64_t +# else +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t +typedef unsigned long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif defined _MSC_VER +# undef uint64_t typedef unsigned __int64 gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T -# elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# undef uint64_t +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t typedef unsigned long long int gl_uint64_t; -# define uint64_t gl_uint64_t -# define GL_UINT64_T +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# endif # endif -#endif /* Avoid collision with Solaris 2.5.1 etc. */ -#define _UINT8_T -#define _UINT32_T -#define _UINT64_T +# define _UINT8_T +# define _UINT32_T +# define _UINT64_T /* 7.18.1.2. Minimum-width integer types */ @@ -219,26 +224,26 @@ types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types are the same as the corresponding N_t types. */ -#undef int_least8_t -#undef uint_least8_t -#undef int_least16_t -#undef uint_least16_t -#undef int_least32_t -#undef uint_least32_t -#undef int_least64_t -#undef uint_least64_t -#define int_least8_t int8_t -#define uint_least8_t uint8_t -#define int_least16_t int16_t -#define uint_least16_t uint16_t -#define int_least32_t int32_t -#define uint_least32_t uint32_t -#ifdef GL_INT64_T -# define int_least64_t int64_t -#endif -#ifdef GL_UINT64_T -# define uint_least64_t uint64_t -#endif +# undef int_least8_t +# undef uint_least8_t +# undef int_least16_t +# undef uint_least16_t +# undef int_least32_t +# undef uint_least32_t +# undef int_least64_t +# undef uint_least64_t +# define int_least8_t int8_t +# define uint_least8_t uint8_t +# define int_least16_t int16_t +# define uint_least16_t uint16_t +# define int_least32_t int32_t +# define uint_least32_t uint32_t +# ifdef GL_INT64_T +# define int_least64_t int64_t +# endif +# ifdef GL_UINT64_T +# define uint_least64_t uint64_t +# endif /* 7.18.1.3. Fastest minimum-width integer types */ @@ -251,50 +256,55 @@ uses types consistent with glibc, as that lessens the chance of incompatibility with older GNU hosts. */ -#undef int_fast8_t -#undef uint_fast8_t -#undef int_fast16_t -#undef uint_fast16_t -#undef int_fast32_t -#undef uint_fast32_t -#undef int_fast64_t -#undef uint_fast64_t +# undef int_fast8_t +# undef uint_fast8_t +# undef int_fast16_t +# undef uint_fast16_t +# undef int_fast32_t +# undef uint_fast32_t +# undef int_fast64_t +# undef uint_fast64_t typedef signed char gl_int_fast8_t; typedef unsigned char gl_uint_fast8_t; -#ifdef __sun +# ifdef __sun /* Define types compatible with SunOS 5.10, so that code compiled under earlier SunOS versions works with code compiled under SunOS 5.10. */ typedef int gl_int_fast32_t; typedef unsigned int gl_uint_fast32_t; -#else +# else typedef long int gl_int_fast32_t; typedef unsigned long int gl_uint_fast32_t; -#endif +# endif typedef gl_int_fast32_t gl_int_fast16_t; typedef gl_uint_fast32_t gl_uint_fast16_t; -#define int_fast8_t gl_int_fast8_t -#define uint_fast8_t gl_uint_fast8_t -#define int_fast16_t gl_int_fast16_t -#define uint_fast16_t gl_uint_fast16_t -#define int_fast32_t gl_int_fast32_t -#define uint_fast32_t gl_uint_fast32_t -#ifdef GL_INT64_T -# define int_fast64_t int64_t -#endif -#ifdef GL_UINT64_T -# define uint_fast64_t uint64_t -#endif +# define int_fast8_t gl_int_fast8_t +# define uint_fast8_t gl_uint_fast8_t +# define int_fast16_t gl_int_fast16_t +# define uint_fast16_t gl_uint_fast16_t +# define int_fast32_t gl_int_fast32_t +# define uint_fast32_t gl_uint_fast32_t +# ifdef GL_INT64_T +# define int_fast64_t int64_t +# endif +# ifdef GL_UINT64_T +# define uint_fast64_t uint64_t +# endif /* 7.18.1.4. Integer types capable of holding object pointers */ -#undef intptr_t -#undef uintptr_t +/* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own + definitions of intptr_t and uintptr_t (which use int and unsigned) + to avoid clashes with declarations of system functions like sbrk. */ +# ifndef _INTPTR_T_DECLARED +# undef intptr_t +# undef uintptr_t typedef long int gl_intptr_t; typedef unsigned long int gl_uintptr_t; -#define intptr_t gl_intptr_t -#define uintptr_t gl_uintptr_t +# define intptr_t gl_intptr_t +# define uintptr_t gl_uintptr_t +# endif /* 7.18.1.5. Greatest-width integer types */ @@ -305,33 +315,33 @@ similarly for UINTMAX_MAX and uintmax_t. This avoids problems with assuming one type where another is used by the system. */ -#ifndef INTMAX_MAX -# undef INTMAX_C -# undef intmax_t -# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# ifndef INTMAX_MAX +# undef INTMAX_C +# undef intmax_t +# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 typedef long long int gl_intmax_t; -# define intmax_t gl_intmax_t -# elif defined GL_INT64_T -# define intmax_t int64_t -# else +# define intmax_t gl_intmax_t +# elif defined GL_INT64_T +# define intmax_t int64_t +# else typedef long int gl_intmax_t; -# define intmax_t gl_intmax_t +# define intmax_t gl_intmax_t +# endif # endif -#endif -#ifndef UINTMAX_MAX -# undef UINTMAX_C -# undef uintmax_t -# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# ifndef UINTMAX_MAX +# undef UINTMAX_C +# undef uintmax_t +# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 typedef unsigned long long int gl_uintmax_t; -# define uintmax_t gl_uintmax_t -# elif defined GL_UINT64_T -# define uintmax_t uint64_t -# else +# define uintmax_t gl_uintmax_t +# elif defined GL_UINT64_T +# define uintmax_t uint64_t +# else typedef unsigned long int gl_uintmax_t; -# define uintmax_t gl_uintmax_t +# define uintmax_t gl_uintmax_t +# endif # endif -#endif /* Verify that intmax_t and uintmax_t have the same size. Too much code breaks if this is not the case. If this check fails, the reason is likely @@ -339,8 +349,8 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) ? 1 : -1]; -#define GNULIB_defined_stdint_types 1 -#endif /* !GNULIB_defined_stdint_types */ +# define GNULIB_defined_stdint_types 1 +# endif /* !GNULIB_defined_stdint_types */ /* 7.18.2. Limits of specified-width integer types */ @@ -349,37 +359,37 @@ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits. */ -#undef INT8_MIN -#undef INT8_MAX -#undef UINT8_MAX -#define INT8_MIN (~ INT8_MAX) -#define INT8_MAX 127 -#define UINT8_MAX 255 - -#undef INT16_MIN -#undef INT16_MAX -#undef UINT16_MAX -#define INT16_MIN (~ INT16_MAX) -#define INT16_MAX 32767 -#define UINT16_MAX 65535 - -#undef INT32_MIN -#undef INT32_MAX -#undef UINT32_MAX -#define INT32_MIN (~ INT32_MAX) -#define INT32_MAX 2147483647 -#define UINT32_MAX 4294967295U +# undef INT8_MIN +# undef INT8_MAX +# undef UINT8_MAX +# define INT8_MIN (~ INT8_MAX) +# define INT8_MAX 127 +# define UINT8_MAX 255 + +# undef INT16_MIN +# undef INT16_MAX +# undef UINT16_MAX +# define INT16_MIN (~ INT16_MAX) +# define INT16_MAX 32767 +# define UINT16_MAX 65535 + +# undef INT32_MIN +# undef INT32_MAX +# undef UINT32_MAX +# define INT32_MIN (~ INT32_MAX) +# define INT32_MAX 2147483647 +# define UINT32_MAX 4294967295U -#if defined GL_INT64_T && ! defined INT64_MAX +# if defined GL_INT64_T && ! defined INT64_MAX /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 evaluates the latter incorrectly in preprocessor expressions. */ -# define INT64_MIN (- INTMAX_C (1) << 63) -# define INT64_MAX INTMAX_C (9223372036854775807) -#endif +# define INT64_MIN (- INTMAX_C (1) << 63) +# define INT64_MAX INTMAX_C (9223372036854775807) +# endif -#if defined GL_UINT64_T && ! defined UINT64_MAX -# define UINT64_MAX UINTMAX_C (18446744073709551615) -#endif +# if defined GL_UINT64_T && ! defined UINT64_MAX +# define UINT64_MAX UINTMAX_C (18446744073709551615) +# endif /* 7.18.2.2. Limits of minimum-width integer types */ @@ -387,38 +397,38 @@ types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types are the same as the corresponding N_t types. */ -#undef INT_LEAST8_MIN -#undef INT_LEAST8_MAX -#undef UINT_LEAST8_MAX -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define UINT_LEAST8_MAX UINT8_MAX - -#undef INT_LEAST16_MIN -#undef INT_LEAST16_MAX -#undef UINT_LEAST16_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define UINT_LEAST16_MAX UINT16_MAX - -#undef INT_LEAST32_MIN -#undef INT_LEAST32_MAX -#undef UINT_LEAST32_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define UINT_LEAST32_MAX UINT32_MAX - -#undef INT_LEAST64_MIN -#undef INT_LEAST64_MAX -#ifdef GL_INT64_T -# define INT_LEAST64_MIN INT64_MIN -# define INT_LEAST64_MAX INT64_MAX -#endif - -#undef UINT_LEAST64_MAX -#ifdef GL_UINT64_T -# define UINT_LEAST64_MAX UINT64_MAX -#endif +# undef INT_LEAST8_MIN +# undef INT_LEAST8_MAX +# undef UINT_LEAST8_MAX +# define INT_LEAST8_MIN INT8_MIN +# define INT_LEAST8_MAX INT8_MAX +# define UINT_LEAST8_MAX UINT8_MAX + +# undef INT_LEAST16_MIN +# undef INT_LEAST16_MAX +# undef UINT_LEAST16_MAX +# define INT_LEAST16_MIN INT16_MIN +# define INT_LEAST16_MAX INT16_MAX +# define UINT_LEAST16_MAX UINT16_MAX + +# undef INT_LEAST32_MIN +# undef INT_LEAST32_MAX +# undef UINT_LEAST32_MAX +# define INT_LEAST32_MIN INT32_MIN +# define INT_LEAST32_MAX INT32_MAX +# define UINT_LEAST32_MAX UINT32_MAX + +# undef INT_LEAST64_MIN +# undef INT_LEAST64_MAX +# ifdef GL_INT64_T +# define INT_LEAST64_MIN INT64_MIN +# define INT_LEAST64_MAX INT64_MAX +# endif + +# undef UINT_LEAST64_MAX +# ifdef GL_UINT64_T +# define UINT_LEAST64_MAX UINT64_MAX +# endif /* 7.18.2.3. Limits of fastest minimum-width integer types */ @@ -426,117 +436,117 @@ types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types are taken from the same list of types. */ -#undef INT_FAST8_MIN -#undef INT_FAST8_MAX -#undef UINT_FAST8_MAX -#define INT_FAST8_MIN SCHAR_MIN -#define INT_FAST8_MAX SCHAR_MAX -#define UINT_FAST8_MAX UCHAR_MAX - -#undef INT_FAST16_MIN -#undef INT_FAST16_MAX -#undef UINT_FAST16_MAX -#define INT_FAST16_MIN INT_FAST32_MIN -#define INT_FAST16_MAX INT_FAST32_MAX -#define UINT_FAST16_MAX UINT_FAST32_MAX - -#undef INT_FAST32_MIN -#undef INT_FAST32_MAX -#undef UINT_FAST32_MAX -#ifdef __sun -# define INT_FAST32_MIN INT_MIN -# define INT_FAST32_MAX INT_MAX -# define UINT_FAST32_MAX UINT_MAX -#else -# define INT_FAST32_MIN LONG_MIN -# define INT_FAST32_MAX LONG_MAX -# define UINT_FAST32_MAX ULONG_MAX -#endif +# undef INT_FAST8_MIN +# undef INT_FAST8_MAX +# undef UINT_FAST8_MAX +# define INT_FAST8_MIN SCHAR_MIN +# define INT_FAST8_MAX SCHAR_MAX +# define UINT_FAST8_MAX UCHAR_MAX + +# undef INT_FAST16_MIN +# undef INT_FAST16_MAX +# undef UINT_FAST16_MAX +# define INT_FAST16_MIN INT_FAST32_MIN +# define INT_FAST16_MAX INT_FAST32_MAX +# define UINT_FAST16_MAX UINT_FAST32_MAX + +# undef INT_FAST32_MIN +# undef INT_FAST32_MAX +# undef UINT_FAST32_MAX +# ifdef __sun +# define INT_FAST32_MIN INT_MIN +# define INT_FAST32_MAX INT_MAX +# define UINT_FAST32_MAX UINT_MAX +# else +# define INT_FAST32_MIN LONG_MIN +# define INT_FAST32_MAX LONG_MAX +# define UINT_FAST32_MAX ULONG_MAX +# endif -#undef INT_FAST64_MIN -#undef INT_FAST64_MAX -#ifdef GL_INT64_T -# define INT_FAST64_MIN INT64_MIN -# define INT_FAST64_MAX INT64_MAX -#endif +# undef INT_FAST64_MIN +# undef INT_FAST64_MAX +# ifdef GL_INT64_T +# define INT_FAST64_MIN INT64_MIN +# define INT_FAST64_MAX INT64_MAX +# endif -#undef UINT_FAST64_MAX -#ifdef GL_UINT64_T -# define UINT_FAST64_MAX UINT64_MAX -#endif +# undef UINT_FAST64_MAX +# ifdef GL_UINT64_T +# define UINT_FAST64_MAX UINT64_MAX +# endif /* 7.18.2.4. Limits of integer types capable of holding object pointers */ -#undef INTPTR_MIN -#undef INTPTR_MAX -#undef UINTPTR_MAX -#define INTPTR_MIN LONG_MIN -#define INTPTR_MAX LONG_MAX -#define UINTPTR_MAX ULONG_MAX +# undef INTPTR_MIN +# undef INTPTR_MAX +# undef UINTPTR_MAX +# define INTPTR_MIN LONG_MIN +# define INTPTR_MAX LONG_MAX +# define UINTPTR_MAX ULONG_MAX /* 7.18.2.5. Limits of greatest-width integer types */ -#ifndef INTMAX_MAX -# undef INTMAX_MIN -# ifdef INT64_MAX -# define INTMAX_MIN INT64_MIN -# define INTMAX_MAX INT64_MAX -# else -# define INTMAX_MIN INT32_MIN -# define INTMAX_MAX INT32_MAX +# ifndef INTMAX_MAX +# undef INTMAX_MIN +# ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN +# define INTMAX_MAX INT64_MAX +# else +# define INTMAX_MIN INT32_MIN +# define INTMAX_MAX INT32_MAX +# endif # endif -#endif -#ifndef UINTMAX_MAX -# ifdef UINT64_MAX -# define UINTMAX_MAX UINT64_MAX -# else -# define UINTMAX_MAX UINT32_MAX +# ifndef UINTMAX_MAX +# ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +# else +# define UINTMAX_MAX UINT32_MAX +# endif # endif -#endif /* 7.18.3. Limits of other integer types */ /* ptrdiff_t limits */ -#undef PTRDIFF_MIN -#undef PTRDIFF_MAX -#if @APPLE_UNIVERSAL_BUILD@ -# ifdef _LP64 -# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) -# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) +# undef PTRDIFF_MIN +# undef PTRDIFF_MAX +# if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) +# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) +# else +# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) +# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) +# endif # else -# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) -# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) -# endif -#else -# define PTRDIFF_MIN \ +# define PTRDIFF_MIN \ _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) -# define PTRDIFF_MAX \ +# define PTRDIFF_MAX \ _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) -#endif +# endif /* sig_atomic_t limits */ -#undef SIG_ATOMIC_MIN -#undef SIG_ATOMIC_MAX -#define SIG_ATOMIC_MIN \ +# undef SIG_ATOMIC_MIN +# undef SIG_ATOMIC_MAX +# define SIG_ATOMIC_MIN \ _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ 0@SIG_ATOMIC_T_SUFFIX@) -#define SIG_ATOMIC_MAX \ +# define SIG_ATOMIC_MAX \ _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ 0@SIG_ATOMIC_T_SUFFIX@) /* size_t limit */ -#undef SIZE_MAX -#if @APPLE_UNIVERSAL_BUILD@ -# ifdef _LP64 -# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) +# undef SIZE_MAX +# if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) +# else +# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) +# endif # else -# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) +# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) # endif -#else -# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) -#endif /* wchar_t limits */ /* Get WCHAR_MIN, WCHAR_MAX. @@ -544,29 +554,29 @@ sequence of nested includes -> -> -> , and the latter includes and assumes its types are already defined. */ -#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) +# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) /* BSD/OS 4.0.1 has a bug: , and must be included before . */ -# include -# include -# include -# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -# include -# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H -#endif -#undef WCHAR_MIN -#undef WCHAR_MAX -#define WCHAR_MIN \ +# include +# include +# include +# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# include +# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# endif +# undef WCHAR_MIN +# undef WCHAR_MAX +# define WCHAR_MIN \ _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) -#define WCHAR_MAX \ +# define WCHAR_MAX \ _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) /* wint_t limits */ -#undef WINT_MIN -#undef WINT_MAX -#define WINT_MIN \ +# undef WINT_MIN +# undef WINT_MAX +# define WINT_MIN \ _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) -#define WINT_MAX \ +# define WINT_MAX \ _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) /* 7.18.4. Macros for integer constants */ @@ -577,59 +587,120 @@ /* Here we assume a standard architecture where the hardware integer types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ -#undef INT8_C -#undef UINT8_C -#define INT8_C(x) x -#define UINT8_C(x) x - -#undef INT16_C -#undef UINT16_C -#define INT16_C(x) x -#define UINT16_C(x) x - -#undef INT32_C -#undef UINT32_C -#define INT32_C(x) x -#define UINT32_C(x) x ## U - -#undef INT64_C -#undef UINT64_C -#if LONG_MAX >> 31 >> 31 == 1 -# define INT64_C(x) x##L -#elif defined _MSC_VER -# define INT64_C(x) x##i64 -#elif @HAVE_LONG_LONG_INT@ -# define INT64_C(x) x##LL -#endif -#if ULONG_MAX >> 31 >> 31 >> 1 == 1 -# define UINT64_C(x) x##UL -#elif defined _MSC_VER -# define UINT64_C(x) x##ui64 -#elif @HAVE_UNSIGNED_LONG_LONG_INT@ -# define UINT64_C(x) x##ULL -#endif +# undef INT8_C +# undef UINT8_C +# define INT8_C(x) x +# define UINT8_C(x) x + +# undef INT16_C +# undef UINT16_C +# define INT16_C(x) x +# define UINT16_C(x) x + +# undef INT32_C +# undef UINT32_C +# define INT32_C(x) x +# define UINT32_C(x) x ## U + +# undef INT64_C +# undef UINT64_C +# if LONG_MAX >> 31 >> 31 == 1 +# define INT64_C(x) x##L +# elif defined _MSC_VER +# define INT64_C(x) x##i64 +# elif @HAVE_LONG_LONG_INT@ +# define INT64_C(x) x##LL +# endif +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define UINT64_C(x) x##UL +# elif defined _MSC_VER +# define UINT64_C(x) x##ui64 +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# define UINT64_C(x) x##ULL +# endif /* 7.18.4.2. Macros for greatest-width integer constants */ -#ifndef INTMAX_C -# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 -# define INTMAX_C(x) x##LL -# elif defined GL_INT64_T -# define INTMAX_C(x) INT64_C(x) -# else -# define INTMAX_C(x) x##L +# ifndef INTMAX_C +# if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +# elif defined GL_INT64_T +# define INTMAX_C(x) INT64_C(x) +# else +# define INTMAX_C(x) x##L +# endif # endif -#endif -#ifndef UINTMAX_C -# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 -# define UINTMAX_C(x) x##ULL -# elif defined GL_UINT64_T -# define UINTMAX_C(x) UINT64_C(x) -# else -# define UINTMAX_C(x) x##UL +# ifndef UINTMAX_C +# if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +# elif defined GL_UINT64_T +# define UINTMAX_C(x) UINT64_C(x) +# else +# define UINTMAX_C(x) x##UL +# endif # endif -#endif + +#endif /* !@HAVE_C99_STDINT_H@ */ + +/* Macros specified by ISO/IEC TS 18661-1:2014. */ + +#if (!defined UINTMAX_WIDTH \ + && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) +# ifdef INT8_MAX +# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) +# endif +# ifdef UINT8_MAX +# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) +# endif +# ifdef INT16_MAX +# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) +# endif +# ifdef UINT16_MAX +# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) +# endif +# ifdef INT32_MAX +# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) +# endif +# ifdef UINT32_MAX +# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) +# endif +# ifdef INT64_MAX +# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) +# endif +# ifdef UINT64_MAX +# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) +# endif +# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) +# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) +# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) +# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) +# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) +# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) +# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) +# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) +# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) +# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) +# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) +# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) +# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) +# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) +# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) +# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) +# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) +# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) +# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) +# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) +# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) +# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) +# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) +# ifdef WINT_MAX +# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) +# endif +# ifdef SIG_ATOMIC_MAX +# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) +# endif +#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ #endif /* _@GUARD_PREFIX@_STDINT_H */ #endif /* !(defined __ANDROID__ && ...) */ diff -Nru supermin-5.1.17/lib/stdio.in.h supermin-5.1.18/lib/stdio.in.h --- supermin-5.1.17/lib/stdio.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/stdio.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 2004, 2007-2014 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -84,8 +84,13 @@ except that it indicates to GCC that the supported format string directives are the ones of the system printf(), rather than the ones standardized by ISO C99 and POSIX. */ -#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ +#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU +# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument) +#else +# define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument)) +#endif /* _GL_ATTRIBUTE_FORMAT_SCANF indicates to GCC that the function takes a format string and arguments, @@ -113,6 +118,26 @@ # include #endif +/* MSVC declares 'perror' in , not in . We must include + it before we #define perror rpl_perror. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + +/* MSVC declares 'remove' in , not in . We must include + it before we #define remove rpl_remove. */ +/* MSVC declares 'rename' in , not in . We must include + it before we #define rename rpl_rename. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -718,11 +743,10 @@ so any use of gets warrants an unconditional warning; besides, C11 removed it. */ #undef gets -#if HAVE_RAW_DECL_GETS +#if HAVE_RAW_DECL_GETS && !defined __cplusplus _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); #endif - #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ struct obstack; /* Grow an obstack with formatted output. Return the number of diff -Nru supermin-5.1.17/lib/stdlib.in.h supermin-5.1.18/lib/stdlib.in.h --- supermin-5.1.17/lib/stdlib.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/stdlib.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 1995, 2001-2004, 2006-2014 Free Software Foundation, Inc. + Copyright (C) 1995, 2001-2004, 2006-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -520,6 +520,44 @@ _GL_CXXALIASWARN (putenv); #endif +#if @GNULIB_QSORT_R@ +/* Sort an array of NMEMB elements, starting at address BASE, each element + occupying SIZE bytes, in ascending order according to the comparison + function COMPARE. */ +# if @REPLACE_QSORT_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef qsort_r +# define qsort_r rpl_qsort_r +# endif +_GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, + int (*compare) (void const *, void const *, + void *), + void *arg) _GL_ARG_NONNULL ((1, 4))); +_GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size, + int (*compare) (void const *, void const *, + void *), + void *arg)); +# else +# if !@HAVE_QSORT_R@ +_GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, + int (*compare) (void const *, void const *, + void *), + void *arg) _GL_ARG_NONNULL ((1, 4))); +# endif +_GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size, + int (*compare) (void const *, void const *, + void *), + void *arg)); +# endif +_GL_CXXALIASWARN (qsort_r); +#elif defined GNULIB_POSIXCHECK +# undef qsort_r +# if HAVE_RAW_DECL_QSORT_R +_GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - " + "use gnulib module qsort_r for portability"); +# endif +#endif + #if @GNULIB_RANDOM_R@ # if !@HAVE_RANDOM_R@ diff -Nru supermin-5.1.17/lib/strdup.c supermin-5.1.18/lib/strdup.c --- supermin-5.1.17/lib/strdup.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/strdup.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2014 Free Software +/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. diff -Nru supermin-5.1.17/lib/strerror.c supermin-5.1.18/lib/strerror.c --- supermin-5.1.17/lib/strerror.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/strerror.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* strerror.c --- POSIX compatible system error routine - Copyright (C) 2007-2014 Free Software Foundation, Inc. + Copyright (C) 2007-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,5 +66,6 @@ if (sizeof buf <= len) abort (); - return memcpy (buf, msg, len + 1); + memcpy (buf, msg, len + 1); + return buf; } diff -Nru supermin-5.1.17/lib/strerror-override.c supermin-5.1.18/lib/strerror-override.c --- supermin-5.1.17/lib/strerror-override.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/strerror-override.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* strerror-override.c --- POSIX compatible system error routine - Copyright (C) 2010-2014 Free Software Foundation, Inc. + Copyright (C) 2010-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/strerror-override.h supermin-5.1.18/lib/strerror-override.h --- supermin-5.1.17/lib/strerror-override.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/strerror-override.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* strerror-override.h --- POSIX compatible system error routine - Copyright (C) 2010-2014 Free Software Foundation, Inc. + Copyright (C) 2010-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/string.in.h supermin-5.1.18/lib/string.in.h --- supermin-5.1.17/lib/string.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/string.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 1995-1996, 2001-2014 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,16 +15,32 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . */ -#ifndef _@GUARD_PREFIX@_STRING_H - #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ +#if defined _GL_ALREADY_INCLUDING_STRING_H +/* Special invocation convention: + - On OS X/NetBSD we have a sequence of nested includes + -> -> "string.h" + In this situation system _chk variants due to -D_FORTIFY_SOURCE + might be used after any replacements defined here. */ + +#@INCLUDE_NEXT@ @NEXT_STRING_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_STRING_H + +#define _GL_ALREADY_INCLUDING_STRING_H + /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ +#undef _GL_ALREADY_INCLUDING_STRING_H + #ifndef _@GUARD_PREFIX@_STRING_H #define _@GUARD_PREFIX@_STRING_H @@ -400,15 +416,15 @@ # undef strndup # define strndup rpl_strndup # endif -_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n) +_GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n) _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n)); +_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); # else # if ! @HAVE_DECL_STRNDUP@ -_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n) +_GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n) _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n)); +_GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); # endif _GL_CXXALIASWARN (strndup); #elif defined GNULIB_POSIXCHECK @@ -428,17 +444,17 @@ # undef strnlen # define strnlen rpl_strnlen # endif -_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen) +_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); -_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)); +_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); # else # if ! @HAVE_DECL_STRNLEN@ -_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen) +_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); # endif -_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)); +_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); # endif _GL_CXXALIASWARN (strnlen); #elif defined GNULIB_POSIXCHECK @@ -1027,3 +1043,4 @@ #endif /* _@GUARD_PREFIX@_STRING_H */ #endif /* _@GUARD_PREFIX@_STRING_H */ +#endif diff -Nru supermin-5.1.17/lib/stripslash.c supermin-5.1.18/lib/stripslash.c --- supermin-5.1.17/lib/stripslash.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/stripslash.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* stripslash.c -- remove redundant trailing slashes from a file name - Copyright (C) 1990, 2001, 2003-2006, 2009-2014 Free Software Foundation, + Copyright (C) 1990, 2001, 2003-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify diff -Nru supermin-5.1.17/lib/sys_stat.in.h supermin-5.1.18/lib/sys_stat.in.h --- supermin-5.1.17/lib/sys_stat.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/sys_stat.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Provide a more complete sys/stat header file. - Copyright (C) 2005-2014 Free Software Foundation, Inc. + Copyright (C) 2005-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/sys_time.in.h supermin-5.1.18/lib/sys_time.in.h --- supermin-5.1.17/lib/sys_time.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/sys_time.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Provide a more complete sys/time.h. - Copyright (C) 2007-2014 Free Software Foundation, Inc. + Copyright (C) 2007-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -109,6 +109,13 @@ (struct timeval *restrict, void *restrict)); # endif _GL_CXXALIASWARN (gettimeofday); +# if defined __cplusplus && defined GNULIB_NAMESPACE +namespace GNULIB_NAMESPACE { + typedef ::timeval +#undef timeval + timeval; +} +# endif #elif defined GNULIB_POSIXCHECK # undef gettimeofday # if HAVE_RAW_DECL_GETTIMEOFDAY diff -Nru supermin-5.1.17/lib/sys_types.in.h supermin-5.1.18/lib/sys_types.in.h --- supermin-5.1.17/lib/sys_types.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/sys_types.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Provide a more complete sys/types.h. - Copyright (C) 2011-2014 Free Software Foundation, Inc. + Copyright (C) 2011-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,9 @@ #ifndef _@GUARD_PREFIX@_SYS_TYPES_H /* The include_next requires a split double-inclusion guard. */ +# define _GL_INCLUDING_SYS_TYPES_H #@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ +# undef _GL_INCLUDING_SYS_TYPES_H #ifndef _@GUARD_PREFIX@_SYS_TYPES_H #define _@GUARD_PREFIX@_SYS_TYPES_H diff -Nru supermin-5.1.17/lib/time.in.h supermin-5.1.18/lib/time.in.h --- supermin-5.1.17/lib/time.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/time.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* A more-standard . - Copyright (C) 2007-2014 Free Software Foundation, Inc. + Copyright (C) 2007-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,11 +22,13 @@ /* Don't get in the way of glibc when it includes time.h merely to declare a few standard symbols, rather than to declare all the - symbols. Also, Solaris 8 eventually includes itself + symbols. (However, skip this for MinGW as it treats __need_time_t + incompatibly.) Also, Solaris 8 eventually includes itself recursively; if that is happening, just include the system without adding our own declarations. */ -#if (defined __need_time_t || defined __need_clock_t \ - || defined __need_timespec \ +#if (((defined __need_time_t || defined __need_clock_t \ + || defined __need_timespec) \ + && !defined __MINGW32__) \ || defined _@GUARD_PREFIX@_TIME_H) # @INCLUDE_NEXT@ @NEXT_TIME_H@ @@ -55,6 +57,8 @@ # include # elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ # include +# elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ +# include # else # ifdef __cplusplus @@ -213,7 +217,7 @@ _GL_CXXALIASWARN (gmtime); # endif -/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store +/* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store the resulting broken-down time into TM. See . */ # if @GNULIB_STRPTIME@ @@ -229,6 +233,25 @@ _GL_CXXALIASWARN (strptime); # endif +# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ +typedef struct tm_zone *timezone_t; +_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); +_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); +_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); +_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); +_GL_FUNCDECL_SYS (localtime_rz, struct tm *, + (timezone_t __tz, time_t const *restrict __timer, + struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_SYS (localtime_rz, struct tm *, + (timezone_t __tz, time_t const *restrict __timer, + struct tm *restrict __result)); +_GL_FUNCDECL_SYS (mktime_z, time_t, + (timezone_t __tz, struct tm *restrict __result) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_SYS (mktime_z, time_t, + (timezone_t __tz, struct tm *restrict __result)); +# endif + /* Convert TM to a time_t value, assuming UTC. */ # if @GNULIB_TIMEGM@ # if @REPLACE_TIMEGM@ diff -Nru supermin-5.1.17/lib/unistd.c supermin-5.1.18/lib/unistd.c --- supermin-5.1.17/lib/unistd.c 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/unistd.c 2017-03-01 12:02:17.000000000 +0000 @@ -1,3 +1,4 @@ #include #define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include "unistd.h" +typedef int dummy; diff -Nru supermin-5.1.17/lib/unistd--.h supermin-5.1.18/lib/unistd--.h --- supermin-5.1.17/lib/unistd--.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/unistd--.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Like unistd.h, but redefine some names to avoid glitches. - Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/unistd.in.h supermin-5.1.18/lib/unistd.in.h --- supermin-5.1.17/lib/unistd.in.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/unistd.in.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ /* Substitute for and wrapper around . - Copyright (C) 2003-2014 Free Software Foundation, Inc. + Copyright (C) 2003-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,9 +55,13 @@ #include /* mingw doesn't define the SEEK_* or *_FILENO macros in . */ +/* MSVC declares 'unlink' in , not in . We must include + it before we #define unlink rpl_unlink. */ /* Cygwin 1.7.1 declares symlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ + || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \ + && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) \ || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ && defined __CYGWIN__)) \ && ! defined __GLIBC__ @@ -401,6 +405,12 @@ /* Set of environment variables and values. An array of strings of the form "VARIABLE=VALUE", terminated with a NULL. */ # if defined __APPLE__ && defined __MACH__ +# include +# if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR +# define _GL_USE_CRT_EXTERNS +# endif +# endif +# ifdef _GL_USE_CRT_EXTERNS # include # define environ (*_NSGetEnviron ()) # else @@ -770,7 +780,7 @@ ${LOGNAME-$USER} on Unix platforms, $USERNAME on native Windows platforms. */ -# if !@HAVE_GETLOGIN@ +# if !@HAVE_DECL_GETLOGIN@ _GL_FUNCDECL_SYS (getlogin, char *, (void)); # endif _GL_CXXALIAS_SYS (getlogin, char *, (void)); @@ -1287,13 +1297,24 @@ #if @GNULIB_READLINKAT@ -# if !@HAVE_READLINKAT@ +# if @REPLACE_READLINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define readlinkat rpl_readlinkat +# endif +_GL_FUNCDECL_RPL (readlinkat, ssize_t, + (int fd, char const *file, char *buf, size_t len) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (readlinkat, ssize_t, + (int fd, char const *file, char *buf, size_t len)); +# else +# if !@HAVE_READLINKAT@ _GL_FUNCDECL_SYS (readlinkat, ssize_t, (int fd, char const *file, char *buf, size_t len) _GL_ARG_NONNULL ((2, 3))); -# endif +# endif _GL_CXXALIAS_SYS (readlinkat, ssize_t, (int fd, char const *file, char *buf, size_t len)); +# endif _GL_CXXALIASWARN (readlinkat); #elif defined GNULIB_POSIXCHECK # undef readlinkat @@ -1407,13 +1428,25 @@ #if @GNULIB_SYMLINKAT@ -# if !@HAVE_SYMLINKAT@ +# if @REPLACE_SYMLINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef symlinkat +# define symlinkat rpl_symlinkat +# endif +_GL_FUNCDECL_RPL (symlinkat, int, + (char const *contents, int fd, char const *file) + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (symlinkat, int, + (char const *contents, int fd, char const *file)); +# else +# if !@HAVE_SYMLINKAT@ _GL_FUNCDECL_SYS (symlinkat, int, (char const *contents, int fd, char const *file) _GL_ARG_NONNULL ((1, 3))); -# endif +# endif _GL_CXXALIAS_SYS (symlinkat, int, (char const *contents, int fd, char const *file)); +# endif _GL_CXXALIASWARN (symlinkat); #elif defined GNULIB_POSIXCHECK # undef symlinkat diff -Nru supermin-5.1.17/lib/unistd-safer.h supermin-5.1.18/lib/unistd-safer.h --- supermin-5.1.17/lib/unistd-safer.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/unistd-safer.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Invoke unistd-like functions, but avoid some glitches. - Copyright (C) 2001, 2003, 2005, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2005, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -Nru supermin-5.1.17/lib/verify.h supermin-5.1.18/lib/verify.h --- supermin-5.1.17/lib/verify.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/verify.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* Compile-time assert-like macros. - Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -248,7 +248,12 @@ /* Verify requirement R at compile-time, as a declaration without a trailing ';'. */ -#define verify(R) _GL_VERIFY (R, "verify (" #R ")") +#ifdef __GNUC__ +# define verify(R) _GL_VERIFY (R, "verify (" #R ")") +#else +/* PGI barfs if R is long. Play it safe. */ +# define verify(R) _GL_VERIFY (R, "verify (...)") +#endif #ifndef __has_builtin # define __has_builtin(x) 0 @@ -263,7 +268,7 @@ # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) #elif 1200 <= _MSC_VER # define assume(R) __assume (R) -#elif (defined lint \ +#elif ((defined GCC_LINT || defined lint) \ && (__has_builtin (__builtin_trap) \ || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)))) /* Doing it this way helps various packages when configured with diff -Nru supermin-5.1.17/lib/xalloc-oversized.h supermin-5.1.18/lib/xalloc-oversized.h --- supermin-5.1.17/lib/xalloc-oversized.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/lib/xalloc-oversized.h 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ /* xalloc-oversized.h -- memory allocation size checking - Copyright (C) 1990-2000, 2003-2004, 2006-2014 Free Software Foundation, Inc. + Copyright (C) 1990-2000, 2003-2004, 2006-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,23 +16,45 @@ along with this program. If not, see . */ #ifndef XALLOC_OVERSIZED_H_ -# define XALLOC_OVERSIZED_H_ +#define XALLOC_OVERSIZED_H_ -# include - -/* Return 1 if an array of N objects, each of size S, cannot exist due - to size arithmetic overflow. S must be positive and N must be - nonnegative. This is a macro, not a function, so that it - works correctly even when SIZE_MAX < N. +#include +#include +/* True if N * S would overflow in a size_t calculation, + or would generate a value larger than PTRDIFF_MAX. + This expands to a constant expression if N and S are both constants. By gnulib convention, SIZE_MAX represents overflow in size - calculations, so the conservative dividend to use here is - SIZE_MAX - 1, since SIZE_MAX might represent an overflowed value. - However, malloc (SIZE_MAX) fails on all known hosts where - sizeof (ptrdiff_t) <= sizeof (size_t), so do not bother to test for - exactly-SIZE_MAX allocations on such hosts; this avoids a test and - branch when S is known to be 1. */ + calculations, so the conservative size_t-based dividend to use here + is SIZE_MAX - 1. */ +#define __xalloc_oversized(n, s) \ + ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) + +#if PTRDIFF_MAX < SIZE_MAX +typedef ptrdiff_t __xalloc_count_type; +#else +typedef size_t __xalloc_count_type; +#endif + +/* Return 1 if an array of N objects, each of size S, cannot exist + reliably due to size or ptrdiff_t arithmetic overflow. S must be + positive and N must be nonnegative. This is a macro, not a + function, so that it works correctly even when SIZE_MAX < N. */ + +#if 7 <= __GNUC__ +# define xalloc_oversized(n, s) \ + __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) +#elif 5 <= __GNUC__ && !__STRICT_ANSI__ # define xalloc_oversized(n, s) \ - ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) + (__builtin_constant_p (n) && __builtin_constant_p (s) \ + ? __xalloc_oversized (n, s) \ + : ({ __xalloc_count_type __xalloc_count; \ + __builtin_mul_overflow (n, s, &__xalloc_count); })) + +/* Other compilers use integer division; this may be slower but is + more portable. */ +#else +# define xalloc_oversized(n, s) __xalloc_oversized (n, s) +#endif #endif /* !XALLOC_OVERSIZED_H_ */ diff -Nru supermin-5.1.17/m4/00gnulib.m4 supermin-5.1.18/m4/00gnulib.m4 --- supermin-5.1.17/m4/00gnulib.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/00gnulib.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # 00gnulib.m4 serial 3 -dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/absolute-header.m4 supermin-5.1.18/m4/absolute-header.m4 --- supermin-5.1.17/m4/absolute-header.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/absolute-header.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # absolute-header.m4 serial 16 -dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/chdir-long.m4 supermin-5.1.18/m4/chdir-long.m4 --- supermin-5.1.17/m4/chdir-long.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/chdir-long.m4 2017-03-01 12:02:17.000000000 +0000 @@ -6,7 +6,7 @@ # never fails with ENAMETOOLONG. # Arrange to compile chdir-long.c only on systems that define PATH_MAX. -dnl Copyright (C) 2004-2007, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/closedir.m4 supermin-5.1.18/m4/closedir.m4 --- supermin-5.1.17/m4/closedir.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/closedir.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ -# closedir.m4 serial 2 -dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. +# closedir.m4 serial 5 +dnl Copyright (C) 2011-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -22,4 +22,9 @@ fi fi ]) + dnl Replace closedir() for supporting the gnulib-defined dirfd() function. + case $host_os,$HAVE_CLOSEDIR in + os2*,1) + REPLACE_CLOSEDIR=1;; + esac ]) diff -Nru supermin-5.1.17/m4/close.m4 supermin-5.1.18/m4/close.m4 --- supermin-5.1.17/m4/close.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/close.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # close.m4 serial 8 -dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/cycle-check.m4 supermin-5.1.18/m4/cycle-check.m4 --- supermin-5.1.17/m4/cycle-check.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/cycle-check.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ #serial 7 -dnl Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/d-ino.m4 supermin-5.1.18/m4/d-ino.m4 --- supermin-5.1.17/m4/d-ino.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/d-ino.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,11 +1,11 @@ -# serial 14 +# serial 15 dnl From Jim Meyering. dnl dnl Check whether struct dirent has a member named d_ino. dnl -# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2014 Free Software +# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2017 Free Software # Foundation, Inc. # This file is free software; the Free Software Foundation @@ -34,6 +34,7 @@ return 3; if (e->d_ino != st.st_ino) return 4; + closedir (dp); return 0; ]])], [gl_cv_struct_dirent_d_ino=yes], diff -Nru supermin-5.1.17/m4/dirent_h.m4 supermin-5.1.18/m4/dirent_h.m4 --- supermin-5.1.17/m4/dirent_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/dirent_h.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # dirent_h.m4 serial 16 -dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/dirent-safer.m4 supermin-5.1.18/m4/dirent-safer.m4 --- supermin-5.1.17/m4/dirent-safer.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/dirent-safer.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ #serial 2 -dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/dirfd.m4 supermin-5.1.18/m4/dirfd.m4 --- supermin-5.1.17/m4/dirfd.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/dirfd.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,8 +1,8 @@ -# serial 22 -*- Autoconf -*- +# serial 24 -*- Autoconf -*- dnl Find out how to get the file descriptor associated with an open DIR*. -# Copyright (C) 2001-2006, 2008-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2006, 2008-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -35,13 +35,15 @@ gl_cv_func_dirfd_macro=yes, gl_cv_func_dirfd_macro=no)]) - # Use the replacement only if we have no function or macro with that name. - if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no; then - if test $ac_cv_have_decl_dirfd = yes; then - # If the system declares dirfd already, let's declare rpl_dirfd instead. + # Use the replacement if we have no function or macro with that name, + # or if OS/2 kLIBC whose dirfd() does not work. + # Replace only if the system declares dirfd already. + case $ac_cv_func_dirfd,$gl_cv_func_dirfd_macro,$host_os,$ac_cv_have_decl_dirfd in + no,no,*,yes | *,*,os2*,yes) REPLACE_DIRFD=1 - fi - fi + AC_DEFINE([REPLACE_DIRFD], [1], + [Define to 1 if gnulib's dirfd() replacement is used.]);; + esac ]) dnl Prerequisites of lib/dirfd.c. diff -Nru supermin-5.1.17/m4/dirname.m4 supermin-5.1.18/m4/dirname.m4 --- supermin-5.1.17/m4/dirname.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/dirname.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ #serial 10 -*- autoconf -*- -dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/double-slash-root.m4 supermin-5.1.18/m4/double-slash-root.m4 --- supermin-5.1.17/m4/double-slash-root.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/double-slash-root.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # double-slash-root.m4 serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/d-type.m4 supermin-5.1.18/m4/d-type.m4 --- supermin-5.1.17/m4/d-type.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/d-type.m4 2017-03-01 12:02:17.000000000 +0000 @@ -5,7 +5,7 @@ dnl Check whether struct dirent has a member named d_type. dnl -# Copyright (C) 1997, 1999-2004, 2006, 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 1997, 1999-2004, 2006, 2009-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff -Nru supermin-5.1.17/m4/dup2.m4 supermin-5.1.18/m4/dup2.m4 --- supermin-5.1.17/m4/dup2.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/dup2.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ -#serial 20 -dnl Copyright (C) 2002, 2005, 2007, 2009-2014 Free Software Foundation, Inc. +#serial 25 +dnl Copyright (C) 2002, 2005, 2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -19,33 +19,60 @@ if test $HAVE_DUP2 = 1; then AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], [AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[#include -#include -#include ]], - [int result = 0; -#ifdef FD_CLOEXEC - if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) - result |= 1; -#endif - if (dup2 (1, 1) == 0) - result |= 2; -#ifdef FD_CLOEXEC - if (fcntl (1, F_GETFD) != FD_CLOEXEC) - result |= 4; -#endif - close (0); - if (dup2 (0, 0) != -1) - result |= 8; - /* Many gnulib modules require POSIX conformance of EBADF. */ - if (dup2 (2, 1000000) == -1 && errno != EBADF) - result |= 16; - /* Flush out some cygwin core dumps. */ - if (dup2 (2, -1) != -1 || errno != EBADF) - result |= 32; - dup2 (2, 255); - dup2 (2, 256); - return result; - ]) + AC_LANG_PROGRAM( + [[#include + #include + #include + #include + #include + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + ]], + [[int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + #ifdef FD_CLOEXEC + if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) + result |= 1; + #endif + if (dup2 (1, 1) != 1) + result |= 2; + #ifdef FD_CLOEXEC + if (fcntl (1, F_GETFD) != FD_CLOEXEC) + result |= 4; + #endif + close (0); + if (dup2 (0, 0) != -1) + result |= 8; + /* Many gnulib modules require POSIX conformance of EBADF. */ + if (dup2 (2, bad_fd) == -1 && errno != EBADF) + result |= 16; + /* Flush out some cygwin core dumps. */ + if (dup2 (2, -1) != -1 || errno != EBADF) + result |= 32; + dup2 (2, 255); + dup2 (2, 256); + /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ + { + int fd = open (".", O_RDONLY); + if (fd == -1) + result |= 64; + else if (dup2 (fd, fd + 1) == -1) + result |= 128; + + close (fd); + } + return result;]]) ], [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], [case "$host_os" in @@ -53,13 +80,16 @@ gl_cv_func_dup2_works="guessing no" ;; cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 gl_cv_func_dup2_works="guessing no" ;; - linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a - # closed fd may yield -EBADF instead of -1 / errno=EBADF. - gl_cv_func_dup2_works="guessing no" ;; - freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF. + aix* | freebsd*) + # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, + # not EBADF. gl_cv_func_dup2_works="guessing no" ;; haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. gl_cv_func_dup2_works="guessing no" ;; + *-android*) # implemented using dup3(), which fails if oldfd == newfd + gl_cv_func_dup2_works="guessing no" ;; + os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. + gl_cv_func_dup2_works="guessing no" ;; *) gl_cv_func_dup2_works="guessing yes" ;; esac]) ]) diff -Nru supermin-5.1.17/m4/dup.m4 supermin-5.1.18/m4/dup.m4 --- supermin-5.1.17/m4/dup.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/dup.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ -# dup.m4 serial 3 -dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. +# dup.m4 serial 4 +dnl Copyright (C) 2011-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -19,6 +19,26 @@ REPLACE_DUP=1 fi ]) + AC_CACHE_CHECK([whether dup works], [gl_cv_func_dup_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[#include + #include + #include ]], + [[/* On OS/2 kLIBC, dup does not work on a directory fd. */ + int fd = open (".", O_RDONLY); + return fd < 0 ? 1 : dup (fd) < 0 ? 2 : 0; + ]]) + ], + [gl_cv_func_dup_works=yes], + [gl_cv_func_dup_works=no], + [gl_cv_func_dup_works='guessing yes']) + ]) + case "$gl_cv_func_dup_works" in + *yes) ;; + *) + REPLACE_DUP=1 + ;; + esac ]) # Prerequisites of lib/dup.c. diff -Nru supermin-5.1.17/m4/errno_h.m4 supermin-5.1.18/m4/errno_h.m4 --- supermin-5.1.17/m4/errno_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/errno_h.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # errno_h.m4 serial 12 -dnl Copyright (C) 2004, 2006, 2008-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2004, 2006, 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/error.m4 supermin-5.1.18/m4/error.m4 --- supermin-5.1.17/m4/error.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/error.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ #serial 14 -# Copyright (C) 1996-1998, 2001-2004, 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-1998, 2001-2004, 2009-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff -Nru supermin-5.1.17/m4/extensions.m4 supermin-5.1.18/m4/extensions.m4 --- supermin-5.1.17/m4/extensions.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/extensions.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,7 +1,7 @@ -# serial 13 -*- Autoconf -*- +# serial 15 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006-2014 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -60,7 +60,7 @@ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif -/* Enable general extensions on OS X. */ +/* Enable general extensions on macOS. */ #ifndef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE #endif @@ -72,6 +72,34 @@ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE @@ -101,6 +129,13 @@ AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) + AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) + AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) + AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__]) + AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__]) + AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__]) + AC_DEFINE([__STDC_WANT_LIB_EXT2__]) + AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) AC_DEFINE([_TANDEM_SOURCE]) AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], [ac_cv_should_define__xopen_source], diff -Nru supermin-5.1.17/m4/extern-inline.m4 supermin-5.1.18/m4/extern-inline.m4 --- supermin-5.1.17/m4/extern-inline.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/extern-inline.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ dnl 'extern inline' a la ISO C99. -dnl Copyright 2012-2014 Free Software Foundation, Inc. +dnl Copyright 2012-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -19,13 +19,28 @@ 'reference to static identifier "f" in extern inline function'. This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. - Suppress the use of extern inline on problematic Apple configurations. - OS X 10.8 and earlier mishandle it; see, e.g., - . + Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) + on configurations that mistakenly use 'static inline' to implement + functions or macros in standard C headers like . For example, + if isdigit is mistakenly implemented via a static inline function, + a program containing an extern inline function that calls isdigit + may not work since the C standard prohibits extern inline functions + from calling static functions. This bug is known to occur on: + + OS X 10.8 and earlier; see: + http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html + + DragonFly; see + http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + + FreeBSD; see: + http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and for clang but remains for g++; see . - Perhaps Apple will fix this some day. */ -#if (defined __APPLE__ \ + Assume DragonFly and FreeBSD will be similar. */ +#if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ && (defined __header_inline \ ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ && ! defined __clang__) \ @@ -33,19 +48,20 @@ && (defined __GNUC__ || defined __cplusplus)) \ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ && defined __GNUC__ && ! defined __cplusplus)))) -# define _GL_EXTERN_INLINE_APPLE_BUG +# define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ + && !defined __PGI \ && !(defined __SUNPRO_C && __STDC__))) \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # define _GL_INLINE inline # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ - && !defined _GL_EXTERN_INLINE_APPLE_BUG) + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) @@ -59,17 +75,19 @@ # define _GL_EXTERN_INLINE static _GL_UNUSED #endif -#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) +/* In GCC 4.6 (inclusive) to 5.1 (exclusive), + suppress bogus "no previous prototype for 'FOO'" + and "no previous declaration for 'FOO'" diagnostics, + when FOO is an inline function in the header; see + and + . */ +#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ # define _GL_INLINE_HEADER_CONST_PRAGMA # else # define _GL_INLINE_HEADER_CONST_PRAGMA \ _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") # endif - /* Suppress GCC's bogus "no previous prototype for 'FOO'" - and "no previous declaration for 'FOO'" diagnostics, - when FOO is an inline function in the header; see - . */ # define _GL_INLINE_HEADER_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ diff -Nru supermin-5.1.17/m4/fchdir.m4 supermin-5.1.18/m4/fchdir.m4 --- supermin-5.1.17/m4/fchdir.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/fchdir.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # fchdir.m4 serial 21 -dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/fcntl_h.m4 supermin-5.1.18/m4/fcntl_h.m4 --- supermin-5.1.17/m4/fcntl_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/fcntl_h.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ # serial 15 # Configure fcntl.h. -dnl Copyright (C) 2006-2007, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/fcntl.m4 supermin-5.1.18/m4/fcntl.m4 --- supermin-5.1.17/m4/fcntl.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/fcntl.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ -# fcntl.m4 serial 5 -dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. +# fcntl.m4 serial 9 +dnl Copyright (C) 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -27,20 +27,51 @@ dnl haiku alpha 2 F_DUPFD has wrong errno AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly], [gl_cv_func_fcntl_f_dupfd_works], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -]], [[int result = 0; - if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; - if (errno != EINVAL) result |= 2; - return result; - ]])], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #include + #include + #include + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + ]], + [[int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; + if (errno != EINVAL) result |= 2; + if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; + if (errno != EINVAL) result |= 8; + /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ + { + int fd; + fd = open (".", O_RDONLY); + if (fd == -1) + result |= 16; + else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) + result |= 32; + + close (fd); + } + return result;]])], [gl_cv_func_fcntl_f_dupfd_works=yes], [gl_cv_func_fcntl_f_dupfd_works=no], - [# Guess that it works on glibc systems - case $host_os in #(( - *-gnu*) gl_cv_func_fcntl_f_dupfd_works="guessing yes";; - *) gl_cv_func_fcntl_f_dupfd_works="guessing no";; + [case $host_os in + aix* | cygwin* | haiku*) + gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; esac])]) case $gl_cv_func_fcntl_f_dupfd_works in *yes) ;; diff -Nru supermin-5.1.17/m4/fcntl-o.m4 supermin-5.1.18/m4/fcntl-o.m4 --- supermin-5.1.17/m4/fcntl-o.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/fcntl-o.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # fcntl-o.m4 serial 4 -dnl Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/fcntl-safer.m4 supermin-5.1.18/m4/fcntl-safer.m4 --- supermin-5.1.17/m4/fcntl-safer.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/fcntl-safer.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ #serial 9 -dnl Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/fdopendir.m4 supermin-5.1.18/m4/fdopendir.m4 --- supermin-5.1.17/m4/fdopendir.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/fdopendir.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,7 +1,7 @@ # serial 10 # See if we need to provide fdopendir. -dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/filenamecat.m4 supermin-5.1.18/m4/filenamecat.m4 --- supermin-5.1.17/m4/filenamecat.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/filenamecat.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # filenamecat.m4 serial 11 -dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/flexmember.m4 supermin-5.1.18/m4/flexmember.m4 --- supermin-5.1.17/m4/flexmember.m4 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/m4/flexmember.m4 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,43 @@ +# serial 4 +# Check for flexible array member support. + +# Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Written by Paul Eggert. + +AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER], +[ + AC_CACHE_CHECK([for flexible array member], + ac_cv_c_flexmember, + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #include + struct s { int n; double d[]; };]], + [[int m = getchar (); + size_t nbytes = offsetof (struct s, d) + m * sizeof (double); + nbytes += sizeof (struct s) - 1; + nbytes -= nbytes % sizeof (struct s); + struct s *p = malloc (nbytes); + p->d[0] = 0.0; + return p->d != (double *) NULL;]])], + [ac_cv_c_flexmember=yes], + [ac_cv_c_flexmember=no])]) + if test $ac_cv_c_flexmember = yes; then + AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], + [Define to nothing if C supports flexible array members, and to + 1 if it does not. That way, with a declaration like 'struct s + { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack + can be used with pre-C99 compilers. + When computing the size of such an object, don't use 'sizeof (struct s)' + as it overestimates the size. Use 'offsetof (struct s, d)' instead. + Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with + MSVC and with C++ compilers.]) + else + AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1]) + fi +]) diff -Nru supermin-5.1.17/m4/fstat.m4 supermin-5.1.18/m4/fstat.m4 --- supermin-5.1.17/m4/fstat.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/fstat.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # fstat.m4 serial 4 -dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/fts.m4 supermin-5.1.18/m4/fts.m4 --- supermin-5.1.17/m4/fts.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/fts.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ #serial 20 -dnl Copyright (C) 2005-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/getcwd.m4 supermin-5.1.18/m4/getcwd.m4 --- supermin-5.1.17/m4/getcwd.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/getcwd.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,12 +1,12 @@ # getcwd.m4 - check for working getcwd that is compatible with glibc -# Copyright (C) 2001, 2003-2007, 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003-2007, 2009-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Written by Paul Eggert. -# serial 12 +# serial 13 AC_DEFUN([gl_FUNC_GETCWD_NULL], [ @@ -15,6 +15,7 @@ AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result], [gl_cv_func_getcwd_null], [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +# include # if HAVE_UNISTD_H # include # else /* on Windows with MSVC */ @@ -39,6 +40,7 @@ return 3; if (f[1] != '\0') return 4; + free (f); return 0; } #endif @@ -136,11 +138,16 @@ [Define to 1 if getcwd works, except it sometimes fails when it shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.]) ;; + "yes, but with shorter paths") + AC_DEFINE([HAVE_GETCWD_SHORTER], [1], + [Define to 1 if getcwd works, but with shorter paths + than is generally tested with the replacement.]) + ;; esac if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \ || test $gl_cv_func_getcwd_posix_signature != yes \ - || test "$gl_cv_func_getcwd_path_max" != yes \ + || { case "$gl_cv_func_getcwd_path_max" in *yes*) false;; *) true;; esac; } \ || test $gl_abort_bug = yes; then REPLACE_GETCWD=1 fi diff -Nru supermin-5.1.17/m4/getdtablesize.m4 supermin-5.1.18/m4/getdtablesize.m4 --- supermin-5.1.17/m4/getdtablesize.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/getdtablesize.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ -# getdtablesize.m4 serial 5 -dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. +# getdtablesize.m4 serial 6 +dnl Copyright (C) 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,7 +9,9 @@ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CHECK_FUNCS_ONCE([getdtablesize]) - if test $ac_cv_func_getdtablesize = yes; then + AC_CHECK_DECLS_ONCE([getdtablesize]) + if test $ac_cv_func_getdtablesize = yes && + test $ac_cv_have_decl_getdtablesize = yes; then # Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft limit # up to an unchangeable hard limit; all other platforms correctly # require setrlimit before getdtablesize() can report a larger value. diff -Nru supermin-5.1.17/m4/getprogname.m4 supermin-5.1.18/m4/getprogname.m4 --- supermin-5.1.17/m4/getprogname.m4 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/m4/getprogname.m4 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,43 @@ +# getprogname.m4 - check for getprogname or replacements for it + +# Copyright (C) 2016-2017 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +AC_DEFUN([gl_FUNC_GETPROGNAME], +[ + AC_CHECK_FUNCS_ONCE([getprogname getexecname]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + ac_found=0 + AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], + [#include ]) + AC_CHECK_DECLS([program_invocation_short_name], [ac_found=1], [], + [#include ]) + AC_CHECK_DECLS([__argv], [ac_found=1], [], [#include ]) + + # Incur the cost of this test only if none of the above worked. + if test $ac_found = 0; then + # On OpenBSD 5.1, using the global __progname variable appears to be + # the only way to implement getprogname. + AC_CACHE_CHECK([whether __progname is defined in default libraries], + [gl_cv_var___progname], + [ + gl_cv_var___progname= + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[extern char *__progname;]], + [[return *__progname;]] + )], + [gl_cv_var___progname=yes] + ) + ] + ) + if test "$gl_cv_var___progname" = yes; then + AC_DEFINE([HAVE_VAR___PROGNAME], 1, + [Define if you have a global __progname variable]) + fi + fi +]) diff -Nru supermin-5.1.17/m4/gettimeofday.m4 supermin-5.1.18/m4/gettimeofday.m4 --- supermin-5.1.17/m4/gettimeofday.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/gettimeofday.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ # serial 21 -# Copyright (C) 2001-2003, 2005, 2007, 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2003, 2005, 2007, 2009-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/gnulib-cache.m4 supermin-5.1.18/m4/gnulib-cache.m4 --- supermin-5.1.17/m4/gnulib-cache.m4 2014-03-01 08:53:15.000000000 +0000 +++ supermin-5.1.18/m4/gnulib-cache.m4 2017-03-01 12:13:45.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,12 +27,13 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl fts +# gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-conditional-dependencies --no-libtool --macro-prefix=gl fts sys_types # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) gl_MODULES([ fts + sys_types ]) gl_AVOID([]) gl_SOURCE_BASE([lib]) diff -Nru supermin-5.1.17/m4/gnulib-common.m4 supermin-5.1.18/m4/gnulib-common.m4 --- supermin-5.1.17/m4/gnulib-common.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/gnulib-common.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ -# gnulib-common.m4 serial 34 -dnl Copyright (C) 2007-2014 Free Software Foundation, Inc. +# gnulib-common.m4 serial 37 +dnl Copyright (C) 2007-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -49,6 +49,16 @@ is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED +/* gcc supports the "unused" attribute on possibly unused labels, and + g++ has since version 4.5. Note to support C++ as well as C, + _GL_UNUSED_LABEL should be used with a trailing ; */ +#if !defined __cplusplus || __GNUC__ > 4 \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define _GL_UNUSED_LABEL _GL_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + /* The __pure__ attribute was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) @@ -243,9 +253,10 @@ [ dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler dnl as "cc", and GCC as "gcc". They have different object file formats and - dnl library formats. In particular, the GNU binutils programs ar, ranlib + dnl library formats. In particular, the GNU binutils programs ar and ranlib dnl produce libraries that work only with gcc, not with cc. AC_REQUIRE([AC_PROG_CC]) + AC_BEFORE([$0], [AM_PROG_AR]) AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], [ AC_EGREP_CPP([Amsterdam], @@ -257,25 +268,37 @@ [gl_cv_c_amsterdam_compiler=yes], [gl_cv_c_amsterdam_compiler=no]) ]) - if test -z "$AR"; then - if test $gl_cv_c_amsterdam_compiler = yes; then + + dnl Don't compete with AM_PROG_AR's decision about AR/ARFLAGS if we are not + dnl building with __ACK__. + if test $gl_cv_c_amsterdam_compiler = yes; then + if test -z "$AR"; then AR='cc -c.a' - if test -z "$ARFLAGS"; then - ARFLAGS='-o' - fi - else - dnl Use the Automake-documented default values for AR and ARFLAGS, - dnl but prefer ${host}-ar over ar (useful for cross-compiling). - AC_CHECK_TOOL([AR], [ar], [ar]) - if test -z "$ARFLAGS"; then - ARFLAGS='cru' - fi fi - else if test -z "$ARFLAGS"; then - ARFLAGS='cru' + ARFLAGS='-o' fi + else + dnl AM_PROG_AR was added in automake v1.11.2. AM_PROG_AR does not AC_SUBST + dnl ARFLAGS variable (it is filed into Makefile.in directly by automake + dnl script on-demand, if not specified by ./configure of course). + dnl Don't AC_REQUIRE the AM_PROG_AR otherwise the code for __ACK__ above + dnl will be ignored. Also, pay attention to call AM_PROG_AR in else block + dnl because AM_PROG_AR is written so it could re-set AR variable even for + dnl __ACK__. It may seem like its easier to avoid calling the macro here, + dnl but we need to AC_SUBST both AR/ARFLAGS (thus those must have some good + dnl default value and automake should usually know them). + m4_ifdef([AM_PROG_AR], [AM_PROG_AR], [:]) + fi + + dnl In case the code above has not helped with setting AR/ARFLAGS, use + dnl Automake-documented default values for AR and ARFLAGS, but prefer + dnl ${host}-ar over ar (useful for cross-compiling). + AC_CHECK_TOOL([AR], [ar], [ar]) + if test -z "$ARFLAGS"; then + ARFLAGS='cr' fi + AC_SUBST([AR]) AC_SUBST([ARFLAGS]) if test -z "$RANLIB"; then @@ -309,26 +332,28 @@ ]) # AC_C_RESTRICT -# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61, -# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++ -# works. -# This definition can be removed once autoconf >= 2.62 can be assumed. -# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness. -m4_ifndef([AC_AUTOCONF_VERSION],[ +# This definition is copied from post-2.69 Autoconf and overrides the +# AC_C_RESTRICT macro from autoconf 2.60..2.69. It can be removed +# once autoconf >= 2.70 can be assumed. It's painful to check version +# numbers, and in practice this macro is more up-to-date than Autoconf +# is, so override Autoconf unconditionally. AC_DEFUN([AC_C_RESTRICT], [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], [ac_cv_c_restrict=no # The order here caters to the fact that C++ does not require restrict. for ac_kw in __restrict __restrict__ _Restrict restrict; do - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; - }]], - [[int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t)]])], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[typedef int *int_ptr; + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } + ]], + [[int s[1]; + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); + ]])], [ac_cv_c_restrict=$ac_kw]) test "$ac_cv_c_restrict" != no && break done @@ -338,21 +363,21 @@ nothing if this is not supported. Do not define if restrict is supported directly. */ #undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict, even - though the corresponding Sun C compiler does, which causes - "#define restrict _Restrict" in the previous line. Perhaps some future - version of Sun C++ will work with _Restrict; if so, it'll probably - define __RESTRICT, just as Sun C does. */ +/* Work around a bug in Sun C++: it does not support _Restrict or + __restrict__, even though the corresponding Sun C compiler ends up with + "#define restrict _Restrict" or "#define restrict __restrict__" in the + previous line. Perhaps some future version of Sun C++ will work with + restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ #if defined __SUNPRO_CC && !defined __RESTRICT # define _Restrict +# define __restrict__ #endif]) case $ac_cv_c_restrict in restrict) ;; no) AC_DEFINE([restrict], []) ;; *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; esac -]) -]) +])# AC_C_RESTRICT # gl_BIGENDIAN # is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. @@ -431,7 +456,9 @@ else ac_cv_path_SED=$SED fi + ]) SED="$ac_cv_path_SED" AC_SUBST([SED])dnl rm -f conftest.sed -])])]) +]) +]) diff -Nru supermin-5.1.17/m4/gnulib-comp.m4 supermin-5.1.18/m4/gnulib-comp.m4 --- supermin-5.1.17/m4/gnulib-comp.m4 2014-03-12 19:05:45.000000000 +0000 +++ supermin-5.1.18/m4/gnulib-comp.m4 2017-03-01 12:02:22.000000000 +0000 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -37,8 +37,13 @@ m4_pattern_allow([^gl_ES$])dnl a valid locale name m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable + + # Pre-early section. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_PROG_AR_RANLIB]) + # Code from module absolute-header: + # Code from module assure: # Code from module at-internal: # Code from module bitrotate: # Code from module chdir: @@ -62,7 +67,6 @@ # Code from module error: # Code from module exitfail: # Code from module extensions: - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # Code from module extern-inline: # Code from module fchdir: # Code from module fcntl: @@ -72,10 +76,12 @@ # Code from module fdopendir: # Code from module filename: # Code from module filenamecat-lgpl: + # Code from module flexmember: # Code from module fstat: # Code from module fts: # Code from module getcwd-lgpl: # Code from module getdtablesize: + # Code from module getprogname: # Code from module gettext-h: # Code from module gettimeofday: # Code from module hash: @@ -84,6 +90,7 @@ # Code from module intprops: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) + # Code from module limits-h: # Code from module lstat: # Code from module malloc-posix: # Code from module memchr: @@ -109,6 +116,7 @@ # Code from module snippet/warn-on-use: # Code from module ssize_t: # Code from module stat: + # Code from module stdalign: # Code from module stdbool: # Code from module stddef: # Code from module stdint: @@ -169,7 +177,8 @@ gl_DIRENT_SAFER gl_MODULE_INDICATOR([dirent-safer]) gl_FUNC_DIRFD - if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no; then + if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no \ + || test $REPLACE_DIRFD = 1; then AC_LIBOBJ([dirfd]) gl_PREREQ_DIRFD fi @@ -215,6 +224,7 @@ gl_DIRENT_MODULE_INDICATOR([fdopendir]) gl_MODULE_INDICATOR([fdopendir]) gl_FILE_NAME_CONCAT_LGPL + AC_C_FLEXIBLE_ARRAY_MEMBER gl_FUNC_FSTAT if test $REPLACE_FSTAT = 1; then AC_LIBOBJ([fstat]) @@ -236,6 +246,7 @@ gl_PREREQ_GETDTABLESIZE fi gl_UNISTD_MODULE_INDICATOR([getdtablesize]) + gl_FUNC_GETPROGNAME AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) gl_FUNC_GETTIMEOFDAY @@ -246,6 +257,7 @@ gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) gl_I_RING AC_REQUIRE([gl_LARGEFILE]) + gl_LIMITS_H gl_FUNC_LSTAT if test $REPLACE_LSTAT = 1; then AC_LIBOBJ([lstat]) @@ -275,11 +287,11 @@ gl_PREREQ_MEMRCHR fi gl_STRING_MODULE_INDICATOR([memrchr]) - gl_MSVC_INVAL + AC_REQUIRE([gl_MSVC_INVAL]) if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then AC_LIBOBJ([msvc-inval]) fi - gl_MSVC_NOTHROW + AC_REQUIRE([gl_MSVC_NOTHROW]) if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then AC_LIBOBJ([msvc-nothrow]) fi @@ -323,6 +335,7 @@ gl_PREREQ_STAT fi gl_SYS_STAT_MODULE_INDICATOR([stat]) + gl_STDALIGN_H AM_STDBOOL_H gl_STDDEF_H gl_STDINT_H @@ -500,6 +513,7 @@ build-aux/snippet/arg-nonnull.h build-aux/snippet/c++defs.h build-aux/snippet/warn-on-use.h + lib/assure.h lib/basename-lgpl.c lib/bitrotate.c lib/bitrotate.h @@ -541,12 +555,15 @@ lib/filename.h lib/filenamecat-lgpl.c lib/filenamecat.h + lib/flexmember.h lib/fstat.c lib/fts-cycle.c lib/fts.c lib/fts_.h lib/getcwd-lgpl.c lib/getdtablesize.c + lib/getprogname.c + lib/getprogname.h lib/gettext.h lib/gettimeofday.c lib/hash.c @@ -554,6 +571,7 @@ lib/i-ring.c lib/i-ring.h lib/intprops.h + lib/limits.in.h lib/lstat.c lib/malloc.c lib/memchr.c @@ -582,6 +600,7 @@ lib/save-cwd.c lib/save-cwd.h lib/stat.c + lib/stdalign.in.h lib/stdbool.in.h lib/stddef.in.h lib/stdint.in.h @@ -629,15 +648,18 @@ m4/fcntl_h.m4 m4/fdopendir.m4 m4/filenamecat.m4 + m4/flexmember.m4 m4/fstat.m4 m4/fts.m4 m4/getcwd.m4 m4/getdtablesize.m4 + m4/getprogname.m4 m4/gettimeofday.m4 m4/gnulib-common.m4 m4/i-ring.m4 m4/include_next.m4 m4/largefile.m4 + m4/limits-h.m4 m4/longlong.m4 m4/lstat.m4 m4/malloc.m4 @@ -660,6 +682,7 @@ m4/save-cwd.m4 m4/ssize_t.m4 m4/stat.m4 + m4/stdalign.m4 m4/stdbool.m4 m4/stddef_h.m4 m4/stdint.m4 @@ -677,4 +700,5 @@ m4/unistd_h.m4 m4/warn-on-use.m4 m4/wchar_t.m4 + m4/wint_t.m4 ]) diff -Nru supermin-5.1.17/m4/include_next.m4 supermin-5.1.18/m4/include_next.m4 --- supermin-5.1.17/m4/include_next.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/include_next.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # include_next.m4 serial 23 -dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/i-ring.m4 supermin-5.1.18/m4/i-ring.m4 --- supermin-5.1.17/m4/i-ring.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/i-ring.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # serial 2 -dnl Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/largefile.m4 supermin-5.1.18/m4/largefile.m4 --- supermin-5.1.17/m4/largefile.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/largefile.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ # Enable large files on systems where this is not the default. -# Copyright 1992-1996, 1998-2014 Free Software Foundation, Inc. +# Copyright 1992-1996, 1998-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/limits-h.m4 supermin-5.1.18/m4/limits-h.m4 --- supermin-5.1.17/m4/limits-h.m4 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/m4/limits-h.m4 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,31 @@ +dnl Check whether limits.h has needed features. + +dnl Copyright 2016-2017 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert. + +AC_DEFUN_ONCE([gl_LIMITS_H], +[ + gl_CHECK_NEXT_HEADERS([limits.h]) + + AC_CACHE_CHECK([whether limits.h has ULLONG_WIDTH etc.], + [gl_cv_header_limits_width], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + int ullw = ULLONG_WIDTH;]])], + [gl_cv_header_limits_width=yes], + [gl_cv_header_limits_width=no])]) + if test "$gl_cv_header_limits_width" = yes; then + LIMITS_H= + else + LIMITS_H=limits.h + fi + AC_SUBST([LIMITS_H]) + AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) +]) diff -Nru supermin-5.1.17/m4/longlong.m4 supermin-5.1.18/m4/longlong.m4 --- supermin-5.1.17/m4/longlong.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/longlong.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # longlong.m4 serial 17 -dnl Copyright (C) 1999-2007, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 1999-2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/lstat.m4 supermin-5.1.18/m4/lstat.m4 --- supermin-5.1.17/m4/lstat.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/lstat.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,6 +1,6 @@ -# serial 26 +# serial 27 -# Copyright (C) 1997-2001, 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2001, 2003-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -37,30 +37,28 @@ [gl_cv_func_lstat_dereferences_slashed_symlink], [rm -f conftest.sym conftest.file echo >conftest.file - if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT], - [[struct stat sbuf; - /* Linux will dereference the symlink and fail, as required by - POSIX. That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ - return lstat ("conftest.sym/", &sbuf) == 0; - ]])], - [gl_cv_func_lstat_dereferences_slashed_symlink=yes], - [gl_cv_func_lstat_dereferences_slashed_symlink=no], - [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; - esac - ]) - else - # If the 'ln -s' command failed, then we probably don't even - # have an lstat function. - gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" - fi + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT], + [[struct stat sbuf; + if (symlink ("conftest.file", "conftest.sym") != 0) + return 1; + /* Linux will dereference the symlink and fail, as required by + POSIX. That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0; + ]])], + [gl_cv_func_lstat_dereferences_slashed_symlink=yes], + [gl_cv_func_lstat_dereferences_slashed_symlink=no], + [case "$host_os" in + *-gnu*) + # Guess yes on glibc systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + *) + # If we don't know, assume the worst. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + esac + ]) rm -f conftest.sym conftest.file ]) case "$gl_cv_func_lstat_dereferences_slashed_symlink" in diff -Nru supermin-5.1.17/m4/malloc.m4 supermin-5.1.18/m4/malloc.m4 --- supermin-5.1.17/m4/malloc.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/malloc.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,13 +1,13 @@ -# malloc.m4 serial 14 -dnl Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc. +# malloc.m4 serial 15 +dnl Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. m4_version_prereq([2.70], [] ,[ -# This is taken from the following Autoconf patch: -# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9 +# This is adapted with modifications from upstream Autoconf here: +# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c AC_DEFUN([_AC_FUNC_MALLOC_IF], [ AC_REQUIRE([AC_HEADER_STDC])dnl @@ -23,7 +23,10 @@ char *malloc (); #endif ]], - [[return ! malloc (0);]]) + [[char *p = malloc (0); + int result = !p; + free (p); + return result;]]) ], [ac_cv_func_malloc_0_nonnull=yes], [ac_cv_func_malloc_0_nonnull=no], diff -Nru supermin-5.1.17/m4/memchr.m4 supermin-5.1.18/m4/memchr.m4 --- supermin-5.1.17/m4/memchr.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/memchr.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # memchr.m4 serial 12 -dnl Copyright (C) 2002-2004, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/mempcpy.m4 supermin-5.1.18/m4/mempcpy.m4 --- supermin-5.1.17/m4/mempcpy.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/mempcpy.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # mempcpy.m4 serial 11 -dnl Copyright (C) 2003-2004, 2006-2007, 2009-2014 Free Software Foundation, +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2017 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff -Nru supermin-5.1.17/m4/memrchr.m4 supermin-5.1.18/m4/memrchr.m4 --- supermin-5.1.17/m4/memrchr.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/memrchr.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # memrchr.m4 serial 10 -dnl Copyright (C) 2002-2003, 2005-2007, 2009-2014 Free Software Foundation, +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2017 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff -Nru supermin-5.1.17/m4/mmap-anon.m4 supermin-5.1.18/m4/mmap-anon.m4 --- supermin-5.1.17/m4/mmap-anon.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/mmap-anon.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # mmap-anon.m4 serial 10 -dnl Copyright (C) 2005, 2007, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/mode_t.m4 supermin-5.1.18/m4/mode_t.m4 --- supermin-5.1.17/m4/mode_t.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/mode_t.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # mode_t.m4 serial 2 -dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/msvc-inval.m4 supermin-5.1.18/m4/msvc-inval.m4 --- supermin-5.1.17/m4/msvc-inval.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/msvc-inval.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # msvc-inval.m4 serial 1 -dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/msvc-nothrow.m4 supermin-5.1.18/m4/msvc-nothrow.m4 --- supermin-5.1.17/m4/msvc-nothrow.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/msvc-nothrow.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # msvc-nothrow.m4 serial 1 -dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/multiarch.m4 supermin-5.1.18/m4/multiarch.m4 --- supermin-5.1.17/m4/multiarch.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/multiarch.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # multiarch.m4 serial 7 -dnl Copyright (C) 2008-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/off_t.m4 supermin-5.1.18/m4/off_t.m4 --- supermin-5.1.17/m4/off_t.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/off_t.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # off_t.m4 serial 1 -dnl Copyright (C) 2012-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2012-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/onceonly.m4 supermin-5.1.18/m4/onceonly.m4 --- supermin-5.1.17/m4/onceonly.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/onceonly.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # onceonly.m4 serial 9 -dnl Copyright (C) 2002-2003, 2005-2006, 2008-2014 Free Software Foundation, +dnl Copyright (C) 2002-2003, 2005-2006, 2008-2017 Free Software Foundation, dnl Inc. dnl dnl This file is free software; you can redistribute it and/or modify diff -Nru supermin-5.1.17/m4/openat.m4 supermin-5.1.18/m4/openat.m4 --- supermin-5.1.17/m4/openat.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/openat.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,7 +1,7 @@ # serial 45 # See if we need to use our replacement for Solaris' openat et al functions. -dnl Copyright (C) 2004-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/opendir.m4 supermin-5.1.18/m4/opendir.m4 --- supermin-5.1.17/m4/opendir.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/opendir.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ -# opendir.m4 serial 2 -dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. +# opendir.m4 serial 4 +dnl Copyright (C) 2011-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -22,4 +22,10 @@ fi fi ]) + dnl Replace opendir() on OS/2 kLIBC to support dirfd() function replaced + dnl by gnulib. + case $host_os,$HAVE_OPENDIR in + os2*,1) + REPLACE_OPENDIR=1;; + esac ]) diff -Nru supermin-5.1.17/m4/open.m4 supermin-5.1.18/m4/open.m4 --- supermin-5.1.17/m4/open.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/open.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # open.m4 serial 14 -dnl Copyright (C) 2007-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/pathmax.m4 supermin-5.1.18/m4/pathmax.m4 --- supermin-5.1.17/m4/pathmax.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/pathmax.m4 2017-03-01 12:02:17.000000000 +0000 @@ -1,5 +1,5 @@ # pathmax.m4 serial 10 -dnl Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation, +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2017 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff -Nru supermin-5.1.17/m4/readdir.m4 supermin-5.1.18/m4/readdir.m4 --- supermin-5.1.17/m4/readdir.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/readdir.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ # readdir.m4 serial 1 -dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/realloc.m4 supermin-5.1.18/m4/realloc.m4 --- supermin-5.1.17/m4/realloc.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/realloc.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,13 +1,13 @@ -# realloc.m4 serial 13 -dnl Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc. +# realloc.m4 serial 14 +dnl Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. m4_version_prereq([2.70], [] ,[ -# This is taken from the following Autoconf patch: -# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=7fbb553727ed7e0e689a17594b58559ecf3ea6e9 +# This is adapted with modifications from upstream Autoconf here: +# http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c AC_DEFUN([_AC_FUNC_REALLOC_IF], [ AC_REQUIRE([AC_HEADER_STDC])dnl @@ -23,7 +23,10 @@ char *realloc (); #endif ]], - [[return ! realloc (0, 0);]]) + [[char *p = realloc (0, 0); + int result = !p; + free (p); + return result;]]) ], [ac_cv_func_realloc_0_nonnull=yes], [ac_cv_func_realloc_0_nonnull=no], diff -Nru supermin-5.1.17/m4/save-cwd.m4 supermin-5.1.18/m4/save-cwd.m4 --- supermin-5.1.17/m4/save-cwd.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/save-cwd.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ # serial 10 -dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/ssize_t.m4 supermin-5.1.18/m4/ssize_t.m4 --- supermin-5.1.17/m4/ssize_t.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/ssize_t.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ # ssize_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2001-2003, 2006, 2010-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2003, 2006, 2010-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/stat.m4 supermin-5.1.18/m4/stat.m4 --- supermin-5.1.17/m4/stat.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/stat.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,6 +1,6 @@ # serial 11 -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff -Nru supermin-5.1.17/m4/stdalign.m4 supermin-5.1.18/m4/stdalign.m4 --- supermin-5.1.17/m4/stdalign.m4 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/m4/stdalign.m4 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,57 @@ +# Check for stdalign.h that conforms to C11. + +dnl Copyright 2011-2017 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Prepare for substituting if it is not supported. + +AC_DEFUN([gl_STDALIGN_H], +[ + AC_CACHE_CHECK([for working stdalign.h], + [gl_cv_header_working_stdalign_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + + /* Test that alignof yields a result consistent with offsetof. + This catches GCC bug 52023 + . */ + #ifdef __cplusplus + template struct alignof_helper { char a; t b; }; + # define ao(type) offsetof (alignof_helper, b) + #else + # define ao(type) offsetof (struct { char a; type b; }, b) + #endif + char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1]; + char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; + char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; + + /* Test _Alignas only on platforms where gnulib can help. */ + #if \ + ((defined __cplusplus && 201103 <= __cplusplus) \ + || (defined __APPLE__ && defined __MACH__ \ + ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + : __GNUC__) \ + || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \ + || __ICC || 0x5110 <= __SUNPRO_C \ + || 1300 <= _MSC_VER) + struct alignas_test { char c; char alignas (8) alignas_8; }; + char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 + ? 1 : -1]; + #endif + ]])], + [gl_cv_header_working_stdalign_h=yes], + [gl_cv_header_working_stdalign_h=no])]) + + if test $gl_cv_header_working_stdalign_h = yes; then + STDALIGN_H='' + else + STDALIGN_H='stdalign.h' + fi + + AC_SUBST([STDALIGN_H]) + AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"]) +]) diff -Nru supermin-5.1.17/m4/stdbool.m4 supermin-5.1.18/m4/stdbool.m4 --- supermin-5.1.17/m4/stdbool.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/stdbool.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,11 +1,11 @@ # Check for stdbool.h that conforms to C99. -dnl Copyright (C) 2002-2006, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -#serial 5 +#serial 7 # Prepare for substituting if it is not supported. @@ -43,56 +43,64 @@ [AC_LANG_PROGRAM( [[ #include - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" + + #ifdef __cplusplus + typedef bool Bool; + #else + typedef _Bool Bool; + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif #endif + #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif - struct s { _Bool s: 1; _Bool t; } s; + struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; /* See body of main program for 'e'. */ - char f[(_Bool) 0.0 == false ? 1 : -1]; + char f[(Bool) 0.0 == false ? 1 : -1]; char g[true]; - char h[sizeof (_Bool)]; + char h[sizeof (Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ - _Bool n[m]; + Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ - _Bool q = true; - _Bool *pq = &q; + Bool q = true; + Bool *pq = &q; + bool *qq = &q; ]], [[ bool e = &s; - *pq |= q; - *pq |= ! q; + *pq |= q; *pq |= ! q; + *qq |= q; *qq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); + + !m + !n + !o + !p + !q + !pq + !qq); ]])], [ac_cv_header_stdbool_h=yes], [ac_cv_header_stdbool_h=no])]) diff -Nru supermin-5.1.17/m4/stddef_h.m4 supermin-5.1.18/m4/stddef_h.m4 --- supermin-5.1.17/m4/stddef_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/stddef_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,6 +1,6 @@ -dnl A placeholder for POSIX 2008 , for platforms that have issues. -# stddef_h.m4 serial 4 -dnl Copyright (C) 2009-2014 Free Software Foundation, Inc. +dnl A placeholder for , for platforms that have issues. +# stddef_h.m4 serial 5 +dnl Copyright (C) 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -10,6 +10,9 @@ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) STDDEF_H= + AC_CHECK_TYPE([max_align_t], [], [HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h], + [[#include + ]]) if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 STDDEF_H=stddef.h @@ -43,5 +46,6 @@ [ dnl Assume proper GNU behavior unless another module says otherwise. REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) + HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) ]) diff -Nru supermin-5.1.17/m4/stdint.m4 supermin-5.1.18/m4/stdint.m4 --- supermin-5.1.17/m4/stdint.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/stdint.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ -# stdint.m4 serial 43 -dnl Copyright (C) 2001-2014 Free Software Foundation, Inc. +# stdint.m4 serial 50 +dnl Copyright (C) 2001-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,6 +11,9 @@ [ AC_PREREQ([2.59])dnl + AC_REQUIRE([gl_LIMITS_H]) + AC_REQUIRE([gt_TYPE_WINT_T]) + dnl Check for long long int and unsigned long long int. AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) if test $ac_cv_type_long_long_int = yes; then @@ -70,6 +73,8 @@ AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 #include /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ #if !(defined WCHAR_MIN && defined WCHAR_MAX) @@ -150,6 +155,15 @@ intmax_t i = INTMAX_MAX; uintmax_t j = UINTMAX_MAX; +/* Check that SIZE_MAX has the correct type, if possible. */ +#if 201112 <= __STDC_VERSION__ +int k = _Generic (SIZE_MAX, size_t: 0); +#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) +extern size_t k; +extern __typeof__ (SIZE_MAX) k; +#endif + #include /* for CHAR_BIT */ #define TYPE_MINIMUM(t) \ ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) @@ -218,6 +232,8 @@ AC_RUN_IFELSE([ AC_LANG_PROGRAM([[ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 #include ] gl_STDINT_INCLUDES @@ -278,28 +294,74 @@ ]) ]) fi + + HAVE_C99_STDINT_H=0 + HAVE_SYS_BITYPES_H=0 + HAVE_SYS_INTTYPES_H=0 + STDINT_H=stdint.h if test "$gl_cv_header_working_stdint_h" = yes; then - STDINT_H= + HAVE_C99_STDINT_H=1 + dnl Now see whether the system works without + dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. + AC_CACHE_CHECK([whether stdint.h predates C++11], + [gl_cv_header_stdint_predates_cxx11_h], + [gl_cv_header_stdint_predates_cxx11_h=yes + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include +] +gl_STDINT_INCLUDES +[ +intmax_t im = INTMAX_MAX; +int32_t i32 = INT32_C (0x7fffffff); + ]])], + [gl_cv_header_stdint_predates_cxx11_h=no])]) + + if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then + AC_DEFINE([__STDC_CONSTANT_MACROS], [1], + [Define to 1 if the system predates C++11.]) + AC_DEFINE([__STDC_LIMIT_MACROS], [1], + [Define to 1 if the system predates C++11.]) + fi + AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], + [gl_cv_header_stdint_width], + [gl_cv_header_stdint_width=no + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 + #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + ]gl_STDINT_INCLUDES[ + int iw = UINTMAX_WIDTH; + ]])], + [gl_cv_header_stdint_width=yes])]) + if test "$gl_cv_header_stdint_width" = yes; then + STDINT_H= + fi else dnl Check for , and for dnl (used in Linux libc4 >= 4.6.7 and libc5). AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) if test $ac_cv_header_sys_inttypes_h = yes; then HAVE_SYS_INTTYPES_H=1 - else - HAVE_SYS_INTTYPES_H=0 fi - AC_SUBST([HAVE_SYS_INTTYPES_H]) if test $ac_cv_header_sys_bitypes_h = yes; then HAVE_SYS_BITYPES_H=1 - else - HAVE_SYS_BITYPES_H=0 fi - AC_SUBST([HAVE_SYS_BITYPES_H]) - gl_STDINT_TYPE_PROPERTIES - STDINT_H=stdint.h fi + + dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. + LIMITS_H=limits.h + AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) + + AC_SUBST([HAVE_C99_STDINT_H]) + AC_SUBST([HAVE_SYS_BITYPES_H]) + AC_SUBST([HAVE_SYS_INTTYPES_H]) AC_SUBST([STDINT_H]) AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) ]) @@ -467,7 +529,7 @@ dnl requirement that wint_t is "unchanged by default argument promotions". dnl In this case gnulib's and override wint_t. dnl Set the variable BITSIZEOF_WINT_T accordingly. - if test $BITSIZEOF_WINT_T -lt 32; then + if test $GNULIB_OVERRIDES_WINT_T = 1; then BITSIZEOF_WINT_T=32 fi ]) @@ -477,8 +539,3 @@ m4_ifdef([AC_COMPUTE_INT], [], [ AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) ]) - -# Hey Emacs! -# Local Variables: -# indent-tabs-mode: nil -# End: diff -Nru supermin-5.1.17/m4/stdio_h.m4 supermin-5.1.18/m4/stdio_h.m4 --- supermin-5.1.17/m4/stdio_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/stdio_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,14 +1,45 @@ -# stdio_h.m4 serial 43 -dnl Copyright (C) 2007-2014 Free Software Foundation, Inc. +# stdio_h.m4 serial 48 +dnl Copyright (C) 2007-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDIO_H], [ + AH_VERBATIM([MINGW_ANSI_STDIO], +[/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# undef __USE_MINGW_ANSI_STDIO +#endif +]) + AC_DEFINE([__USE_MINGW_ANSI_STDIO]) AC_REQUIRE([gl_STDIO_H_DEFAULTS]) gl_NEXT_HEADERS([stdio.h]) + dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and + dnl inttypes.h behave like gnu instead of system; we must give our + dnl printf wrapper the right attribute to match. + AC_CACHE_CHECK([which flavor of printf attribute matches inttypes macros], + [gl_cv_func_printf_attribute_flavor], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #define __STDC_FORMAT_MACROS 1 + #include + #include + /* For non-mingw systems, compilation will trivially succeed. + For mingw, compilation will succeed for older mingw (system + printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */ + #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1]; + #endif + ]])], [gl_cv_func_printf_attribute_flavor=system], + [gl_cv_func_printf_attribute_flavor=gnu])]) + if test "$gl_cv_func_printf_attribute_flavor" = gnu; then + AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1], + [Define to 1 if printf and friends should be labeled with + attribute "__gnu_printf__" instead of "__printf__"]) + fi + dnl No need to create extra modules for these functions. Everyone who uses dnl likely needs them. GNULIB_FSCANF=1 diff -Nru supermin-5.1.17/m4/stdlib_h.m4 supermin-5.1.18/m4/stdlib_h.m4 --- supermin-5.1.17/m4/stdlib_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/stdlib_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ -# stdlib_h.m4 serial 42 -dnl Copyright (C) 2007-2014 Free Software Foundation, Inc. +# stdlib_h.m4 serial 43 +dnl Copyright (C) 2007-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -21,7 +21,7 @@ #endif ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps - posix_openpt ptsname ptsname_r random random_r realpath rpmatch + posix_openpt ptsname ptsname_r qsort_r random random_r realpath rpmatch secure_getenv setenv setstate setstate_r srandom srandom_r strtod strtoll strtoull unlockpt unsetenv]) ]) @@ -55,6 +55,7 @@ GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) + GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R]) GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) @@ -84,6 +85,7 @@ HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT]) HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) + HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R]) HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H]) HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) @@ -107,6 +109,7 @@ REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) + REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) diff -Nru supermin-5.1.17/m4/strdup.m4 supermin-5.1.18/m4/strdup.m4 --- supermin-5.1.17/m4/strdup.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/strdup.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,6 +1,6 @@ # strdup.m4 serial 13 -dnl Copyright (C) 2002-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff -Nru supermin-5.1.17/m4/strerror.m4 supermin-5.1.18/m4/strerror.m4 --- supermin-5.1.17/m4/strerror.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/strerror.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ # strerror.m4 serial 17 -dnl Copyright (C) 2002, 2007-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2007-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/string_h.m4 supermin-5.1.18/m4/string_h.m4 --- supermin-5.1.17/m4/string_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/string_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,6 +1,6 @@ # Configure a GNU-like replacement for . -# Copyright (C) 2007-2014 Free Software Foundation, Inc. +# Copyright (C) 2007-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/sys_socket_h.m4 supermin-5.1.18/m4/sys_socket_h.m4 --- supermin-5.1.17/m4/sys_socket_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/sys_socket_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ # sys_socket_h.m4 serial 23 -dnl Copyright (C) 2005-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/sys_stat_h.m4 supermin-5.1.18/m4/sys_stat_h.m4 --- supermin-5.1.17/m4/sys_stat_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/sys_stat_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ # sys_stat_h.m4 serial 28 -*- Autoconf -*- -dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/sys_time_h.m4 supermin-5.1.18/m4/sys_time_h.m4 --- supermin-5.1.17/m4/sys_time_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/sys_time_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,7 +1,7 @@ # Configure a replacement for . # serial 8 -# Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2007, 2009-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -105,6 +105,7 @@ HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY]) HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL]) HAVE_SYS_TIME_H=1; AC_SUBST([HAVE_SYS_TIME_H]) + HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) REPLACE_GETTIMEOFDAY=0; AC_SUBST([REPLACE_GETTIMEOFDAY]) REPLACE_STRUCT_TIMEVAL=0; AC_SUBST([REPLACE_STRUCT_TIMEVAL]) ]) diff -Nru supermin-5.1.17/m4/sys_types_h.m4 supermin-5.1.18/m4/sys_types_h.m4 --- supermin-5.1.17/m4/sys_types_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/sys_types_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ -# sys_types_h.m4 serial 5 -dnl Copyright (C) 2011-2014 Free Software Foundation, Inc. +# sys_types_h.m4 serial 6 +dnl Copyright (C) 2011-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -22,3 +22,28 @@ AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], [ ]) + +# This works around a buggy version in autoconf <= 2.69. +# See + +m4_version_prereq([2.70], [], [ + +# This is taken from the following Autoconf patch: +# http://git.sv.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98 + +m4_undefine([AC_HEADER_MAJOR]) +AC_DEFUN([AC_HEADER_MAJOR], +[AC_CHECK_HEADERS_ONCE([sys/types.h]) +AC_CHECK_HEADER([sys/mkdev.h], + [AC_DEFINE([MAJOR_IN_MKDEV], [1], + [Define to 1 if `major', `minor', and `makedev' are declared in + .])]) +if test $ac_cv_header_sys_mkdev_h = no; then + AC_CHECK_HEADER([sys/sysmacros.h], + [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], + [Define to 1 if `major', `minor', and `makedev' are declared in + .])]) +fi +]) + +]) diff -Nru supermin-5.1.17/m4/time_h.m4 supermin-5.1.18/m4/time_h.m4 --- supermin-5.1.17/m4/time_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/time_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,8 +1,8 @@ # Configure a more-standard replacement for . -# Copyright (C) 2000-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2000-2001, 2003-2007, 2009-2017 Free Software Foundation, Inc. -# serial 8 +# serial 9 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -26,7 +26,7 @@ ]) dnl Check whether 'struct timespec' is declared -dnl in time.h, sys/time.h, or pthread.h. +dnl in time.h, sys/time.h, pthread.h, or unistd.h. AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], [ @@ -44,6 +44,7 @@ TIME_H_DEFINES_STRUCT_TIMESPEC=0 SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 + UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 if test $gl_cv_sys_struct_timespec_in_time_h = yes; then TIME_H_DEFINES_STRUCT_TIMESPEC=1 else @@ -70,12 +71,26 @@ [gl_cv_sys_struct_timespec_in_pthread_h=no])]) if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 + else + AC_CACHE_CHECK([for struct timespec in ], + [gl_cv_sys_struct_timespec_in_unistd_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_unistd_h=yes], + [gl_cv_sys_struct_timespec_in_unistd_h=no])]) + if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then + UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 + fi fi fi fi AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC]) + AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC]) ]) AC_DEFUN([gl_TIME_MODULE_INDICATOR], @@ -94,6 +109,7 @@ GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) + GNULIB_TIME_RZ=0; AC_SUBST([GNULIB_TIME_RZ]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) diff -Nru supermin-5.1.17/m4/unistd_h.m4 supermin-5.1.18/m4/unistd_h.m4 --- supermin-5.1.17/m4/unistd_h.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/unistd_h.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ -# unistd_h.m4 serial 67 -dnl Copyright (C) 2006-2014 Free Software Foundation, Inc. +# unistd_h.m4 serial 69 +dnl Copyright (C) 2006-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -145,6 +145,7 @@ HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) + HAVE_DECL_GETLOGIN=1; AC_SUBST([HAVE_DECL_GETLOGIN]) HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) @@ -173,9 +174,11 @@ REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) REPLACE_READ=0; AC_SUBST([REPLACE_READ]) REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) + REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) + REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) diff -Nru supermin-5.1.17/m4/unistd-safer.m4 supermin-5.1.18/m4/unistd-safer.m4 --- supermin-5.1.17/m4/unistd-safer.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/unistd-safer.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ #serial 9 -dnl Copyright (C) 2002, 2005-2006, 2009-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005-2006, 2009-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/warn-on-use.m4 supermin-5.1.18/m4/warn-on-use.m4 --- supermin-5.1.17/m4/warn-on-use.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/warn-on-use.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ # warn-on-use.m4 serial 5 -dnl Copyright (C) 2010-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2010-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/wchar_t.m4 supermin-5.1.18/m4/wchar_t.m4 --- supermin-5.1.17/m4/wchar_t.m4 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/m4/wchar_t.m4 2017-03-01 12:02:18.000000000 +0000 @@ -1,5 +1,5 @@ # wchar_t.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002-2003, 2008-2014 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff -Nru supermin-5.1.17/m4/wint_t.m4 supermin-5.1.18/m4/wint_t.m4 --- supermin-5.1.17/m4/wint_t.m4 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/m4/wint_t.m4 2017-03-01 12:02:16.000000000 +0000 @@ -0,0 +1,62 @@ +# wint_t.m4 serial 6 +dnl Copyright (C) 2003, 2007-2017 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Test whether has the 'wint_t' type and whether gnulib's +dnl or would, if present, override 'wint_t'. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WINT_T], +[ + AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be included + before . */ +#include +#include +#include +#include + wint_t foo = (wchar_t)'\0';]], + [[]])], + [gt_cv_c_wint_t=yes], + [gt_cv_c_wint_t=no])]) + if test $gt_cv_c_wint_t = yes; then + AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) + + dnl Determine whether gnulib's or would, if present, + dnl override 'wint_t'. + AC_CACHE_CHECK([whether wint_t is too small], + [gl_cv_type_wint_t_too_small], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include +# include +# include +#endif +#include + int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; + ]])], + [gl_cv_type_wint_t_too_small=no], + [gl_cv_type_wint_t_too_small=yes])]) + if test $gl_cv_type_wint_t_too_small = yes; then + GNULIB_OVERRIDES_WINT_T=1 + else + GNULIB_OVERRIDES_WINT_T=0 + fi + else + GNULIB_OVERRIDES_WINT_T=0 + fi + AC_SUBST([GNULIB_OVERRIDES_WINT_T]) +]) diff -Nru supermin-5.1.17/Makefile.in supermin-5.1.18/Makefile.in --- supermin-5.1.17/Makefile.in 2016-11-01 10:56:09.000000000 +0000 +++ supermin-5.1.18/Makefile.in 2017-07-13 09:32:34.000000000 +0000 @@ -120,17 +120,19 @@ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopendir.m4 $(top_srcdir)/m4/filenamecat.m4 \ - $(top_srcdir)/m4/fstat.m4 $(top_srcdir)/m4/fts.m4 \ - $(top_srcdir)/m4/getcwd.m4 $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/fstat.m4 \ + $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ + $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/getprogname.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/largefile.m4 \ - $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lstat.m4 \ - $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \ - $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ - $(top_srcdir)/m4/msvc-inval.m4 \ + $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ + $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/mmap-anon.m4 \ + $(top_srcdir)/m4/mode_t.m4 $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/ocaml.m4 $(top_srcdir)/m4/off_t.m4 \ $(top_srcdir)/m4/onceonly.m4 $(top_srcdir)/m4/open.m4 \ @@ -138,16 +140,16 @@ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/save-cwd.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ - $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio_h.m4 \ - $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strdup.m4 \ - $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ - $(top_srcdir)/m4/sys_socket_h.m4 \ + $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ + $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \ + $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/time_h.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ @@ -216,8 +218,8 @@ CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in COPYING \ - README TODO compile config.guess config.sub depcomp install-sh \ - missing supermin-test-driver + README TODO ar-lib compile config.guess config.sub depcomp \ + install-sh missing supermin-test-driver DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -419,6 +421,7 @@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_OPENAT = @GNULIB_OPENAT@ GNULIB_OPENDIR = @GNULIB_OPENDIR@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -435,6 +438,7 @@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_PUTS = @GNULIB_PUTS@ GNULIB_PWRITE = @GNULIB_PWRITE@ +GNULIB_QSORT_R = @GNULIB_QSORT_R@ GNULIB_RANDOM = @GNULIB_RANDOM@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ @@ -486,6 +490,7 @@ GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ GNULIB_TIME_R = @GNULIB_TIME_R@ +GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ @@ -512,6 +517,7 @@ GREP = @GREP@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ @@ -527,6 +533,7 @@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -582,6 +589,7 @@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ @@ -609,6 +617,7 @@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ @@ -651,6 +660,7 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -679,6 +689,7 @@ LIBRPM_CFLAGS = @LIBRPM_CFLAGS@ LIBRPM_LIBS = @LIBRPM_LIBS@ LIBS = @LIBS@ +LIMITS_H = @LIMITS_H@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ @@ -689,6 +700,7 @@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ @@ -702,6 +714,7 @@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ @@ -815,9 +828,11 @@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ @@ -846,6 +861,7 @@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ @@ -869,6 +885,7 @@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDALIGN_H = @STDALIGN_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ @@ -876,6 +893,7 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ URPMI = @URPMI@ @@ -893,6 +911,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -1188,7 +1207,7 @@ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -1214,7 +1233,7 @@ @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -1232,7 +1251,7 @@ distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -1242,7 +1261,7 @@ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff -Nru supermin-5.1.17/missing supermin-5.1.18/missing --- supermin-5.1.17/missing 2014-03-12 19:05:34.000000000 +0000 +++ supermin-5.1.18/missing 2016-02-17 14:57:44.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2012-06-26.16; # UTC +scriptversion=2013-10-28.13; # UTC -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -160,7 +160,7 @@ ;; autom4te*) echo "You might have modified some maintainer files that require" - echo "the 'automa4te' program to be rebuilt." + echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) diff -Nru supermin-5.1.17/snippet/arg-nonnull.h supermin-5.1.18/snippet/arg-nonnull.h --- supermin-5.1.17/snippet/arg-nonnull.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/snippet/arg-nonnull.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2014 Free Software Foundation, Inc. + Copyright (C) 2009-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff -Nru supermin-5.1.17/snippet/c++defs.h supermin-5.1.18/snippet/c++defs.h --- supermin-5.1.17/snippet/c++defs.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/snippet/c++defs.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* C++ compatible function declaration macros. - Copyright (C) 2010-2014 Free Software Foundation, Inc. + Copyright (C) 2010-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -17,6 +17,15 @@ #ifndef _GL_CXXDEFS_H #define _GL_CXXDEFS_H +/* Begin/end the GNULIB_NAMESPACE namespace. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { +# define _GL_END_NAMESPACE } +#else +# define _GL_BEGIN_NAMESPACE +# define _GL_END_NAMESPACE +#endif + /* The three most frequent use cases of these macros are: * For providing a substitute for a function that is missing on some @@ -111,14 +120,25 @@ that redirects to rpl_func, if GNULIB_NAMESPACE is defined. Example: _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); - */ + + Wrapping rpl_func in an object with an inline conversion operator + avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is + actually used in the program. */ #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) #if defined __cplusplus && defined GNULIB_NAMESPACE # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ - rettype (*const func) parameters = ::rpl_func; \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::rpl_func; \ + } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -135,8 +155,15 @@ # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ - rettype (*const func) parameters = \ - reinterpret_cast(::rpl_func); \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::rpl_func); \ + } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -150,19 +177,24 @@ is defined. Example: _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); - */ + + Wrapping func in an object with an inline conversion operator + avoids a reference to func unless GNULIB_NAMESPACE::func is + actually used in the program. */ #if defined __cplusplus && defined GNULIB_NAMESPACE - /* If we were to write - rettype (*const func) parameters = ::func; - like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls - better (remove an indirection through a 'static' pointer variable), - but then the _GL_CXXALIASWARN macro below would cause a warning not only - for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ -# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ - namespace GNULIB_NAMESPACE \ - { \ - static rettype (*func) parameters = ::func; \ - } \ +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::func; \ + } \ + } func = {}; \ + } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ @@ -178,8 +210,15 @@ # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ namespace GNULIB_NAMESPACE \ { \ - static rettype (*func) parameters = \ - reinterpret_cast(::func); \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::func); \ + } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else @@ -202,9 +241,15 @@ # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ namespace GNULIB_NAMESPACE \ { \ - static rettype (*func) parameters = \ - reinterpret_cast( \ - (rettype2(*)parameters2)(::func)); \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast((rettype2 (*) parameters2)(::func)); \ + } \ + } func = {}; \ } \ _GL_EXTERN_C int _gl_cxxalias_dummy #else diff -Nru supermin-5.1.17/snippet/warn-on-use.h supermin-5.1.18/snippet/warn-on-use.h --- supermin-5.1.17/snippet/warn-on-use.h 2014-03-12 19:05:43.000000000 +0000 +++ supermin-5.1.18/snippet/warn-on-use.h 2017-03-01 12:02:16.000000000 +0000 @@ -1,5 +1,5 @@ /* A C macro for emitting warnings if a function is used. - Copyright (C) 2010-2014 Free Software Foundation, Inc. + Copyright (C) 2010-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff -Nru supermin-5.1.17/src/build.ml supermin-5.1.18/src/build.ml --- supermin-5.1.17/src/build.ml 2016-07-06 13:01:03.000000000 +0000 +++ supermin-5.1.18/src/build.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,458 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -open Unix -open Printf - -open Utils -open Types -open Package_handler -open Fnmatch -open Glob -open Realpath - -type appliance = { - excludefiles : string list; (* list of wildcards *) - hostfiles : string list; (* list of wildcards *) - packages : string list; (* list of package names *) - (* Note that base images don't appear here because they are unpacked - * into a build directory as we discover them. - *) -} - -let empty_appliance = { excludefiles = []; hostfiles = []; packages = [] } - -type file_type = -| GZip of file_content -| XZ of file_content -| Uncompressed of file_content -and file_content = -| Base_image (* a tarball *) -| Packages -| Hostfiles -| Excludefiles - -let rec string_of_file_type = function - | GZip c -> sprintf "gzip %s" (string_of_file_content c) - | XZ c -> sprintf "xz %s" (string_of_file_content c) - | Uncompressed c -> sprintf "uncompressed %s" (string_of_file_content c) -and string_of_file_content = function - | Base_image -> "base image (tar)" - | Packages -> "packages" - | Hostfiles -> "hostfiles" - | Excludefiles -> "excludefiles" - -let rec build debug - (copy_kernel, dtb_wildcard, format, host_cpu, - packager_config, tmpdir, use_installed, size, - include_packagelist) - inputs outputdir = - if debug >= 1 then - printf "supermin: build: %s\n%!" (String.concat " " inputs); - - if inputs = [] then - error "build: no input supermin appliance specified"; - - (* When base images are seen, they are unpacked into this temporary - * directory. But to speed things up, when we are building a chroot, - * set the basedir to be the output directory, so we avoid copying - * from a temporary directory to the output directory. - *) - let basedir = - match format with - | Chroot -> - outputdir - | Ext2 -> - let basedir = tmpdir // "base.d" in - mkdir basedir 0o755; - basedir in - - (* Read the supermin appliance, ie. the input files and/or - * directories that make up the appliance. - *) - if debug >= 1 then - printf "supermin: reading the supermin appliance\n%!"; - let appliance = read_appliance debug basedir empty_appliance inputs in - - (* Resolve dependencies in the list of packages. *) - let ph = get_package_handler () in - if debug >= 1 then - printf "supermin: mapping package names to installed packages\n%!"; - let packages = filter_map ph.ph_package_of_string appliance.packages in - if debug >= 1 then - printf "supermin: resolving full list of package dependencies\n%!"; - let packages = - let packages = package_set_of_list packages in - get_all_requires packages in - - (* Get the list of packages only if we need to, i.e. when creating - * /packagelist in the appliance, when printing all the packages - * for debug, or in both cases. - *) - let pretty_packages = - if include_packagelist || debug >= 2 then ( - let pkg_names = PackageSet.elements packages in - let pkg_names = List.map ph.ph_package_to_string pkg_names in - List.sort compare pkg_names - ) else [] in - - if debug >= 1 then ( - printf "supermin: build: %d packages, including dependencies\n%!" - (PackageSet.cardinal packages); - if debug >= 2 then ( - List.iter (printf " - %s\n") pretty_packages; - flush Pervasives.stdout - ) - ); - - (* List the files in each package. We only want to copy non-config - * files to the full appliance, since config files are included in - * the base image that we saved when preparing the supermin - * appliance. - *) - let files = get_all_files packages in - let files = - List.filter (fun file -> not file.ft_config) files in - - if debug >= 1 then - printf "supermin: build: %d files\n%!" (List.length files); - - (* Remove excludefiles from the list. Notes: (1) The current - * implementation does not apply excludefiles to the base image. (2) - * The current implementation does not apply excludefiles to the - * hostfiles (see below). - *) - let files = - if appliance.excludefiles = [] then files - else ( - let fn_flags = [FNM_NOESCAPE] in - List.filter ( - fun { ft_path = path } -> - let include_ = - List.for_all ( - fun pattern -> not (fnmatch pattern path fn_flags) - ) appliance.excludefiles in - if debug >= 2 && not include_ then - printf "supermin: build: excluding %s\n%!" path; - include_ - ) files - ) in - - if debug >= 1 then - printf "supermin: build: %d files, after matching excludefiles\n%!" - (List.length files); - - (* Add hostfiles. This may contain wildcards too. *) - let files = - if appliance.hostfiles = [] then files - else ( - let hostfiles = List.map ( - fun pattern -> glob pattern [GLOB_NOESCAPE] - ) appliance.hostfiles in - let hostfiles = List.map Array.to_list hostfiles in - let hostfiles = List.flatten hostfiles in - let hostfiles = List.map ( - fun path -> {ft_path = path; ft_source_path = path; ft_config = false} - ) hostfiles in - files @ hostfiles - ) in - - if debug >= 1 then - printf "supermin: build: %d files, after adding hostfiles\n%!" - (List.length files); - - (* Remove files from the list which don't exist on the host or are - * unreadable to us. - *) - let files = - List.filter ( - fun file -> - try ignore (lstat file.ft_source_path); true - with Unix_error _ -> - try ignore (lstat file.ft_path); true - with Unix_error _ -> false - ) files in - - if debug >= 1 then - printf "supermin: build: %d files, after removing unreadable files\n%!" - (List.length files); - - (* Difficult to explain what this does. See comment below. *) - let files = munge files in - - if debug >= 1 then ( - printf "supermin: build: %d files, after munging\n%!" - (List.length files); - if debug >= 2 then ( - List.iter (fun { ft_path = path } -> printf " - %s\n" path) files; - flush Pervasives.stdout - ) - ); - - (* Create a temporary file for packagelist, if requested. *) - let packagelist_file = - if include_packagelist then ( - let filename = tmpdir // "packagelist" in - let chan = open_out filename in - List.iter (fprintf chan "%s\n") pretty_packages; - close_out chan; - Some filename - ) else None in - - (* Depending on the format, we build the appliance in different ways. *) - (match format with - | Chroot -> - (* chroot doesn't need an external kernel or initrd *) - Chroot.build_chroot debug files outputdir packagelist_file - - | Ext2 -> - let kernel = outputdir // "kernel" - and dtb = outputdir // "dtb" - and appliance = outputdir // "root" - and initrd = outputdir // "initrd" in - let kernel_version, modpath = - Kernel.build_kernel debug host_cpu dtb_wildcard copy_kernel kernel dtb in - Ext2.build_ext2 debug basedir files modpath kernel_version appliance size - packagelist_file; - Ext2_initrd.build_initrd debug tmpdir modpath initrd - ) - -and read_appliance debug basedir appliance = function - | [] -> appliance - - | dir :: rest when Sys.is_directory dir -> - let inputs = Array.to_list (Sys.readdir dir) in - let inputs = List.sort compare inputs in - let inputs = List.map ((//) dir) inputs in - read_appliance debug basedir appliance (inputs @ rest) - - | file :: rest -> - let file_type = get_file_type file in - - if debug >= 1 then - printf "supermin: build: visiting %s type %s\n%!" - file (string_of_file_type file_type); - - (* Depending on the file type, read or unpack the file. *) - let appliance = - match file_type with - | Uncompressed ((Packages|Hostfiles|Excludefiles) as t) -> - let chan = open_in file in - let lines = input_all_lines chan in - close_in chan; - update_appliance appliance lines t - | GZip ((Packages|Hostfiles|Excludefiles) as t) -> - let cmd = sprintf "zcat %s" (quote file) in - let lines = run_command_get_lines cmd in - update_appliance appliance lines t - | XZ ((Packages|Hostfiles|Excludefiles) as t) -> - let cmd = sprintf "xzcat %s" (quote file) in - let lines = run_command_get_lines cmd in - update_appliance appliance lines t - | Uncompressed Base_image -> - let cmd = sprintf "tar -C %s -xf %s" (quote basedir) (quote file) in - run_command cmd; - appliance - | GZip Base_image -> - let cmd = - sprintf "zcat %s | tar -C %s -xf -" (quote file) (quote basedir) in - run_command cmd; - appliance - | XZ Base_image -> - let cmd = - sprintf "xzcat %s | tar -C %s -xf -" (quote file) (quote basedir) in - run_command cmd; - appliance in - - read_appliance debug basedir appliance rest - -and update_appliance appliance lines = function - | Packages -> - { appliance with packages = appliance.packages @ lines } - | Hostfiles -> - { appliance with hostfiles = appliance.hostfiles @ lines } - | Excludefiles -> - let lines = List.map ( - fun path -> - let n = String.length path in - if n < 1 || path.[0] <> '-' then - error "excludefiles line does not start with '-'"; - String.sub path 1 (n-1) - ) lines in - { appliance with excludefiles = appliance.excludefiles @ lines } - | Base_image -> assert false - -(* Determine the [file_type] of [file], or exit with an error. *) -and get_file_type file = - let chan = open_in file in - let buf = String.create 512 in - let len = input chan buf 0 (String.length buf) in - close_in chan; - - if len >= 3 && buf.[0] = '\x1f' && buf.[1] = '\x8b' && buf.[2] = '\x08' - then (* gzip-compressed file *) - GZip (get_compressed_file_content "zcat" file) - else if len >= 6 && buf.[0] = '\xfd' && buf.[1] = '7' && buf.[2] = 'z' && - buf.[3] = 'X' && buf.[4] = 'Z' && buf.[5] = '\000' - then (* xz-compressed file *) - XZ (get_compressed_file_content "xzcat" file) - else - Uncompressed (get_file_content file buf len) - -and get_file_content file buf len = - if len >= 262 && buf.[257] = 'u' && buf.[258] = 's' && - buf.[259] = 't' && buf.[260] = 'a' && buf.[261] = 'r' - then (* tar file *) - Base_image - else if len >= 6 && - buf.[0] = '0' && buf.[1] = '7' && - buf.[2] = '0' && buf.[3] = '7' && - buf.[4] = '0' && buf.[5] = '1' then ( - (* However we intend to support them in future for both input - * and output. - *) - error "%s: cpio files are not supported in this version of supermin" file; - ) - else if len >= 2 && buf.[0] = '/' then Hostfiles - else if len >= 2 && buf.[0] = '-' then Excludefiles - else if len >= 1 && isalnum buf.[0] then Packages - else error "%s: unknown file type in supermin directory" file - -and get_compressed_file_content zcat file = - let cmd = sprintf "%s %s" zcat (quote file) in - let chan_out, chan_in, chan_err = open_process_full cmd [||] in - let buf = String.create 512 in - let len = input chan_out buf 0 (String.length buf) in - (* We're expecting the subprocess to fail because we close the pipe - * early, so: - *) - ignore (Unix.close_process_full (chan_out, chan_in, chan_err)); - - get_file_content file buf len - -and isalnum = function - | '0'..'9' | 'a'..'z' | 'A'..'Z' -> true - | _ -> false - -(* The files may not be listed in an order that allows us to run - * through the list (even if we sorted it). The particular problem is - * where you have: - * - * - /lib is a symlink to /usr/lib - * - /lib/modules exists - * - /usr/lib - * - * The problem is that /lib is created as a symlink to a directory - * that doesn't yet exist (/usr/lib), and so it fails when you - * try to create /lib/modules (ie. really /usr/lib/modules). - * - * A second problem is that intermediate directories are not - * necessarily listed. eg. "/foo/bar/baz" might appear, without the - * parent directories appearing in the list. This can happen - * because of excludefiles, or simply packaging mistakes in - * the distro. - * - * We create intermediate directories simply by examining the - * file list. Symlinks to not-yet-existing directories are - * handled by adding the target directory into the list before the - * symlink. - *) -and munge files = - let files = - List.sort (fun f1 f2 -> compare f1.ft_path f2.ft_path) files in - - let rec stat_is_dir dir = - try (stat dir).st_kind = S_DIR with Unix_error _ -> false - and is_lnk_to_dir dir = - try stat_is_dir dir && (lstat dir).st_kind = S_LNK - with Unix_error _ -> false - in - - let insert_dir, dir_seen = - let h = Hashtbl.create (List.length files) in - let insert_dir dir = Hashtbl.replace h dir true in - let dir_seen dir = Hashtbl.mem h dir in - insert_dir, dir_seen - in - - let rec loop = function - | [] -> [] - - | { ft_path = "/" } :: rest -> - (* This is just to avoid a corner-case in subsequent rules. *) - insert_dir "/"; - loop rest - - | dir :: rest when stat_is_dir dir.ft_path && dir_seen dir.ft_path -> - dir :: loop rest - - | dir :: rest when is_lnk_to_dir dir.ft_path -> - insert_dir dir.ft_path; - - (* Symlink to a directory. Insert the target directory before - * if we've not seen it yet. - *) - let target = readlink dir.ft_path in - let parent = Filename.dirname dir.ft_path in - (* Make the target an absolute path. *) - let target = - if String.length target < 1 || target.[0] <> '/' then - realpath (parent // target) - else - target in - (* Remove trailing slash from filenames (RHBZ#1155586). *) - let target = - let len = String.length target in - if len >= 2 && target.[len-1] = '/' then - String.sub target 0 (len-1) - else - target in - if not (dir_seen target) then ( - let target = - {ft_path = target; ft_source_path = target; ft_config = false} in - loop (target :: dir :: rest) - ) - else - dir :: loop rest - - | dir :: rest when stat_is_dir dir.ft_path -> - insert_dir dir.ft_path; - - (* Have we seen the parent? *) - let parent = Filename.dirname dir.ft_path in - if not (dir_seen parent) then ( - let parent = - {ft_path = parent; ft_source_path = parent; ft_config = false} in - loop (parent :: dir :: rest) - ) - else - dir :: loop rest - - | file :: rest -> - (* Have we seen this parent directory before? *) - let dir = Filename.dirname file.ft_path in - if not (dir_seen dir) then ( - let dir = {ft_path = dir; ft_source_path = dir; ft_config = false} in - loop (dir :: file :: rest) - ) - else - file :: loop rest - in - let files = loop files in - - files diff -Nru supermin-5.1.17/src/chroot.ml supermin-5.1.18/src/chroot.ml --- supermin-5.1.17/src/chroot.ml 2015-12-31 17:01:57.000000000 +0000 +++ supermin-5.1.18/src/chroot.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -open Unix -open Printf - -open Utils -open Package_handler - -let build_chroot debug files outputdir packagelist_file = - let do_copy src dest = - if debug >= 2 then printf "supermin: chroot: copy %s\n%!" dest; - let cmd = sprintf "cp -p %s %s" (quote src) (quote dest) in - ignore (Sys.command cmd) - in - - List.iter ( - fun file -> - try - let path = file_source file in - let st = lstat path in - let opath = outputdir // file.ft_path in - match st.st_kind with - | S_DIR -> - (* Note we fix up the permissions of directories in a second - * pass, otherwise we risk creating a directory that we are - * unable to write inside. GNU tar does the same thing! - *) - if debug >= 2 then printf "supermin: chroot: mkdir %s\n%!" opath; - mkdir opath 0o700 - - | S_LNK -> - let link = readlink path in - (* Need to turn absolute links into relative links, so they - * always work, whether or not you are in a chroot. - *) - let link = - if String.length link < 1 || link.[0] <> '/' then - link - else ( - let link = ref link in - for i = 1 to String.length path - 1 do - if path.[i] = '/' then link := "../" ^ !link - done; - !link - ) in - - if debug >= 2 then - printf "supermin: chroot: link %s -> %s\n%!" opath link; - symlink link opath - - | S_REG | S_CHR | S_BLK | S_FIFO | S_SOCK -> - do_copy path opath - with Unix_error _ -> () - ) files; - - (* Add packagelist file, if requested. *) - (match packagelist_file with - | None -> () - | Some filename -> - if debug >= 1 then - printf "supermin: chroot: creating /packagelist\n%!"; - - let opath = outputdir // "packagelist" in - - do_copy filename opath; - (* Change the permissions of the file to be sure it is readable - * by everyone. Unfortunately we cannot change the ownership, - * as non-root users cannot give away files to other users. - *) - chmod opath 0o644 - ); - - (* Second pass: fix up directory permissions in reverse. *) - let dirs = filter_map ( - fun file -> - let path = file_source file in - let st = lstat path in - if st.st_kind = S_DIR then Some (file.ft_path, st) else None - ) files in - List.iter ( - fun (path, st) -> - let opath = outputdir // path in - (try chown opath st.st_uid st.st_gid with Unix_error _ -> ()); - (try chmod opath st.st_perm with Unix_error _ -> ()) - ) (List.rev dirs) diff -Nru supermin-5.1.17/src/config.ml supermin-5.1.18/src/config.ml --- supermin-5.1.17/src/config.ml 2016-11-01 10:56:56.000000000 +0000 +++ supermin-5.1.18/src/config.ml 2017-07-13 09:33:07.000000000 +0000 @@ -18,7 +18,7 @@ *) let package_name = "supermin" -let package_version = "5.1.17" +let package_version = "5.1.18" let host_cpu = "x86_64" let apt_get = "no" diff -Nru supermin-5.1.17/src/.depend supermin-5.1.18/src/.depend --- supermin-5.1.17/src/.depend 2016-11-01 10:56:58.000000000 +0000 +++ supermin-5.1.18/src/.depend 2017-07-13 09:33:18.000000000 +0000 @@ -1,51 +1,60 @@ -./build.cmo : utils.cmi types.cmo realpath.cmi package_handler.cmi kernel.cmo glob.cmi fnmatch.cmi ext2_initrd.cmo ext2.cmo chroot.cmo -./build.cmx : utils.cmx types.cmx realpath.cmx package_handler.cmx kernel.cmx glob.cmx fnmatch.cmx ext2_initrd.cmx ext2.cmx chroot.cmx -./chroot.cmo : utils.cmi package_handler.cmi -./chroot.cmx : utils.cmx package_handler.cmx ./config.cmo : config.cmo : ./config.cmx : config.cmx : -./dpkg.cmo : utils.cmi package_handler.cmi os_release.cmi config.cmo -./dpkg.cmx : utils.cmx package_handler.cmx os_release.cmx config.cmx -./ext2.cmo : utils.cmi package_handler.cmi ext2fs.cmi config.cmo -./ext2.cmx : utils.cmx package_handler.cmx ext2fs.cmx config.cmx ./ext2fs.cmi : ./ext2fs.cmo : ./ext2fs.cmi ./ext2fs.cmx : ./ext2fs.cmi -./ext2init.cmi : -./ext2init.cmo : ./ext2init.cmi -./ext2init.cmx : ./ext2init.cmi -./ext2_initrd.cmo : utils.cmi fnmatch.cmi ext2init.cmi ext2fs.cmi config.cmo -./ext2_initrd.cmx : utils.cmx fnmatch.cmx ext2init.cmx ext2fs.cmx config.cmx ./fnmatch.cmi : ./fnmatch.cmo : ./fnmatch.cmi ./fnmatch.cmx : ./fnmatch.cmi +./format_chroot.cmi : package_handler.cmi +./format_chroot.cmo : utils.cmi package_handler.cmi ./format_chroot.cmi +./format_chroot.cmx : utils.cmx package_handler.cmx ./format_chroot.cmi +./format_ext2.cmi : package_handler.cmi +./format_ext2.cmo : utils.cmi package_handler.cmi ext2fs.cmi config.cmo ./format_ext2.cmi +./format_ext2.cmx : utils.cmx package_handler.cmx ext2fs.cmx config.cmx ./format_ext2.cmi +./format_ext2_init.cmi : +./format_ext2_init.cmo : ./format_ext2_init.cmi +./format_ext2_init.cmx : ./format_ext2_init.cmi +./format_ext2_initrd.cmi : +./format_ext2_initrd.cmo : utils.cmi format_ext2_init.cmi fnmatch.cmi ext2fs.cmi config.cmo ./format_ext2_initrd.cmi +./format_ext2_initrd.cmx : utils.cmx format_ext2_init.cmx fnmatch.cmx ext2fs.cmx config.cmx ./format_ext2_initrd.cmi +./format_ext2_kernel.cmi : +./format_ext2_kernel.cmo : utils.cmi glob.cmi fnmatch.cmi ext2fs.cmi ./format_ext2_kernel.cmi +./format_ext2_kernel.cmx : utils.cmx glob.cmx fnmatch.cmx ext2fs.cmx ./format_ext2_kernel.cmi ./glob.cmi : ./glob.cmo : ./glob.cmi ./glob.cmx : ./glob.cmi -./kernel.cmo : utils.cmi fnmatch.cmi ext2fs.cmi -./kernel.cmx : utils.cmx fnmatch.cmx ext2fs.cmx ./librpm.cmi : ./librpm.cmo : ./librpm.cmi ./librpm.cmx : ./librpm.cmi +./mode_build.cmi : types.cmo +./mode_build.cmo : utils.cmi types.cmo realpath.cmi package_handler.cmi glob.cmi format_ext2_kernel.cmi format_ext2_initrd.cmi format_ext2.cmi format_chroot.cmi fnmatch.cmi ./mode_build.cmi +./mode_build.cmx : utils.cmx types.cmx realpath.cmx package_handler.cmx glob.cmx format_ext2_kernel.cmx format_ext2_initrd.cmx format_ext2.cmx format_chroot.cmx fnmatch.cmx ./mode_build.cmi +./mode_prepare.cmi : types.cmo +./mode_prepare.cmo : utils.cmi package_handler.cmi ./mode_prepare.cmi +./mode_prepare.cmx : utils.cmx package_handler.cmx ./mode_prepare.cmi ./os_release.cmi : ./os_release.cmo : utils.cmi ./os_release.cmi ./os_release.cmx : utils.cmx ./os_release.cmi ./package_handler.cmi : ./package_handler.cmo : utils.cmi ./package_handler.cmi ./package_handler.cmx : utils.cmx ./package_handler.cmi -./pacman.cmo : utils.cmi package_handler.cmi os_release.cmi config.cmo -./pacman.cmx : utils.cmx package_handler.cmx os_release.cmx config.cmx -./prepare.cmo : utils.cmi package_handler.cmi -./prepare.cmx : utils.cmx package_handler.cmx +./ph_dpkg.cmi : +./ph_dpkg.cmo : utils.cmi package_handler.cmi os_release.cmi config.cmo ./ph_dpkg.cmi +./ph_dpkg.cmx : utils.cmx package_handler.cmx os_release.cmx config.cmx ./ph_dpkg.cmi +./ph_pacman.cmi : +./ph_pacman.cmo : utils.cmi package_handler.cmi os_release.cmi config.cmo ./ph_pacman.cmi +./ph_pacman.cmx : utils.cmx package_handler.cmx os_release.cmx config.cmx ./ph_pacman.cmi +./ph_rpm.cmi : +./ph_rpm.cmo : utils.cmi package_handler.cmi os_release.cmi librpm.cmi config.cmo ./ph_rpm.cmi +./ph_rpm.cmx : utils.cmx package_handler.cmx os_release.cmx librpm.cmx config.cmx ./ph_rpm.cmi ./realpath.cmi : ./realpath.cmo : ./realpath.cmi ./realpath.cmx : ./realpath.cmi -./rpm.cmo : utils.cmi package_handler.cmi os_release.cmi librpm.cmi config.cmo -./rpm.cmx : utils.cmx package_handler.cmx os_release.cmx librpm.cmx config.cmx -./supermin.cmo : utils.cmi types.cmo prepare.cmo package_handler.cmi config.cmo build.cmo -./supermin.cmx : utils.cmx types.cmx prepare.cmx package_handler.cmx config.cmx build.cmx +./supermin.cmo : utils.cmi types.cmo package_handler.cmi mode_prepare.cmi mode_build.cmi config.cmo +./supermin.cmx : utils.cmx types.cmx package_handler.cmx mode_prepare.cmx mode_build.cmx config.cmx ./types.cmo : ./types.cmx : ./utils.cmi : diff -Nru supermin-5.1.17/src/dpkg.ml supermin-5.1.18/src/dpkg.ml --- supermin-5.1.17/src/dpkg.ml 2016-10-23 08:45:38.000000000 +0000 +++ supermin-5.1.18/src/dpkg.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -open Unix -open Printf - -open Utils -open Package_handler - -let dpkg_detect () = - Config.dpkg <> "no" && - Config.dpkg_deb <> "no" && - Config.dpkg_query <> "no" && - Config.dpkg_divert <> "no" && - Config.apt_get <> "no" && - (List.mem (Os_release.get_id ()) [ "debian"; "ubuntu" ] || - try (stat "/etc/debian_version").st_kind = S_REG with Unix_error _ -> false) - -let dpkg_primary_arch = ref "" -let settings = ref no_settings - -let dpkg_init s = - settings := s; - - let cmd = sprintf "%s --print-architecture" Config.dpkg in - let lines = run_command_get_lines cmd in - match lines with - | [] -> error "dpkg: expecting %s to return some output" cmd - | arch :: _ -> dpkg_primary_arch := arch - -type dpkg_t = { - name : string; - version : string; - arch : string; -} - -(* Memo from package type to internal dpkg_t. *) -let dpkg_of_pkg, pkg_of_dpkg = get_memo_functions () - -let dpkg_packages = Hashtbl.create 13 -let dpkg_package_of_string str = - if Hashtbl.length dpkg_packages == 0 then ( - let cmd = - sprintf "%s --show --showformat='${Package} ${Version} ${Architecture} ${Status}\\n'" - Config.dpkg_query in - let lines = run_command_get_lines cmd in - List.iter ( - fun line -> - match string_split " " line with - | [ name; version; arch; _; _; "installed" ] -> - let dpkg = { name = name; version = version; arch = arch } in - Hashtbl.add dpkg_packages name dpkg - | _ -> (); - ) lines - ); - let candidates = Hashtbl.find_all dpkg_packages str in - (* On multiarch setups, only consider the primary architecture *) - try - let pkg = List.find ( - fun cand -> - cand.arch = !dpkg_primary_arch || cand.arch = "all" - ) candidates in - Some (pkg_of_dpkg pkg) - with - Not_found -> None - -let dpkg_package_to_string pkg = - let dpkg = dpkg_of_pkg pkg in - sprintf "%s_%s_%s" dpkg.name dpkg.version dpkg.arch - -let dpkg_package_name pkg = - let dpkg = dpkg_of_pkg pkg in - dpkg.name - -let dpkg_package_name_arch pkg = - let dpkg = dpkg_of_pkg pkg in - sprintf "%s:%s" dpkg.name dpkg.arch - -let dpkg_get_package_database_mtime () = - (lstat "/var/lib/dpkg/status").st_mtime - -let dpkg_get_all_requires pkgs = - let dpkg_requires = Hashtbl.create 13 in - (* Prepare dpkg_requires hashtbl with depends, pre-depends from all - packages. Strip version information and discard alternative - dependencies *) - let cmd = sprintf "\ - %s --show --showformat='${Package} ${Depends} ${Pre-Depends}\n' | \ - sed -e 's/ *([^)]*) */ /g' \ - -e 's/ *, */ /g' \ - -e 's/ *| *[^ ]* */ /g'" - Config.dpkg_query in - let lines = run_command_get_lines cmd in - List.iter ( - fun line -> - match string_split " " line with - | [] -> () - | pkgname :: [] -> () - | pkgname :: deps -> Hashtbl.add dpkg_requires pkgname deps - ) lines; - - let get pkgs = - let pkgnames = List.map dpkg_package_name (PackageSet.elements pkgs) in - let deps = List.map (Hashtbl.find_all dpkg_requires) pkgnames in - let deps = List.flatten (List.flatten deps) in - let deps = filter_map dpkg_package_of_string deps in - PackageSet.union pkgs (package_set_of_list deps) - in - (* The command above only gets one level of dependencies. We need - * to keep iterating until we reach a fixpoint. - *) - let rec loop pkgs = - let pkgs' = get pkgs in - if PackageSet.equal pkgs pkgs' then pkgs - else loop pkgs' - in - loop pkgs - -let dpkg_diversions = Hashtbl.create 13 -let dpkg_get_all_files pkgs = - if Hashtbl.length dpkg_diversions = 0 then ( - let cmd = sprintf "%s --list" Config.dpkg_divert in - let lines = run_command_get_lines cmd in - List.iter ( - fun line -> - let items = string_split " " line in - match items with - | ["diversion"; "of"; path; "to"; real_path; "by"; pkg] -> - Hashtbl.add dpkg_diversions path real_path - | _ -> () - ) lines - ); - let cmd = - sprintf "%s --listfiles %s | grep '^/' | grep -v '^/.$' | sort -u" - Config.dpkg_query - (quoted_list (List.map dpkg_package_name_arch - (PackageSet.elements pkgs))) in - let lines = run_command_get_lines cmd in - List.map ( - fun path -> - let config = - try string_prefix "/etc/" path && (lstat path).st_kind = S_REG - with Unix_error _ -> false in - let source_path = - try Hashtbl.find dpkg_diversions path - with Not_found -> path in - { ft_path = path; ft_source_path = source_path; ft_config = config } - ) lines - -let dpkg_download_all_packages pkgs dir = - let tdir = !settings.tmpdir // string_random8 () in - mkdir tdir 0o755; - - let dpkgs = List.map dpkg_package_name (PackageSet.elements pkgs) in - - let cmd = - sprintf "cd %s && %s %s download %s" - (quote tdir) - Config.apt_get - (if !settings.debug >= 1 then "" else " --quiet --quiet") - (quoted_list dpkgs) in - run_command cmd; - - (* Unpack each downloaded package. *) - let cmd = - sprintf " -umask 0000 -for f in %s/*.deb; do - %s --fsys-tarfile \"$f\" | (cd %s && tar xf -) -done" - (quote tdir) Config.dpkg_deb (quote dir) in - run_command cmd - -let () = - let ph = { - ph_detect = dpkg_detect; - ph_init = dpkg_init; - ph_fini = (fun () -> ()); - ph_package_of_string = dpkg_package_of_string; - ph_package_to_string = dpkg_package_to_string; - ph_package_name = dpkg_package_name; - ph_get_package_database_mtime = dpkg_get_package_database_mtime; - ph_get_requires = PHGetAllRequires dpkg_get_all_requires; - ph_get_files = PHGetAllFiles dpkg_get_all_files; - ph_download_package = PHDownloadAllPackages dpkg_download_all_packages; - } in - register_package_handler "debian" "dpkg" ph diff -Nru supermin-5.1.17/src/ext2fs-c.c supermin-5.1.18/src/ext2fs-c.c --- supermin-5.1.17/src/ext2fs-c.c 2016-10-23 08:45:38.000000000 +0000 +++ supermin-5.1.18/src/ext2fs-c.c 2017-07-13 07:52:46.000000000 +0000 @@ -32,7 +32,13 @@ #include #include #include + +#if MAJOR_IN_MKDEV +#include +#elif MAJOR_IN_SYSMACROS #include +/* else it's in sys/types.h, included above */ +#endif /* Inlining is broken in the ext2fs header file. Disable it by * defining the following: @@ -185,7 +191,6 @@ static void ext2_mkdir (ext2_filsys fs, ext2_ino_t dir_ino, const char *dirname, const char *basename, mode_t mode, uid_t uid, gid_t gid, time_t ctime, time_t atime, time_t mtime); static void ext2_empty_inode (ext2_filsys fs, ext2_ino_t dir_ino, const char *dirname, const char *basename, mode_t mode, uid_t uid, gid_t gid, time_t ctime, time_t atime, time_t mtime, int major, int minor, int dir_ft, ext2_ino_t *ino_ret); -static void ext2_write_file (ext2_filsys fs, ext2_ino_t ino, const char *buf, size_t size, const char *filename); static void ext2_write_host_file (ext2_filsys fs, ext2_ino_t ino, const char *src, const char *filename); static void ext2_link (ext2_filsys fs, ext2_ino_t dir_ino, const char *basename, ext2_ino_t ino, int dir_ft); static void ext2_clean_path (ext2_filsys fs, ext2_ino_t dir_ino, const char *dirname, const char *basename, int isdir); @@ -462,49 +467,9 @@ *ino_ret = ino; } -/* You must create the file first with ext2_empty_inode. */ -static void -ext2_write_file (ext2_filsys fs, - ext2_ino_t ino, const char *buf, size_t size, - const char *filename) -{ - errcode_t err; - ext2_file_t file; - err = ext2fs_file_open2 (fs, ino, NULL, EXT2_FILE_WRITE, &file); - if (err != 0) - ext2_error_to_exception ("ext2fs_file_open2", err, filename); - - /* ext2fs_file_write cannot deal with partial writes. You have - * to write the entire file in a single call. - */ - unsigned int written; - err = ext2fs_file_write (file, buf, size, &written); - if (err != 0) - ext2_error_to_exception ("ext2fs_file_write", err, filename); - if ((size_t) written != size) - caml_failwith ("ext2fs_file_write: file size != bytes written"); - - err = ext2fs_file_flush (file); - if (err != 0) - ext2_error_to_exception ("ext2fs_file_flush", err, filename); - err = ext2fs_file_close (file); - if (err != 0) - ext2_error_to_exception ("ext2fs_file_close", err, filename); - - /* Update the true size in the inode. */ - struct ext2_inode inode; - err = ext2fs_read_inode (fs, ino, &inode); - if (err != 0) - ext2_error_to_exception ("ext2fs_read_inode", err, filename); - inode.i_size = size; - err = ext2fs_write_inode (fs, ino, &inode); - if (err != 0) - ext2_error_to_exception ("ext2fs_write_inode", err, filename); -} - -/* Same as ext2_write_file, but it copies the file contents from the - * host. You must create the file first with ext2_empty_inode, and - * the host file must be a regular file. +/* Copies the file contents from the host. You must create the file + * first with ext2_empty_inode, and the host file must be a regular + * file. */ static void ext2_write_host_file (ext2_filsys fs, @@ -823,11 +788,17 @@ statbuf.st_ctime, statbuf.st_atime, statbuf.st_mtime, 0, 0, EXT2_FT_SYMLINK, &ino); - char buf[PATH_MAX+1]; - ssize_t r = readlink (src, buf, sizeof buf); + char *buf = malloc (statbuf.st_size+1); + if (buf == NULL) + caml_raise_out_of_memory (); + ssize_t r = readlink (src, buf, statbuf.st_size); if (r == -1) unix_error (errno, (char *) "readlink", caml_copy_string (src)); - ext2_write_file (data->fs, ino, buf, r, dest); + if (r > statbuf.st_size) + r = statbuf.st_size; + buf[r] = '\0'; + ext2fs_symlink (data->fs, dir_ino, ino, dest, buf); + free (buf); } /* Create directory. */ else if (S_ISDIR (statbuf.st_mode)) diff -Nru supermin-5.1.17/src/ext2init-c.c supermin-5.1.18/src/ext2init-c.c --- supermin-5.1.17/src/ext2init-c.c 2016-01-12 11:05:07.000000000 +0000 +++ supermin-5.1.18/src/ext2init-c.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include -#include -#include -#include - -#include -#include - -/* The init binary. - * See: bin2s.pl, init.c. - */ -extern uint8_t _binary_init_start, _binary_init_end; - -value -supermin_binary_init (value unitv) -{ - CAMLparam1 (unitv); - CAMLlocal1 (sv); - size_t n = &_binary_init_end - &_binary_init_start; - - sv = caml_alloc_string (n); - memcpy (String_val (sv), &_binary_init_start, n); - - CAMLreturn (sv); -} diff -Nru supermin-5.1.17/src/ext2init.ml supermin-5.1.18/src/ext2init.ml --- supermin-5.1.17/src/ext2init.ml 2014-02-24 21:57:09.000000000 +0000 +++ supermin-5.1.18/src/ext2init.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -external binary_init : unit -> string = "supermin_binary_init" diff -Nru supermin-5.1.17/src/ext2init.mli supermin-5.1.18/src/ext2init.mli --- supermin-5.1.17/src/ext2init.mli 2014-02-24 21:57:22.000000000 +0000 +++ supermin-5.1.18/src/ext2init.mli 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -val binary_init : unit -> string diff -Nru supermin-5.1.17/src/ext2_initrd.ml supermin-5.1.18/src/ext2_initrd.ml --- supermin-5.1.17/src/ext2_initrd.ml 2016-05-16 20:20:52.000000000 +0000 +++ supermin-5.1.18/src/ext2_initrd.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,193 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2016 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -open Unix -open Printf - -open Utils -open Ext2fs -open Ext2init -open Fnmatch - -module StringSet = Set.Make (String) -module StringMap = Map.Make (String) - -let string_set_of_list strs = List.fold_right StringSet.add strs StringSet.empty -let keys map = StringMap.fold (fun k _ ks -> k :: ks) map [] - -(* The list of modules (wildcards) we consider for inclusion in the - * mini initrd. Only what is needed in order to find a device with an - * ext2 filesystem on it. - *) -let kmods = [ - "ext2.ko*"; - "ext4.ko*"; (* CONFIG_EXT4_USE_FOR_EXT23=y option might be set *) - "virtio*.ko*"; - "libata*.ko*"; - "piix*.ko*"; - "sd_mod.ko*"; - "ata_piix.ko*"; - "crc*.ko*"; - "libcrc*.ko*"; - "ibmvscsic.ko*"; - "libnvdimm.ko*"; - "nd_pmem.ko*"; - "nd_btt.ko*"; - "nfit.ko*"; -] - -(* A blacklist of kmods which match the above patterns, but which we - * subsequently remove. - *) -let not_kmods = [ - "virtio-gpu.ko*"; -] - -let rec build_initrd debug tmpdir modpath initrd = - if debug >= 1 then - printf "supermin: ext2: creating minimal initrd '%s'\n%!" initrd; - - let initdir = tmpdir // "init.d" in - mkdir initdir 0o755; - - (* Read modules.dep file. *) - let moddeps = read_module_deps modpath in - - (* Create a set of top-level modules, that is any module which - * matches a pattern in kmods. - *) - let topset = - let mods = keys moddeps in - List.fold_left ( - fun topset modl -> - let m = Filename.basename modl in - let matches wildcard = fnmatch wildcard m [FNM_PATHNAME] in - if List.exists matches kmods && not (List.exists matches not_kmods) - then - StringSet.add modl topset - else - topset - ) StringSet.empty mods in - - (* Do depth-first search to locate the modules we need to load. Keep - * track of which modules we've added so we don't add them twice. - *) - let visited = ref StringSet.empty in - let chan = open_out (initdir // "modules") in - let rec visit set = - StringSet.iter ( - fun modl -> - if not (StringSet.mem modl !visited) then ( - visited := StringSet.add modl !visited; - - if debug >= 2 then - printf "supermin: ext2: initrd: visiting module %s\n%!" modl; - - (* Visit dependencies first. *) - let deps = - try StringMap.find modl moddeps - with Not_found -> StringSet.empty in - visit deps; - - (* Copy module to the init directory. - * Uncompress the module, if the name ends in .xz or .gz. - *) - let basename = Filename.basename modl in - let basename = - let len = String.length basename in - if Config.xzcat <> "no" && - Filename.check_suffix basename ".xz" - then ( - let basename = String.sub basename 0 (len-3) in - let cmd = sprintf "%s %s > %s" - (quote Config.xzcat) - (quote (modpath // modl)) - (quote (initdir // basename)) in - if debug >= 2 then printf "supermin: %s\n" cmd; - run_command cmd; - basename - ) - else if Config.zcat <> "no" && - Filename.check_suffix basename ".gz" - then ( - let basename = String.sub basename 0 (len-3) in - let cmd = sprintf "%s %s > %s" - (quote Config.zcat) - (quote (modpath // modl)) - (quote (initdir // basename)) in - if debug >= 2 then printf "supermin: %s\n" cmd; - run_command cmd; - basename - ) - else ( - let cmd = - sprintf "cp -t %s %s" - (quote initdir) (quote (modpath // modl)) in - if debug >= 2 then printf "supermin: %s\n" cmd; - run_command cmd; - basename - ) in - - (* Write module name to 'modules' file. *) - fprintf chan "%s\n" basename; - ) - ) set - in - visit topset; - close_out chan; - - if debug >= 1 then - printf "supermin: ext2: wrote %d modules to minimal initrd\n%!" (StringSet.cardinal !visited); - - (* This is the binary blob containing the init "script". *) - let init = binary_init () in - let initfile = initdir // "init" in - let chan = open_out initfile in - output_string chan init; - close_out chan; - chmod initfile 0o755; - - (* Build the cpio file. *) - let cmd = - sprintf "(cd %s && (echo .; ls -1) | cpio --quiet -o -H newc) > %s" - (quote initdir) (quote initrd) in - run_command cmd - -(* Read modules.dep into internal structure. *) -and read_module_deps modpath = - let modules_dep = modpath // "modules.dep" in - let chan = open_in modules_dep in - let lines = input_all_lines chan in - close_in chan; - List.fold_left ( - fun map line -> - let i = String.index line ':' in - let modl = String.sub line 0 i in - let deps = String.sub line (i+1) (String.length line - (i+1)) in - let deps = - if deps <> "" && deps <> " " then ( - let deps = - let len = String.length deps in - if len >= 1 && deps.[0] = ' ' then String.sub deps 1 (len-1) - else deps in - let deps = string_split " " deps in - string_set_of_list deps - ) - else StringSet.empty in - StringMap.add modl deps map - ) StringMap.empty lines diff -Nru supermin-5.1.17/src/ext2.ml supermin-5.1.18/src/ext2.ml --- supermin-5.1.17/src/ext2.ml 2015-12-31 17:01:57.000000000 +0000 +++ supermin-5.1.18/src/ext2.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -open Unix -open Printf - -open Utils -open Ext2fs -open Package_handler - -(* The ext2 image that we build has a size of 4GB if not specified, - * and we 'hope' that the files fit in (otherwise we'll get an error). - * Note that the file is sparsely allocated. - * - * The downside of allocating a very large initial disk is that the - * fixed overhead of ext2 is larger (since ext2 calculates it based on - * the size of the disk). For a 4GB disk the overhead is - * approximately 66MB. - *) -let default_appliance_size = 4L *^ 1024L *^ 1024L *^ 1024L - -let build_ext2 debug basedir files modpath kernel_version appliance size - packagelist_file = - if debug >= 1 then - printf "supermin: ext2: creating empty ext2 filesystem '%s'\n%!" appliance; - - let fd = openfile appliance [O_WRONLY;O_CREAT;O_TRUNC;O_NOCTTY] 0o644 in - let size = - match size with - | None -> default_appliance_size - | Some s -> s in - LargeFile.ftruncate fd size; - close fd; - - let cmd = - sprintf "%s %s ext2 -F%s %s" - Config.mke2fs Config.mke2fs_t_option - (if debug >= 2 then "" else "q") - (quote appliance) in - run_command cmd; - - let fs = ext2fs_open ~debug appliance in - ext2fs_read_bitmaps fs; - - if debug >= 1 then - printf "supermin: ext2: populating from base image\n%!"; - - (* Read files from the base image, which has been unpacked into a - * directory for us. - *) - ext2fs_copy_dir_recursively_from_host fs basedir "/"; - - if debug >= 1 then - printf "supermin: ext2: copying files from host filesystem\n%!"; - - (* Copy files from host filesystem. *) - List.iter ( - fun file -> - let src = file_source file in - ext2fs_copy_file_from_host fs src file.ft_path - ) files; - - (* Add packagelist file, if requested. *) - (match packagelist_file with - | None -> () - | Some filename -> - if debug >= 1 then - printf "supermin: ext2: creating /packagelist\n%!"; - - ext2fs_copy_file_from_host fs filename "/packagelist"; - (* Change the permissions and ownership of the file, to be sure - * it is root-owned, and readable by everyone. - *) - ext2fs_chmod fs "/packagelist" 0o644; - ext2fs_chown fs "/packagelist" 0 0 - ); - - if debug >= 1 then - printf "supermin: ext2: copying kernel modules\n%!"; - - (* Import the kernel modules. *) - ext2fs_copy_file_from_host fs "/lib" "/lib"; - ext2fs_copy_file_from_host fs "/lib/modules" "/lib/modules"; - ext2fs_copy_dir_recursively_from_host fs - modpath ("/lib/modules/" ^ kernel_version); - - ext2fs_close fs diff -Nru supermin-5.1.17/src/format_chroot.ml supermin-5.1.18/src/format_chroot.ml --- supermin-5.1.17/src/format_chroot.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_chroot.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,101 @@ +(* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Unix +open Printf + +open Utils +open Package_handler + +let build_chroot debug files outputdir packagelist_file = + let do_copy src dest = + if debug >= 2 then printf "supermin: chroot: copy %s\n%!" dest; + let cmd = sprintf "cp -p %s %s" (quote src) (quote dest) in + ignore (Sys.command cmd) + in + + List.iter ( + fun file -> + try + let path = file_source file in + let st = lstat path in + let opath = outputdir // file.ft_path in + match st.st_kind with + | S_DIR -> + (* Note we fix up the permissions of directories in a second + * pass, otherwise we risk creating a directory that we are + * unable to write inside. GNU tar does the same thing! + *) + if debug >= 2 then printf "supermin: chroot: mkdir %s\n%!" opath; + mkdir opath 0o700 + + | S_LNK -> + let link = readlink path in + (* Need to turn absolute links into relative links, so they + * always work, whether or not you are in a chroot. + *) + let link = + if String.length link < 1 || link.[0] <> '/' then + link + else ( + let link = ref link in + for i = 1 to String.length path - 1 do + if path.[i] = '/' then link := "../" ^ !link + done; + !link + ) in + + if debug >= 2 then + printf "supermin: chroot: link %s -> %s\n%!" opath link; + symlink link opath + + | S_REG | S_CHR | S_BLK | S_FIFO | S_SOCK -> + do_copy path opath + with Unix_error _ -> () + ) files; + + (* Add packagelist file, if requested. *) + (match packagelist_file with + | None -> () + | Some filename -> + if debug >= 1 then + printf "supermin: chroot: creating /packagelist\n%!"; + + let opath = outputdir // "packagelist" in + + do_copy filename opath; + (* Change the permissions of the file to be sure it is readable + * by everyone. Unfortunately we cannot change the ownership, + * as non-root users cannot give away files to other users. + *) + chmod opath 0o644 + ); + + (* Second pass: fix up directory permissions in reverse. *) + let dirs = filter_map ( + fun file -> + let path = file_source file in + let st = lstat path in + if st.st_kind = S_DIR then Some (file.ft_path, st) else None + ) files in + List.iter ( + fun (path, st) -> + let opath = outputdir // path in + (try chown opath st.st_uid st.st_gid with Unix_error _ -> ()); + (try chmod opath st.st_perm with Unix_error _ -> ()) + ) (List.rev dirs) diff -Nru supermin-5.1.17/src/format_chroot.mli supermin-5.1.18/src/format_chroot.mli --- supermin-5.1.17/src/format_chroot.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_chroot.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,25 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** Implements [--build -f chroot]. *) + +val build_chroot : int -> Package_handler.file list -> string -> string option -> unit +(** [build_chroot debug files outputdir packagelist_file] copies the + list of [files] into the chroot at [outputdir]. The optional + [packagelist] controls creation of [/packagelist] within the + chroot. *) diff -Nru supermin-5.1.17/src/format-ext2-init-c.c supermin-5.1.18/src/format-ext2-init-c.c --- supermin-5.1.17/src/format-ext2-init-c.c 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format-ext2-init-c.c 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,45 @@ +/* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include +#include +#include +#include + +#include +#include + +/* The init binary. + * See: bin2s.pl, init.c. + */ +extern uint8_t _binary_init_start, _binary_init_end; + +value +supermin_binary_init (value unitv) +{ + CAMLparam1 (unitv); + CAMLlocal1 (sv); + size_t n = &_binary_init_end - &_binary_init_start; + + sv = caml_alloc_string (n); + memcpy (String_val (sv), &_binary_init_start, n); + + CAMLreturn (sv); +} diff -Nru supermin-5.1.17/src/format_ext2_init.ml supermin-5.1.18/src/format_ext2_init.ml --- supermin-5.1.17/src/format_ext2_init.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_ext2_init.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,19 @@ +(* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +external binary_init : unit -> string = "supermin_binary_init" diff -Nru supermin-5.1.17/src/format_ext2_init.mli supermin-5.1.18/src/format_ext2_init.mli --- supermin-5.1.17/src/format_ext2_init.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_ext2_init.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,19 @@ +(* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +val binary_init : unit -> string diff -Nru supermin-5.1.17/src/format_ext2_initrd.ml supermin-5.1.18/src/format_ext2_initrd.ml --- supermin-5.1.17/src/format_ext2_initrd.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_ext2_initrd.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,192 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Unix +open Printf + +open Utils +open Ext2fs +open Fnmatch + +module StringSet = Set.Make (String) +module StringMap = Map.Make (String) + +let string_set_of_list strs = List.fold_right StringSet.add strs StringSet.empty +let keys map = StringMap.fold (fun k _ ks -> k :: ks) map [] + +(* The list of modules (wildcards) we consider for inclusion in the + * mini initrd. Only what is needed in order to find a device with an + * ext2 filesystem on it. + *) +let kmods = [ + "ext2.ko*"; + "ext4.ko*"; (* CONFIG_EXT4_USE_FOR_EXT23=y option might be set *) + "virtio*.ko*"; + "libata*.ko*"; + "piix*.ko*"; + "sd_mod.ko*"; + "ata_piix.ko*"; + "crc*.ko*"; + "libcrc*.ko*"; + "ibmvscsic.ko*"; + "libnvdimm.ko*"; + "nd_pmem.ko*"; + "nd_btt.ko*"; + "nfit.ko*"; +] + +(* A blacklist of kmods which match the above patterns, but which we + * subsequently remove. + *) +let not_kmods = [ + "virtio-gpu.ko*"; +] + +let rec build_initrd debug tmpdir modpath initrd = + if debug >= 1 then + printf "supermin: ext2: creating minimal initrd '%s'\n%!" initrd; + + let initdir = tmpdir // "init.d" in + mkdir initdir 0o755; + + (* Read modules.dep file. *) + let moddeps = read_module_deps modpath in + + (* Create a set of top-level modules, that is any module which + * matches a pattern in kmods. + *) + let topset = + let mods = keys moddeps in + List.fold_left ( + fun topset modl -> + let m = Filename.basename modl in + let matches wildcard = fnmatch wildcard m [FNM_PATHNAME] in + if List.exists matches kmods && not (List.exists matches not_kmods) + then + StringSet.add modl topset + else + topset + ) StringSet.empty mods in + + (* Do depth-first search to locate the modules we need to load. Keep + * track of which modules we've added so we don't add them twice. + *) + let visited = ref StringSet.empty in + let chan = open_out (initdir // "modules") in + let rec visit set = + StringSet.iter ( + fun modl -> + if not (StringSet.mem modl !visited) then ( + visited := StringSet.add modl !visited; + + if debug >= 2 then + printf "supermin: ext2: initrd: visiting module %s\n%!" modl; + + (* Visit dependencies first. *) + let deps = + try StringMap.find modl moddeps + with Not_found -> StringSet.empty in + visit deps; + + (* Copy module to the init directory. + * Uncompress the module, if the name ends in .xz or .gz. + *) + let basename = Filename.basename modl in + let basename = + let len = String.length basename in + if Config.xzcat <> "no" && + Filename.check_suffix basename ".xz" + then ( + let basename = String.sub basename 0 (len-3) in + let cmd = sprintf "%s %s > %s" + (quote Config.xzcat) + (quote (modpath // modl)) + (quote (initdir // basename)) in + if debug >= 2 then printf "supermin: %s\n" cmd; + run_command cmd; + basename + ) + else if Config.zcat <> "no" && + Filename.check_suffix basename ".gz" + then ( + let basename = String.sub basename 0 (len-3) in + let cmd = sprintf "%s %s > %s" + (quote Config.zcat) + (quote (modpath // modl)) + (quote (initdir // basename)) in + if debug >= 2 then printf "supermin: %s\n" cmd; + run_command cmd; + basename + ) + else ( + let cmd = + sprintf "cp -t %s %s" + (quote initdir) (quote (modpath // modl)) in + if debug >= 2 then printf "supermin: %s\n" cmd; + run_command cmd; + basename + ) in + + (* Write module name to 'modules' file. *) + fprintf chan "%s\n" basename; + ) + ) set + in + visit topset; + close_out chan; + + if debug >= 1 then + printf "supermin: ext2: wrote %d modules to minimal initrd\n%!" (StringSet.cardinal !visited); + + (* This is the binary blob containing the init "script". *) + let init = Format_ext2_init.binary_init () in + let initfile = initdir // "init" in + let chan = open_out initfile in + output_string chan init; + close_out chan; + chmod initfile 0o755; + + (* Build the cpio file. *) + let cmd = + sprintf "(cd %s && (echo .; ls -1) | cpio --quiet -o -H newc) > %s" + (quote initdir) (quote initrd) in + run_command cmd + +(* Read modules.dep into internal structure. *) +and read_module_deps modpath = + let modules_dep = modpath // "modules.dep" in + let chan = open_in modules_dep in + let lines = input_all_lines chan in + close_in chan; + List.fold_left ( + fun map line -> + let i = String.index line ':' in + let modl = String.sub line 0 i in + let deps = String.sub line (i+1) (String.length line - (i+1)) in + let deps = + if deps <> "" && deps <> " " then ( + let deps = + let len = String.length deps in + if len >= 1 && deps.[0] = ' ' then String.sub deps 1 (len-1) + else deps in + let deps = string_split " " deps in + string_set_of_list deps + ) + else StringSet.empty in + StringMap.add modl deps map + ) StringMap.empty lines diff -Nru supermin-5.1.17/src/format_ext2_initrd.mli supermin-5.1.18/src/format_ext2_initrd.mli --- supermin-5.1.17/src/format_ext2_initrd.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_ext2_initrd.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,31 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** Implements [--build -f ext2] minimal initrd which is required + to mount the ext2 filesystem at runtime. + + See also the {!Format_ext2} module. *) + +val build_initrd : int -> string -> string -> string -> unit +(** [build_initrd debug tmpdir modpath initrd] creates the minimal + initrd required to mount the ext2 filesystem at runtime. + + A small, whitelisted selection of kernel modules is taken + from [modpath], just enough to mount the appliance. + + The output is the file [initrd]. *) diff -Nru supermin-5.1.17/src/format_ext2_kernel.ml supermin-5.1.18/src/format_ext2_kernel.ml --- supermin-5.1.17/src/format_ext2_kernel.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_ext2_kernel.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,259 @@ +(* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Unix +open Printf + +open Utils +open Ext2fs +open Fnmatch +open Glob + +let patt_of_cpu host_cpu = + let models = + match host_cpu with + | "mips" | "mips64" -> [host_cpu; "*-malta"] + | "ppc" | "powerpc" | "powerpc64" -> ["ppc"; "powerpc"; "powerpc64"] + | "sparc" | "sparc64" -> ["sparc"; "sparc64"] + | "amd64" | "x86_64" -> ["amd64"; "x86_64"] + | "parisc" | "parisc64" -> ["hppa"; "hppa64"] + | "ppc64el" -> ["powerpc64le"] + | _ when host_cpu.[0] = 'i' && host_cpu.[2] = '8' && host_cpu.[3] = '6' -> ["?86"] + | _ when String.length host_cpu >= 5 && String.sub host_cpu 0 5 = "armv7" -> ["armmp"] + | _ -> [host_cpu] + in + List.map (fun model -> sprintf "vmlinu?-*-%s" model) models + +let rec build_kernel debug host_cpu copy_kernel kernel = + (* Locate the kernel. *) + let kernel_file, kernel_name, kernel_version, modpath = + try + let kernel_env = getenv "SUPERMIN_KERNEL" in + if debug >= 1 then + printf "supermin: kernel: SUPERMIN_KERNEL environment variable %s\n%!" + kernel_env; + let kernel_version = + try + let v = getenv "SUPERMIN_KERNEL_VERSION" in + if debug >= 1 then + printf "supermin: kernel: SUPERMIN_KERNEL_VERSION environment variable %s\n%!" v; + v + with Not_found -> get_kernel_version_from_file kernel_env in + if debug >= 1 then + printf "supermin: kernel: SUPERMIN_KERNEL version %s\n%!" + kernel_version; + let kernel_name = Filename.basename kernel_env in + let modpath = find_modpath debug kernel_version in + kernel_env, kernel_name, kernel_version, modpath + with Not_found -> + let kernels = + let files = glob "/lib/modules/*/vmlinuz" [GLOB_NOSORT; GLOB_NOESCAPE] in + let files = Array.to_list files in + let kernels = + List.map ( + fun f -> + let modpath = Filename.dirname f in + f, Filename.basename f, Filename.basename modpath, modpath + ) files in + List.sort ( + fun (_, _, a, _) (_, _, b, _) -> compare_version b a + ) kernels in + + if kernels <> [] then ( + let kernel = List.hd kernels in + if debug >= 1 then ( + let kernel_file, _, _, _ = kernel in + printf "supermin: kernel: picked vmlinuz %s\n%!" kernel_file; + ); + kernel + ) else + find_kernel debug host_cpu kernel in + + if debug >= 1 then ( + printf "supermin: kernel: kernel_version %s\n" kernel_version; + printf "supermin: kernel: modules %s\n%!" modpath; + ); + + copy_or_symlink_file copy_kernel kernel_file kernel; + + (kernel_version, modpath) + +and find_kernel debug host_cpu kernel = + let is_arm = + String.length host_cpu >= 3 && + host_cpu.[0] = 'a' && host_cpu.[1] = 'r' && host_cpu.[2] = 'm' in + + let all_files = Sys.readdir "/boot" in + let all_files = Array.to_list all_files in + + (* In original: ls -1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen *) + let patterns = patt_of_cpu host_cpu in + let files = kernel_filter patterns is_arm all_files in + + let files = + if files <> [] then files + else + (* In original: ls -1dvr /boot/vmlinuz-* 2>/dev/null | grep -v xen *) + kernel_filter ["vmlinu?-*"] is_arm all_files in + + if files = [] then no_kernels host_cpu; + + let files = List.sort (fun a b -> compare_version b a) files in + let kernel_name = List.hd files in + let kernel_version = get_kernel_version kernel_name in + + if debug >= 1 then + printf "supermin: kernel: picked kernel %s\n%!" kernel_name; + + (* Get the kernel modules. *) + let modpath = find_modpath debug kernel_version in + + ("/boot" // kernel_name), kernel_name, kernel_version, modpath + +and kernel_filter patterns is_arm all_files = + let files = + List.filter + (fun filename -> + List.exists + (fun patt -> fnmatch patt filename [FNM_NOESCAPE]) patterns + ) all_files in + let files = + List.filter (fun filename -> find filename "xen" = -1) files in + let files = + if not is_arm then files + else ( + List.filter (fun filename -> + find filename "tegra" = -1 + ) files + ) in + List.filter (fun filename -> has_modpath filename) files + +and no_kernels host_cpu = + error "\ +failed to find a suitable kernel (host_cpu=%s). + +I looked for kernels in /boot and modules in /lib/modules. + +If this is a Xen guest, and you only have Xen domU kernels +installed, try installing a fullvirt kernel (only for +supermin use, you shouldn't boot the Xen guest with it)." + host_cpu + +and find_modpath debug kernel_version = + try + let modpath = getenv "SUPERMIN_MODULES" in + if debug >= 1 then + printf "supermin: kernel: SUPERMIN_MODULES environment variable = %s\n%!" + modpath; + modpath + with Not_found -> + let modpath = "/lib/modules/" ^ kernel_version in + if debug >= 1 then + printf "supermin: kernel: picked modules path %s\n%!" modpath; + modpath + +and has_modpath kernel_name = + try + let kv = get_kernel_version kernel_name in + modules_dep_exists kv + with + | Not_found -> false + +and get_kernel_version kernel_name = + if (string_prefix "vmlinuz-" kernel_name) || + (string_prefix "vmlinux-" kernel_name) then ( + let kv = String.sub kernel_name 8 (String.length kernel_name - 8) in + if modules_dep_exists kv then kv + else get_kernel_version_from_name kernel_name + ) else get_kernel_version_from_name kernel_name + +and modules_dep_exists kv = + try (lstat ("/lib/modules/" ^ kv ^ "/modules.dep")).st_kind = S_REG + with Unix_error _ -> false + +and get_kernel_version_from_name kernel_name = + get_kernel_version_from_file ("/boot" // kernel_name) + +(* Extract the kernel version from a Linux kernel file. + * + * Returns a string containing the version or [Not_found] if the + * file can't be read, is not a Linux kernel, or the version can't + * be found. + * + * See ftp://ftp.astron.com/pub/file/file-.tar.gz + * (file-/magic/Magdir/linux) for the rules used to find the + * version number: + * 514 string HdrS Linux kernel + * >518 leshort >0x1ff + * >>(526.s+0x200) string >\0 version %s, + * + * Bugs: probably limited to x86 kernels. + *) +and get_kernel_version_from_file file = + try + let chan = open_in file in + let buf = read_string chan 514 4 in + if buf <> "HdrS" then ( + close_in chan; + raise Not_found + ); + let s = read_leshort chan 518 in + if s < 0x1ff then ( + close_in chan; + raise Not_found + ); + let offset = read_leshort chan 526 in + if offset < 0 then ( + close_in chan; + raise Not_found + ); + let buf = read_string chan (offset + 0x200) 132 in + close_in chan; + let rec loop i = + if i < 132 then ( + if buf.[i] = '\000' || buf.[i] = ' ' || + buf.[i] = '\t' || buf.[i] = '\n' then + String.sub buf 0 i + else + loop (i+1) + ) + else raise Not_found + in + loop 0 + with + | Sys_error _ -> raise Not_found + | Invalid_argument _ -> raise Not_found + +(* Read an unsigned little endian short at a specified offset in a file. *) +and read_leshort chan offset = + let buf = read_string chan offset 2 in + (Char.code buf.[1] lsl 8) lor Char.code buf.[0] + +and read_string chan offset len = + seek_in chan offset; + let buf = String.create len in + really_input chan buf 0 len; + buf + +and copy_or_symlink_file copy_kernel src dest = + if not copy_kernel then + symlink src dest + else ( + let cmd = sprintf "cp -p %s %s" (quote src) (quote dest) in + run_command cmd + ) diff -Nru supermin-5.1.17/src/format_ext2_kernel.mli supermin-5.1.18/src/format_ext2_kernel.mli --- supermin-5.1.17/src/format_ext2_kernel.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_ext2_kernel.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,32 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** For [--build -f ext2] this module chooses a kernel to use + and either links to it or copies it. + + See also the {!Format_ext2} module. *) + +val build_kernel : int -> string -> bool -> string -> string * string +(** [build_kernel debug host_cpu copy_kernel kernel] + chooses the kernel to use and links to it or copies it into the + appliance directory. + + The output is written to the file [kernel]. + + The function returns the [kernel_version, modpath] tuple as a + side-effect of locating the kernel. *) diff -Nru supermin-5.1.17/src/format_ext2.ml supermin-5.1.18/src/format_ext2.ml --- supermin-5.1.17/src/format_ext2.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_ext2.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,102 @@ +(* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Unix +open Printf + +open Utils +open Ext2fs +open Package_handler + +(* The ext2 image that we build has a size of 4GB if not specified, + * and we 'hope' that the files fit in (otherwise we'll get an error). + * Note that the file is sparsely allocated. + * + * The downside of allocating a very large initial disk is that the + * fixed overhead of ext2 is larger (since ext2 calculates it based on + * the size of the disk). For a 4GB disk the overhead is + * approximately 66MB. + *) +let default_appliance_size = 4L *^ 1024L *^ 1024L *^ 1024L + +let build_ext2 debug basedir files modpath kernel_version appliance size + packagelist_file = + if debug >= 1 then + printf "supermin: ext2: creating empty ext2 filesystem '%s'\n%!" appliance; + + let fd = openfile appliance [O_WRONLY;O_CREAT;O_TRUNC;O_NOCTTY] 0o644 in + let size = + match size with + | None -> default_appliance_size + | Some s -> s in + LargeFile.ftruncate fd size; + close fd; + + let cmd = + sprintf "%s %s ext2 -F%s %s" + Config.mke2fs Config.mke2fs_t_option + (if debug >= 2 then "" else "q") + (quote appliance) in + run_command cmd; + + let fs = ext2fs_open ~debug appliance in + ext2fs_read_bitmaps fs; + + if debug >= 1 then + printf "supermin: ext2: populating from base image\n%!"; + + (* Read files from the base image, which has been unpacked into a + * directory for us. + *) + ext2fs_copy_dir_recursively_from_host fs basedir "/"; + + if debug >= 1 then + printf "supermin: ext2: copying files from host filesystem\n%!"; + + (* Copy files from host filesystem. *) + List.iter ( + fun file -> + let src = file_source file in + ext2fs_copy_file_from_host fs src file.ft_path + ) files; + + (* Add packagelist file, if requested. *) + (match packagelist_file with + | None -> () + | Some filename -> + if debug >= 1 then + printf "supermin: ext2: creating /packagelist\n%!"; + + ext2fs_copy_file_from_host fs filename "/packagelist"; + (* Change the permissions and ownership of the file, to be sure + * it is root-owned, and readable by everyone. + *) + ext2fs_chmod fs "/packagelist" 0o644; + ext2fs_chown fs "/packagelist" 0 0 + ); + + if debug >= 1 then + printf "supermin: ext2: copying kernel modules\n%!"; + + (* Import the kernel modules. *) + ext2fs_copy_file_from_host fs "/lib" "/lib"; + ext2fs_copy_file_from_host fs "/lib/modules" "/lib/modules"; + ext2fs_copy_dir_recursively_from_host fs + modpath ("/lib/modules/" ^ kernel_version); + + ext2fs_close fs diff -Nru supermin-5.1.17/src/format_ext2.mli supermin-5.1.18/src/format_ext2.mli --- supermin-5.1.17/src/format_ext2.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/format_ext2.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,29 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** Implements [--build -f chroot]. *) + +val build_ext2 : int -> string -> Package_handler.file list -> string -> string -> string -> int64 option -> string option -> unit +(** [build_ext2 debug basedir files modpath kernel_version appliance size + packagelist_file] copies all the files from [basedir] plus the + list of [files] into a newly created ext2 filesystem called [appliance]. + + Kernel modules are also copied in from the local [modpath] + to the fixed path in the appliance [/lib/modules/]. + + libext2fs is used to populate the ext2 filesystem. *) diff -Nru supermin-5.1.17/src/kernel.ml supermin-5.1.18/src/kernel.ml --- supermin-5.1.17/src/kernel.ml 2016-03-18 13:15:15.000000000 +0000 +++ supermin-5.1.18/src/kernel.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,304 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -open Unix -open Printf - -open Utils -open Ext2fs -open Fnmatch - -let patt_of_cpu host_cpu = - let models = - match host_cpu with - | "mips" | "mips64" -> [host_cpu; "*-malta"] - | "ppc" | "powerpc" | "powerpc64" -> ["ppc"; "powerpc"; "powerpc64"] - | "sparc" | "sparc64" -> ["sparc"; "sparc64"] - | "amd64" | "x86_64" -> ["amd64"; "x86_64"] - | _ when host_cpu.[0] = 'i' && host_cpu.[2] = '8' && host_cpu.[3] = '6' -> ["?86"] - | _ when String.length host_cpu >= 5 && String.sub host_cpu 0 5 = "armv7" -> ["armmp"] - | _ -> [host_cpu] - in - List.map (fun model -> sprintf "vmlinu?-*-%s" model) models - -let rec build_kernel debug host_cpu dtb_wildcard copy_kernel kernel dtb = - (* Locate the kernel. *) - let kernel_name, kernel_version = - find_kernel debug host_cpu copy_kernel kernel in - - (* If the user passed --dtb option, locate dtb. *) - (match dtb_wildcard with - | None -> () - | Some wildcard -> - find_dtb debug copy_kernel kernel_name wildcard dtb - ); - - (* Get the kernel modules. *) - let modpath = find_modpath debug kernel_version in - - if debug >= 1 then ( - printf "supermin: kernel: kernel_version %s\n" kernel_version; - printf "supermin: kernel: modules %s\n%!" modpath; - ); - - (kernel_version, modpath) - -and find_kernel debug host_cpu copy_kernel kernel = - let kernel_file, kernel_name, kernel_version = - try - let kernel_env = getenv "SUPERMIN_KERNEL" in - if debug >= 1 then - printf "supermin: kernel: SUPERMIN_KERNEL environment variable %s\n%!" - kernel_env; - let kernel_version = - try - let v = getenv "SUPERMIN_KERNEL_VERSION" in - if debug >= 1 then - printf "supermin: kernel: SUPERMIN_KERNEL_VERSION environment variable %s\n%!" v; - v - with Not_found -> get_kernel_version_from_file kernel_env in - if debug >= 1 then - printf "supermin: kernel: SUPERMIN_KERNEL version %s\n%!" - kernel_version; - let kernel_name = Filename.basename kernel_env in - kernel_env, kernel_name, kernel_version - with Not_found -> - let is_arm = - String.length host_cpu >= 3 && - host_cpu.[0] = 'a' && host_cpu.[1] = 'r' && host_cpu.[2] = 'm' in - - let all_files = Sys.readdir "/boot" in - let all_files = Array.to_list all_files in - - (* In original: ls -1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen *) - let patterns = patt_of_cpu host_cpu in - let files = kernel_filter patterns is_arm all_files in - - let files = - if files <> [] then files - else - (* In original: ls -1dvr /boot/vmlinuz-* 2>/dev/null | grep -v xen *) - kernel_filter ["vmlinu?-*"] is_arm all_files in - - if files = [] then no_kernels host_cpu; - - let files = List.sort (fun a b -> compare_version b a) files in - let kernel_name = List.hd files in - let kernel_version = get_kernel_version kernel_name in - - if debug >= 1 then - printf "supermin: kernel: picked kernel %s\n%!" kernel_name; - - ("/boot" // kernel_name), kernel_name, kernel_version in - - copy_or_symlink_file copy_kernel kernel_file kernel; - kernel_name, kernel_version - -and kernel_filter patterns is_arm all_files = - let files = - List.filter - (fun filename -> - List.exists - (fun patt -> fnmatch patt filename [FNM_NOESCAPE]) patterns - ) all_files in - let files = - List.filter (fun filename -> find filename "xen" = -1) files in - let files = - if not is_arm then files - else ( - List.filter (fun filename -> - find filename "tegra" = -1 - ) files - ) in - List.filter (fun filename -> has_modpath filename) files - -and no_kernels host_cpu = - error "\ -failed to find a suitable kernel (host_cpu=%s). - -I looked for kernels in /boot and modules in /lib/modules. - -If this is a Xen guest, and you only have Xen domU kernels -installed, try installing a fullvirt kernel (only for -supermin use, you shouldn't boot the Xen guest with it)." - host_cpu - -and find_dtb debug copy_kernel kernel_name wildcard dtb = - let dtb_file = - try - let dtb_file = getenv "SUPERMIN_DTB" in - if debug >= 1 then - printf "supermin: kernel: SUPERMIN_DTB environment variable = %s\n%!" - dtb_file; - dtb_file - with Not_found -> - (* Replace vmlinuz- with dtb- *) - if not (string_prefix "vmlinuz-" kernel_name) && - not (string_prefix "vmlinuz-" kernel_name) then - no_dtb_dir kernel_name; - let dtb_dir = - try - List.find dir_exists ( - List.map (fun prefix -> - prefix ^ String.sub kernel_name 8 (String.length kernel_name - 8) - ) ["/boot/dtb-"; "/usr/lib/linux-image-"]) - with Not_found -> - no_dtb_dir kernel_name; "" - in - - let all_files = Sys.readdir dtb_dir in - let all_files = Array.to_list all_files in - - let files = - List.filter (fun filename -> fnmatch wildcard filename [FNM_NOESCAPE]) - all_files in - if files = [] then - no_dtb dtb_dir wildcard; - - let dtb_name = List.hd files in - let dtb_file = dtb_dir // dtb_name in - if debug >= 1 then - printf "supermin: kernel: picked dtb %s\n%!" dtb_file; - dtb_file in - - copy_or_symlink_file copy_kernel dtb_file dtb - -and no_dtb_dir kernel_name = - error "\ -failed to find a dtb (device tree) directory. - -I expected to take '%s' and to -replace vmlinuz- with dtb- to form a directory. - -You can set SUPERMIN_KERNEL, SUPERMIN_MODULES and SUPERMIN_DTB -to override automatic selection. See supermin(1)." - kernel_name - -and no_dtb dtb_dir wildcard = - error "\ -failed to find a matching device tree. - -I looked for a file matching '%s' in directory '%s'. - -You can set SUPERMIN_KERNEL, SUPERMIN_MODULES and SUPERMIN_DTB -to override automatic selection. See supermin(1)." - wildcard dtb_dir - -and find_modpath debug kernel_version = - try - let modpath = getenv "SUPERMIN_MODULES" in - if debug >= 1 then - printf "supermin: kernel: SUPERMIN_MODULES environment variable = %s\n%!" - modpath; - modpath - with Not_found -> - let modpath = "/lib/modules/" ^ kernel_version in - if debug >= 1 then - printf "supermin: kernel: picked modules path %s\n%!" modpath; - modpath - -and has_modpath kernel_name = - try - let kv = get_kernel_version kernel_name in - modules_dep_exists kv - with - | Not_found -> false - -and get_kernel_version kernel_name = - if (string_prefix "vmlinuz-" kernel_name) || - (string_prefix "vmlinux-" kernel_name) then ( - let kv = String.sub kernel_name 8 (String.length kernel_name - 8) in - if modules_dep_exists kv then kv - else get_kernel_version_from_name kernel_name - ) else get_kernel_version_from_name kernel_name - -and modules_dep_exists kv = - try (lstat ("/lib/modules/" ^ kv ^ "/modules.dep")).st_kind = S_REG - with Unix_error _ -> false - -and get_kernel_version_from_name kernel_name = - get_kernel_version_from_file ("/boot" // kernel_name) - -(* Extract the kernel version from a Linux kernel file. - * - * Returns a string containing the version or [Not_found] if the - * file can't be read, is not a Linux kernel, or the version can't - * be found. - * - * See ftp://ftp.astron.com/pub/file/file-.tar.gz - * (file-/magic/Magdir/linux) for the rules used to find the - * version number: - * 514 string HdrS Linux kernel - * >518 leshort >0x1ff - * >>(526.s+0x200) string >\0 version %s, - * - * Bugs: probably limited to x86 kernels. - *) -and get_kernel_version_from_file file = - try - let chan = open_in file in - let buf = read_string chan 514 4 in - if buf <> "HdrS" then ( - close_in chan; - raise Not_found - ); - let s = read_leshort chan 518 in - if s < 0x1ff then ( - close_in chan; - raise Not_found - ); - let offset = read_leshort chan 526 in - if offset < 0 then ( - close_in chan; - raise Not_found - ); - let buf = read_string chan (offset + 0x200) 132 in - close_in chan; - let rec loop i = - if i < 132 then ( - if buf.[i] = '\000' || buf.[i] = ' ' || - buf.[i] = '\t' || buf.[i] = '\n' then - String.sub buf 0 i - else - loop (i+1) - ) - else raise Not_found - in - loop 0 - with - | Sys_error _ -> raise Not_found - | Invalid_argument _ -> raise Not_found - -(* Read an unsigned little endian short at a specified offset in a file. *) -and read_leshort chan offset = - let buf = read_string chan offset 2 in - (Char.code buf.[1] lsl 8) lor Char.code buf.[0] - -and read_string chan offset len = - seek_in chan offset; - let buf = String.create len in - really_input chan buf 0 len; - buf - -and copy_or_symlink_file copy_kernel src dest = - if not copy_kernel then - symlink src dest - else ( - let cmd = sprintf "cp -p %s %s" (quote src) (quote dest) in - run_command cmd - ) diff -Nru supermin-5.1.17/src/Makefile.am supermin-5.1.18/src/Makefile.am --- supermin-5.1.17/src/Makefile.am 2016-10-23 08:45:38.000000000 +0000 +++ supermin-5.1.18/src/Makefile.am 2017-03-01 11:34:37.000000000 +0000 @@ -28,9 +28,6 @@ ext2fs-c.c \ ext2fs.ml \ ext2fs.mli \ - ext2init-c.c \ - ext2init.ml \ - ext2init.mli \ fnmatch-c.c \ fnmatch.ml \ fnmatch.mli \ @@ -51,21 +48,32 @@ os_release.mli \ package_handler.ml \ package_handler.mli \ - rpm.ml \ - dpkg.ml \ - pacman.ml \ - prepare.ml \ - chroot.ml \ - kernel.ml \ - ext2_initrd.ml \ - ext2.ml \ - build.ml \ + ph_rpm.ml \ + ph_rpm.mli \ + ph_dpkg.ml \ + ph_dpkg.mli \ + ph_pacman.ml \ + ph_pacman.mli \ + mode_prepare.ml \ + mode_prepare.mli \ + format_chroot.ml \ + format_chroot.mli \ + format-ext2-init-c.c \ + format_ext2_init.ml \ + format_ext2_init.mli \ + format_ext2_initrd.ml \ + format_ext2_initrd.mli \ + format_ext2_kernel.ml \ + format_ext2_kernel.mli \ + format_ext2.ml \ + format_ext2.mli \ + mode_build.ml \ + mode_build.mli \ supermin.ml # Can't use filter for this because of automake brokenness. SOURCES_ML = \ ext2fs.ml \ - ext2init.ml \ fnmatch.ml \ glob.ml \ realpath.ml \ @@ -75,20 +83,21 @@ types.ml \ os_release.ml \ package_handler.ml \ - rpm.ml \ - dpkg.ml \ - pacman.ml \ - prepare.ml \ - chroot.ml \ - kernel.ml \ - ext2_initrd.ml \ - ext2.ml \ - build.ml \ + ph_rpm.ml \ + ph_dpkg.ml \ + ph_pacman.ml \ + mode_prepare.ml \ + format_chroot.ml \ + format_ext2_init.ml \ + format_ext2_initrd.ml \ + format_ext2_kernel.ml \ + format_ext2.ml \ + mode_build.ml \ supermin.ml SOURCES_C = \ ext2fs-c.c \ - ext2init-c.c \ + format-ext2-init-c.c \ fnmatch-c.c \ glob-c.c \ librpm-c.c \ @@ -123,9 +132,9 @@ BEST = opt endif -supermin_DEPENDENCIES = $(OBJECTS) ext2init-bin.o +supermin_DEPENDENCIES = $(OBJECTS) format-ext2-init-bin.o -supermin_LDADD = ext2init-bin.o ../lib/libgnu.a +supermin_LDADD = format-ext2-init-bin.o ../lib/libgnu.a supermin_LINK = \ ./supermin-link.sh \ @@ -139,12 +148,12 @@ .ml.cmx: $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ -CLEANFILES += ext2init-bin.S +CLEANFILES += format-ext2-init-bin.S -ext2init-bin.o: ext2init-bin.S +format-ext2-init-bin.o: format-ext2-init-bin.S $(CC) -o $@ -c $< -ext2init-bin.S: ../init/init $(srcdir)/bin2s.pl +format-ext2-init-bin.S: ../init/init $(srcdir)/bin2s.pl strip --strip-all $< ls -l $< @file $< | grep -isq static || \ diff -Nru supermin-5.1.17/src/Makefile.in supermin-5.1.18/src/Makefile.in --- supermin-5.1.17/src/Makefile.in 2016-11-01 10:56:09.000000000 +0000 +++ supermin-5.1.18/src/Makefile.in 2017-07-13 09:32:34.000000000 +0000 @@ -124,17 +124,19 @@ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopendir.m4 $(top_srcdir)/m4/filenamecat.m4 \ - $(top_srcdir)/m4/fstat.m4 $(top_srcdir)/m4/fts.m4 \ - $(top_srcdir)/m4/getcwd.m4 $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/fstat.m4 \ + $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ + $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/getprogname.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/largefile.m4 \ - $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lstat.m4 \ - $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \ - $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ - $(top_srcdir)/m4/msvc-inval.m4 \ + $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ + $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/mmap-anon.m4 \ + $(top_srcdir)/m4/mode_t.m4 $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/ocaml.m4 $(top_srcdir)/m4/off_t.m4 \ $(top_srcdir)/m4/onceonly.m4 $(top_srcdir)/m4/open.m4 \ @@ -142,16 +144,16 @@ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/save-cwd.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ - $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio_h.m4 \ - $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strdup.m4 \ - $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ - $(top_srcdir)/m4/sys_socket_h.m4 \ + $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ + $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \ + $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/time_h.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -162,9 +164,9 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = supermin-ext2fs-c.$(OBJEXT) \ - supermin-ext2init-c.$(OBJEXT) supermin-fnmatch-c.$(OBJEXT) \ - supermin-glob-c.$(OBJEXT) supermin-librpm-c.$(OBJEXT) \ - supermin-realpath-c.$(OBJEXT) + supermin-format-ext2-init-c.$(OBJEXT) \ + supermin-fnmatch-c.$(OBJEXT) supermin-glob-c.$(OBJEXT) \ + supermin-librpm-c.$(OBJEXT) supermin-realpath-c.$(OBJEXT) am_supermin_OBJECTS = $(am__objects_1) supermin_OBJECTS = $(am_supermin_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) @@ -417,6 +419,7 @@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_OPENAT = @GNULIB_OPENAT@ GNULIB_OPENDIR = @GNULIB_OPENDIR@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -433,6 +436,7 @@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_PUTS = @GNULIB_PUTS@ GNULIB_PWRITE = @GNULIB_PWRITE@ +GNULIB_QSORT_R = @GNULIB_QSORT_R@ GNULIB_RANDOM = @GNULIB_RANDOM@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ @@ -484,6 +488,7 @@ GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ GNULIB_TIME_R = @GNULIB_TIME_R@ +GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ @@ -510,6 +515,7 @@ GREP = @GREP@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ @@ -525,6 +531,7 @@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -580,6 +587,7 @@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ @@ -607,6 +615,7 @@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ @@ -649,6 +658,7 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -677,6 +687,7 @@ LIBRPM_CFLAGS = @LIBRPM_CFLAGS@ LIBRPM_LIBS = @LIBRPM_LIBS@ LIBS = @LIBS@ +LIMITS_H = @LIMITS_H@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ @@ -687,6 +698,7 @@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ @@ -700,6 +712,7 @@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ @@ -813,9 +826,11 @@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ @@ -844,6 +859,7 @@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ @@ -867,6 +883,7 @@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDALIGN_H = @STDALIGN_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ @@ -874,6 +891,7 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ URPMI = @URPMI@ @@ -891,6 +909,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -956,9 +975,6 @@ ext2fs-c.c \ ext2fs.ml \ ext2fs.mli \ - ext2init-c.c \ - ext2init.ml \ - ext2init.mli \ fnmatch-c.c \ fnmatch.ml \ fnmatch.mli \ @@ -979,22 +995,33 @@ os_release.mli \ package_handler.ml \ package_handler.mli \ - rpm.ml \ - dpkg.ml \ - pacman.ml \ - prepare.ml \ - chroot.ml \ - kernel.ml \ - ext2_initrd.ml \ - ext2.ml \ - build.ml \ + ph_rpm.ml \ + ph_rpm.mli \ + ph_dpkg.ml \ + ph_dpkg.mli \ + ph_pacman.ml \ + ph_pacman.mli \ + mode_prepare.ml \ + mode_prepare.mli \ + format_chroot.ml \ + format_chroot.mli \ + format-ext2-init-c.c \ + format_ext2_init.ml \ + format_ext2_init.mli \ + format_ext2_initrd.ml \ + format_ext2_initrd.mli \ + format_ext2_kernel.ml \ + format_ext2_kernel.mli \ + format_ext2.ml \ + format_ext2.mli \ + mode_build.ml \ + mode_build.mli \ supermin.ml # Can't use filter for this because of automake brokenness. SOURCES_ML = \ ext2fs.ml \ - ext2init.ml \ fnmatch.ml \ glob.ml \ realpath.ml \ @@ -1004,26 +1031,27 @@ types.ml \ os_release.ml \ package_handler.ml \ - rpm.ml \ - dpkg.ml \ - pacman.ml \ - prepare.ml \ - chroot.ml \ - kernel.ml \ - ext2_initrd.ml \ - ext2.ml \ - build.ml \ + ph_rpm.ml \ + ph_dpkg.ml \ + ph_pacman.ml \ + mode_prepare.ml \ + format_chroot.ml \ + format_ext2_init.ml \ + format_ext2_initrd.ml \ + format_ext2_kernel.ml \ + format_ext2.ml \ + mode_build.ml \ supermin.ml SOURCES_C = \ ext2fs-c.c \ - ext2init-c.c \ + format-ext2-init-c.c \ fnmatch-c.c \ glob-c.c \ librpm-c.c \ realpath-c.c -CLEANFILES = *~ *.cmi *.cmo *.cmx *.o supermin ext2init-bin.S +CLEANFILES = *~ *.cmi *.cmo *.cmx *.o supermin format-ext2-init-bin.S man_MANS = \ supermin.1 @@ -1042,8 +1070,8 @@ @HAVE_OCAMLOPT_TRUE@OBJECTS = $(XOBJECTS) @HAVE_OCAMLOPT_FALSE@BEST = c @HAVE_OCAMLOPT_TRUE@BEST = opt -supermin_DEPENDENCIES = $(OBJECTS) ext2init-bin.o -supermin_LDADD = ext2init-bin.o ../lib/libgnu.a +supermin_DEPENDENCIES = $(OBJECTS) format-ext2-init-bin.o +supermin_LDADD = format-ext2-init-bin.o ../lib/libgnu.a supermin_LINK = \ ./supermin-link.sh \ $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) \ @@ -1144,8 +1172,8 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/supermin-ext2fs-c.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/supermin-ext2init-c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/supermin-fnmatch-c.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/supermin-format-ext2-init-c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/supermin-glob-c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/supermin-librpm-c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/supermin-realpath-c.Po@am__quote@ @@ -1178,19 +1206,19 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -c -o supermin-ext2fs-c.obj `if test -f 'ext2fs-c.c'; then $(CYGPATH_W) 'ext2fs-c.c'; else $(CYGPATH_W) '$(srcdir)/ext2fs-c.c'; fi` -supermin-ext2init-c.o: ext2init-c.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -MT supermin-ext2init-c.o -MD -MP -MF $(DEPDIR)/supermin-ext2init-c.Tpo -c -o supermin-ext2init-c.o `test -f 'ext2init-c.c' || echo '$(srcdir)/'`ext2init-c.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/supermin-ext2init-c.Tpo $(DEPDIR)/supermin-ext2init-c.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ext2init-c.c' object='supermin-ext2init-c.o' libtool=no @AMDEPBACKSLASH@ +supermin-format-ext2-init-c.o: format-ext2-init-c.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -MT supermin-format-ext2-init-c.o -MD -MP -MF $(DEPDIR)/supermin-format-ext2-init-c.Tpo -c -o supermin-format-ext2-init-c.o `test -f 'format-ext2-init-c.c' || echo '$(srcdir)/'`format-ext2-init-c.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/supermin-format-ext2-init-c.Tpo $(DEPDIR)/supermin-format-ext2-init-c.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='format-ext2-init-c.c' object='supermin-format-ext2-init-c.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -c -o supermin-ext2init-c.o `test -f 'ext2init-c.c' || echo '$(srcdir)/'`ext2init-c.c +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -c -o supermin-format-ext2-init-c.o `test -f 'format-ext2-init-c.c' || echo '$(srcdir)/'`format-ext2-init-c.c -supermin-ext2init-c.obj: ext2init-c.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -MT supermin-ext2init-c.obj -MD -MP -MF $(DEPDIR)/supermin-ext2init-c.Tpo -c -o supermin-ext2init-c.obj `if test -f 'ext2init-c.c'; then $(CYGPATH_W) 'ext2init-c.c'; else $(CYGPATH_W) '$(srcdir)/ext2init-c.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/supermin-ext2init-c.Tpo $(DEPDIR)/supermin-ext2init-c.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ext2init-c.c' object='supermin-ext2init-c.obj' libtool=no @AMDEPBACKSLASH@ +supermin-format-ext2-init-c.obj: format-ext2-init-c.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -MT supermin-format-ext2-init-c.obj -MD -MP -MF $(DEPDIR)/supermin-format-ext2-init-c.Tpo -c -o supermin-format-ext2-init-c.obj `if test -f 'format-ext2-init-c.c'; then $(CYGPATH_W) 'format-ext2-init-c.c'; else $(CYGPATH_W) '$(srcdir)/format-ext2-init-c.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/supermin-format-ext2-init-c.Tpo $(DEPDIR)/supermin-format-ext2-init-c.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='format-ext2-init-c.c' object='supermin-format-ext2-init-c.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -c -o supermin-ext2init-c.obj `if test -f 'ext2init-c.c'; then $(CYGPATH_W) 'ext2init-c.c'; else $(CYGPATH_W) '$(srcdir)/ext2init-c.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -c -o supermin-format-ext2-init-c.obj `if test -f 'format-ext2-init-c.c'; then $(CYGPATH_W) 'format-ext2-init-c.c'; else $(CYGPATH_W) '$(srcdir)/format-ext2-init-c.c'; fi` supermin-fnmatch-c.o: fnmatch-c.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(supermin_CFLAGS) $(CFLAGS) -MT supermin-fnmatch-c.o -MD -MP -MF $(DEPDIR)/supermin-fnmatch-c.Tpo -c -o supermin-fnmatch-c.o `test -f 'fnmatch-c.c' || echo '$(srcdir)/'`fnmatch-c.c @@ -1508,10 +1536,10 @@ .ml.cmx: $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ -ext2init-bin.o: ext2init-bin.S +format-ext2-init-bin.o: format-ext2-init-bin.S $(CC) -o $@ -c $< -ext2init-bin.S: ../init/init $(srcdir)/bin2s.pl +format-ext2-init-bin.S: ../init/init $(srcdir)/bin2s.pl strip --strip-all $< ls -l $< @file $< | grep -isq static || \ diff -Nru supermin-5.1.17/src/mode_build.ml supermin-5.1.18/src/mode_build.ml --- supermin-5.1.17/src/mode_build.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/mode_build.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,453 @@ +(* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Unix +open Printf + +open Utils +open Types +open Package_handler +open Fnmatch +open Glob +open Realpath + +type appliance = { + excludefiles : string list; (* list of wildcards *) + hostfiles : string list; (* list of wildcards *) + packages : string list; (* list of package names *) + (* Note that base images don't appear here because they are unpacked + * into a build directory as we discover them. + *) +} + +let empty_appliance = { excludefiles = []; hostfiles = []; packages = [] } + +type file_type = +| GZip of file_content +| XZ of file_content +| Uncompressed of file_content +and file_content = +| Base_image (* a tarball *) +| Packages +| Hostfiles +| Excludefiles + +let rec string_of_file_type = function + | GZip c -> sprintf "gzip %s" (string_of_file_content c) + | XZ c -> sprintf "xz %s" (string_of_file_content c) + | Uncompressed c -> sprintf "uncompressed %s" (string_of_file_content c) +and string_of_file_content = function + | Base_image -> "base image (tar)" + | Packages -> "packages" + | Hostfiles -> "hostfiles" + | Excludefiles -> "excludefiles" + +let rec build debug + (copy_kernel, format, host_cpu, + packager_config, tmpdir, use_installed, size, + include_packagelist) + inputs outputdir = + if debug >= 1 then + printf "supermin: build: %s\n%!" (String.concat " " inputs); + + if inputs = [] then + error "build: no input supermin appliance specified"; + + (* When base images are seen, they are unpacked into this temporary + * directory. But to speed things up, when we are building a chroot, + * set the basedir to be the output directory, so we avoid copying + * from a temporary directory to the output directory. + *) + let basedir = + match format with + | Chroot -> + outputdir + | Ext2 -> + let basedir = tmpdir // "base.d" in + mkdir basedir 0o755; + basedir in + + (* Read the supermin appliance, ie. the input files and/or + * directories that make up the appliance. + *) + if debug >= 1 then + printf "supermin: reading the supermin appliance\n%!"; + let appliance = read_appliance debug basedir empty_appliance inputs in + + (* Resolve dependencies in the list of packages. *) + let ph = get_package_handler () in + if debug >= 1 then + printf "supermin: mapping package names to installed packages\n%!"; + let packages = filter_map ph.ph_package_of_string appliance.packages in + if debug >= 1 then + printf "supermin: resolving full list of package dependencies\n%!"; + let packages = + let packages = package_set_of_list packages in + get_all_requires packages in + + (* Get the list of packages only if we need to, i.e. when creating + * /packagelist in the appliance, when printing all the packages + * for debug, or in both cases. + *) + let pretty_packages = + if include_packagelist || debug >= 2 then ( + let pkg_names = PackageSet.elements packages in + let pkg_names = List.map ph.ph_package_to_string pkg_names in + List.sort compare pkg_names + ) else [] in + + if debug >= 1 then ( + printf "supermin: build: %d packages, including dependencies\n%!" + (PackageSet.cardinal packages); + if debug >= 2 then ( + List.iter (printf " - %s\n") pretty_packages; + flush Pervasives.stdout + ) + ); + + (* List the files in each package. We only want to copy non-config + * files to the full appliance, since config files are included in + * the base image that we saved when preparing the supermin + * appliance. + *) + let files = get_all_files packages in + let files = + List.filter (fun file -> not file.ft_config) files in + + if debug >= 1 then + printf "supermin: build: %d files\n%!" (List.length files); + + (* Remove excludefiles from the list. Notes: (1) The current + * implementation does not apply excludefiles to the base image. (2) + * The current implementation does not apply excludefiles to the + * hostfiles (see below). + *) + let files = + if appliance.excludefiles = [] then files + else ( + let fn_flags = [FNM_NOESCAPE] in + List.filter ( + fun { ft_path = path } -> + let include_ = + List.for_all ( + fun pattern -> not (fnmatch pattern path fn_flags) + ) appliance.excludefiles in + if debug >= 2 && not include_ then + printf "supermin: build: excluding %s\n%!" path; + include_ + ) files + ) in + + if debug >= 1 then + printf "supermin: build: %d files, after matching excludefiles\n%!" + (List.length files); + + (* Add hostfiles. This may contain wildcards too. *) + let files = + if appliance.hostfiles = [] then files + else ( + let hostfiles = List.map ( + fun pattern -> glob pattern [GLOB_NOESCAPE] + ) appliance.hostfiles in + let hostfiles = List.map Array.to_list hostfiles in + let hostfiles = List.flatten hostfiles in + let hostfiles = List.map ( + fun path -> {ft_path = path; ft_source_path = path; ft_config = false} + ) hostfiles in + files @ hostfiles + ) in + + if debug >= 1 then + printf "supermin: build: %d files, after adding hostfiles\n%!" + (List.length files); + + (* Remove files from the list which don't exist on the host or are + * unreadable to us. + *) + let files = + List.filter ( + fun file -> + try ignore (lstat file.ft_source_path); true + with Unix_error _ -> + try ignore (lstat file.ft_path); true + with Unix_error _ -> false + ) files in + + if debug >= 1 then + printf "supermin: build: %d files, after removing unreadable files\n%!" + (List.length files); + + (* Difficult to explain what this does. See comment below. *) + let files = munge files in + + if debug >= 1 then ( + printf "supermin: build: %d files, after munging\n%!" + (List.length files); + if debug >= 2 then ( + List.iter (fun { ft_path = path } -> printf " - %s\n" path) files; + flush Pervasives.stdout + ) + ); + + (* Create a temporary file for packagelist, if requested. *) + let packagelist_file = + if include_packagelist then ( + let filename = tmpdir // "packagelist" in + let chan = open_out filename in + List.iter (fprintf chan "%s\n") pretty_packages; + close_out chan; + Some filename + ) else None in + + (* Depending on the format, we build the appliance in different ways. *) + (match format with + | Chroot -> + (* chroot doesn't need an external kernel or initrd *) + Format_chroot.build_chroot debug files outputdir packagelist_file + + | Ext2 -> + let kernel = outputdir // "kernel" + and appliance = outputdir // "root" + and initrd = outputdir // "initrd" in + let kernel_version, modpath = + Format_ext2_kernel.build_kernel debug host_cpu copy_kernel kernel in + Format_ext2.build_ext2 debug basedir files modpath kernel_version + appliance size packagelist_file; + Format_ext2_initrd.build_initrd debug tmpdir modpath initrd + ) + +and read_appliance debug basedir appliance = function + | [] -> appliance + + | dir :: rest when Sys.is_directory dir -> + let inputs = Array.to_list (Sys.readdir dir) in + let inputs = List.sort compare inputs in + let inputs = List.map ((//) dir) inputs in + read_appliance debug basedir appliance (inputs @ rest) + + | file :: rest -> + let file_type = get_file_type file in + + if debug >= 1 then + printf "supermin: build: visiting %s type %s\n%!" + file (string_of_file_type file_type); + + (* Depending on the file type, read or unpack the file. *) + let appliance = + match file_type with + | Uncompressed ((Packages|Hostfiles|Excludefiles) as t) -> + let chan = open_in file in + let lines = input_all_lines chan in + close_in chan; + update_appliance appliance lines t + | GZip ((Packages|Hostfiles|Excludefiles) as t) -> + let cmd = sprintf "zcat %s" (quote file) in + let lines = run_command_get_lines cmd in + update_appliance appliance lines t + | XZ ((Packages|Hostfiles|Excludefiles) as t) -> + let cmd = sprintf "xzcat %s" (quote file) in + let lines = run_command_get_lines cmd in + update_appliance appliance lines t + | Uncompressed Base_image -> + let cmd = sprintf "tar -C %s -xf %s" (quote basedir) (quote file) in + run_command cmd; + appliance + | GZip Base_image -> + let cmd = + sprintf "zcat %s | tar -C %s -xf -" (quote file) (quote basedir) in + run_command cmd; + appliance + | XZ Base_image -> + let cmd = + sprintf "xzcat %s | tar -C %s -xf -" (quote file) (quote basedir) in + run_command cmd; + appliance in + + read_appliance debug basedir appliance rest + +and update_appliance appliance lines = function + | Packages -> + { appliance with packages = appliance.packages @ lines } + | Hostfiles -> + { appliance with hostfiles = appliance.hostfiles @ lines } + | Excludefiles -> + let lines = List.map ( + fun path -> + let n = String.length path in + if n < 1 || path.[0] <> '-' then + error "excludefiles line does not start with '-'"; + String.sub path 1 (n-1) + ) lines in + { appliance with excludefiles = appliance.excludefiles @ lines } + | Base_image -> assert false + +(* Determine the [file_type] of [file], or exit with an error. *) +and get_file_type file = + let chan = open_in file in + let buf = String.create 512 in + let len = input chan buf 0 (String.length buf) in + close_in chan; + + if len >= 3 && buf.[0] = '\x1f' && buf.[1] = '\x8b' && buf.[2] = '\x08' + then (* gzip-compressed file *) + GZip (get_compressed_file_content "zcat" file) + else if len >= 6 && buf.[0] = '\xfd' && buf.[1] = '7' && buf.[2] = 'z' && + buf.[3] = 'X' && buf.[4] = 'Z' && buf.[5] = '\000' + then (* xz-compressed file *) + XZ (get_compressed_file_content "xzcat" file) + else + Uncompressed (get_file_content file buf len) + +and get_file_content file buf len = + if len >= 262 && buf.[257] = 'u' && buf.[258] = 's' && + buf.[259] = 't' && buf.[260] = 'a' && buf.[261] = 'r' + then (* tar file *) + Base_image + else if len >= 6 && + buf.[0] = '0' && buf.[1] = '7' && + buf.[2] = '0' && buf.[3] = '7' && + buf.[4] = '0' && buf.[5] = '1' then ( + (* However we intend to support them in future for both input + * and output. + *) + error "%s: cpio files are not supported in this version of supermin" file; + ) + else if len >= 2 && buf.[0] = '/' then Hostfiles + else if len >= 2 && buf.[0] = '-' then Excludefiles + else if len >= 1 && isalnum buf.[0] then Packages + else error "%s: unknown file type in supermin directory" file + +and get_compressed_file_content zcat file = + let cmd = sprintf "%s %s" zcat (quote file) in + let chan_out, chan_in, chan_err = open_process_full cmd [||] in + let buf = String.create 512 in + let len = input chan_out buf 0 (String.length buf) in + (* We're expecting the subprocess to fail because we close the pipe + * early, so: + *) + ignore (Unix.close_process_full (chan_out, chan_in, chan_err)); + + get_file_content file buf len + +(* The files may not be listed in an order that allows us to run + * through the list (even if we sorted it). The particular problem is + * where you have: + * + * - /lib is a symlink to /usr/lib + * - /lib/modules exists + * - /usr/lib + * + * The problem is that /lib is created as a symlink to a directory + * that doesn't yet exist (/usr/lib), and so it fails when you + * try to create /lib/modules (ie. really /usr/lib/modules). + * + * A second problem is that intermediate directories are not + * necessarily listed. eg. "/foo/bar/baz" might appear, without the + * parent directories appearing in the list. This can happen + * because of excludefiles, or simply packaging mistakes in + * the distro. + * + * We create intermediate directories simply by examining the + * file list. Symlinks to not-yet-existing directories are + * handled by adding the target directory into the list before the + * symlink. + *) +and munge files = + let files = + List.sort (fun f1 f2 -> compare f1.ft_path f2.ft_path) files in + + let rec stat_is_dir dir = + try (stat dir).st_kind = S_DIR with Unix_error _ -> false + and is_lnk_to_dir dir = + try stat_is_dir dir && (lstat dir).st_kind = S_LNK + with Unix_error _ -> false + in + + let insert_dir, dir_seen = + let h = Hashtbl.create (List.length files) in + let insert_dir dir = Hashtbl.replace h dir true in + let dir_seen dir = Hashtbl.mem h dir in + insert_dir, dir_seen + in + + let rec loop = function + | [] -> [] + + | { ft_path = "/" } :: rest -> + (* This is just to avoid a corner-case in subsequent rules. *) + insert_dir "/"; + loop rest + + | dir :: rest when stat_is_dir dir.ft_path && dir_seen dir.ft_path -> + dir :: loop rest + + | dir :: rest when is_lnk_to_dir dir.ft_path -> + insert_dir dir.ft_path; + + (* Symlink to a directory. Insert the target directory before + * if we've not seen it yet. + *) + let target = readlink dir.ft_path in + let parent = Filename.dirname dir.ft_path in + (* Make the target an absolute path. *) + let target = + if String.length target < 1 || target.[0] <> '/' then + realpath (parent // target) + else + target in + (* Remove trailing slash from filenames (RHBZ#1155586). *) + let target = + let len = String.length target in + if len >= 2 && target.[len-1] = '/' then + String.sub target 0 (len-1) + else + target in + if not (dir_seen target) then ( + let target = + {ft_path = target; ft_source_path = target; ft_config = false} in + loop (target :: dir :: rest) + ) + else + dir :: loop rest + + | dir :: rest when stat_is_dir dir.ft_path -> + insert_dir dir.ft_path; + + (* Have we seen the parent? *) + let parent = Filename.dirname dir.ft_path in + if not (dir_seen parent) then ( + let parent = + {ft_path = parent; ft_source_path = parent; ft_config = false} in + loop (parent :: dir :: rest) + ) + else + dir :: loop rest + + | file :: rest -> + (* Have we seen this parent directory before? *) + let dir = Filename.dirname file.ft_path in + if not (dir_seen dir) then ( + let dir = {ft_path = dir; ft_source_path = dir; ft_config = false} in + loop (dir :: file :: rest) + ) + else + file :: loop rest + in + let files = loop files in + + files diff -Nru supermin-5.1.17/src/mode_build.mli supermin-5.1.18/src/mode_build.mli --- supermin-5.1.17/src/mode_build.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/mode_build.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,23 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** Implements the [--build] subcommand. *) + +val build : int -> (bool * Types.format * string * string option * string * bool * int64 option * bool) -> string list -> string -> unit +(** [build debug (args...) inputs outputdir] performs the + [supermin --build] subcommand. *) diff -Nru supermin-5.1.17/src/mode_prepare.ml supermin-5.1.18/src/mode_prepare.ml --- supermin-5.1.17/src/mode_prepare.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/mode_prepare.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,163 @@ +(* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Printf + +open Package_handler +open Utils + +let prepare debug (copy_kernel, format, host_cpu, + packager_config, tmpdir, use_installed, size, + include_packagelist) + inputs outputdir = + if debug >= 1 then + printf "supermin: prepare: %s\n%!" (String.concat " " inputs); + + if inputs = [] then + error "prepare: no input packages specified"; + + let ph = get_package_handler () in + + (* Resolve the package names supplied by the user. Since + * ph_package_of_string returns None if a package is not installed, + * filter_map will return only packages which are installed. + *) + let packages = filter_map ph.ph_package_of_string inputs in + if packages = [] then + error "prepare: none of the packages listed on the command line seem to be installed"; + + if debug >= 1 then ( + printf "supermin: packages specified on the command line:\n"; + List.iter (printf " - %s\n") (List.map ph.ph_package_to_string packages); + flush stdout + ); + + (* Convert input packages to a set. This removes duplicates. *) + let packages = package_set_of_list packages in + + (* Write input packages to the 'packages' file. We don't need to + * write the dependencies because we do dependency resolution at + * build time too. + *) + let () = + let packages = PackageSet.elements packages in + let pkg_names = List.map ph.ph_package_name packages in + let pkg_names = List.sort compare pkg_names in + + let packages_file = outputdir // "packages" in + if debug >= 1 then + printf "supermin: writing %s\n%!" packages_file; + + let chan = open_out packages_file in + List.iter (fprintf chan "%s\n") pkg_names; + close_out chan in + + (* Resolve the dependencies. *) + let packages = get_all_requires packages in + + if debug >= 1 then ( + printf "supermin: after resolving dependencies there are %d packages:\n" + (PackageSet.cardinal packages); + let pkg_names = PackageSet.elements packages in + let pkg_names = List.map ph.ph_package_to_string pkg_names in + let pkg_names = List.sort compare pkg_names in + List.iter (printf " - %s\n") pkg_names; + flush stdout + ); + + (* List the files in each package. *) + let packages = + PackageSet.fold ( + fun pkg pkgs -> + let files = get_files pkg in + (pkg, files) :: pkgs + ) packages [] in + + if debug >= 2 then ( + List.iter ( + fun (pkg, files) -> + printf "supermin: files in '%s':\n" (ph.ph_package_to_string pkg); + List.iter + (fun { ft_path = path; ft_config = config } -> + printf " - %s%s\n" path (if config then " [config]" else "")) + files + ) packages; + flush stdout + ); + + let dir = + if not use_installed then ( + (* For packages that contain any config files, we have to download + * the original package, in order to construct the base image. We + * can skip packages that have no config files. + *) + let dir = tmpdir // "prepare.d" in + Unix.mkdir dir 0o755; + + let () = + let dl_packages = filter_map ( + fun (pkg, files) -> + let has_config_files = + List.exists (fun { ft_config = config } -> config) files in + if has_config_files then Some pkg else None + ) packages in + let dl_packages = package_set_of_list dl_packages in + download_all_packages dl_packages dir in + + dir + ) + else (* --use-installed *) "/" in + + (* Get the list of config files, which are the files we will place + * into base. We have to check the files exist too, since they can + * be missing either from the package or from the filesystem (the + * latter case with --use-installed). + *) + let files_from = + let config_files = + List.map ( + fun (_, files) -> + filter_map ( + function + | { ft_config = true; ft_path = path } -> Some path + | { ft_config = false } -> None + ) files + ) packages in + let config_files = List.flatten config_files in + + let config_files = List.filter ( + fun path -> + try close_in (open_in (dir // path)); true + with Sys_error _ -> false + ) config_files in + + (* Put the list of config files into a file, for tar to read. *) + let files_from = tmpdir // "files-from.txt" in + let chan = open_out files_from in + List.iter (fprintf chan ".%s\n") config_files; (* "./filename" *) + close_out chan; + + files_from in + + (* Write base.tar.gz. *) + let base = outputdir // "base.tar.gz" in + if debug >= 1 then printf "supermin: writing %s\n%!" base; + let cmd = + sprintf "tar -C %s -zcf %s -T %s" + (quote dir) (quote base) (quote files_from) in + run_command cmd; diff -Nru supermin-5.1.17/src/mode_prepare.mli supermin-5.1.18/src/mode_prepare.mli --- supermin-5.1.17/src/mode_prepare.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/mode_prepare.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,23 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** Implements the [--prepare] subcommand. *) + +val prepare : int -> (bool * Types.format * string * string option * string * bool * int64 option * bool) -> string list -> string -> unit +(** [prepare debug (args...) inputs outputdir] performs the + [supermin --prepare] subcommand. *) diff -Nru supermin-5.1.17/src/pacman.ml supermin-5.1.18/src/pacman.ml --- supermin-5.1.17/src/pacman.ml 2016-10-23 08:45:38.000000000 +0000 +++ supermin-5.1.18/src/pacman.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,238 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -open Unix -open Printf - -open Utils -open Package_handler - -let pacman_detect () = - Config.pacman <> "no" && Config.fakeroot <> "no" && - (Os_release.get_id () = "arch" || - ((stat "/etc/arch-release").st_kind = S_REG && - Config.pacman_g2 = "no")) (* not Frugalware with pacman-g2 *) - -let settings = ref no_settings - -let pacman_init s = settings := s - -type pac_t = { - name : string; - epoch : int; - version : string; - release : int; - arch : string; -} - -(* Memo from package type to internal pac_t. *) -let pac_of_pkg, pkg_of_pac = get_memo_functions () - -(* Memo of pacman_package_of_string. *) -let pach = Hashtbl.create 13 - -let pacman_package_of_string str = - (* Parse a package name into the fields like name and version. *) - let parse_pac str = - let cmd = sprintf "%s -Qi %s" Config.pacman (quote str) in - if !settings.debug >= 2 then printf "%s" cmd; - let lines = run_command_get_lines cmd in - - let name = ref "" and evr = ref "" and arch = ref "" in - List.iter ( - fun line -> - let get_value r = - let len = String.length line in - let i = String.index line ':' in - r := String.sub line (i+2) (len-(i+2)) - in - if string_prefix "Name " line then get_value name - else if string_prefix "Version " line then get_value evr - else if string_prefix "Architecture " line then get_value arch - ) lines; - - let name = !name and evr = !evr and arch = !arch in - if name = "" || evr = "" || arch = "" then - error "pacman: Name/Version/Architecture field missing in output of %s" cmd; - - (* Parse epoch:version-release field. *) - let epoch, version, release = - try - let epoch, vr = - try - let i = String.index evr ':' in - int_of_string (String.sub evr 0 i), - String.sub evr (i+1) (String.length evr - (i+1)) - with Not_found -> 0, evr in - let version, release = - match string_split "-" vr with - | [ v; r ] -> v, int_of_string r - | _ -> assert false in - epoch, version, release - with - Failure "int_of_string" -> - failwith ("failed to parse epoch:version-release field " ^ evr) in - - { name = name; - epoch = epoch; - version = version; - release = release; - arch = arch } - - (* Check if a package is installed. *) - and check_pac_installed name = - let cmd = sprintf "%s -Qq %s >/dev/null 2>&1" Config.pacman (quote name) in - if !settings.debug >= 2 then printf "%s" cmd; - 0 = Sys.command cmd - in - - try - Hashtbl.find pach str - with - Not_found -> - let r = - if check_pac_installed str then ( - let pac = parse_pac str in - Some (pkg_of_pac pac) - ) - else None in - Hashtbl.add pach str r; - r - -let pacman_package_to_string pkg = - let pac = pac_of_pkg pkg in - if pac.epoch = 0 then - sprintf "%s-%s-%d.%s" pac.name pac.version pac.release pac.arch - else - sprintf "%s-%d:%s-%d.%s" - pac.name pac.epoch pac.version pac.release pac.arch - -let pacman_package_name pkg = - let pac = pac_of_pkg pkg in - pac.name - -let pacman_get_package_database_mtime () = - (lstat "/var/lib/pacman/sync/core.db" (* XXX? *) ).st_mtime - -let pacman_get_all_requires pkgs = - let cmd = sprintf "\ - for p in %s; do %s -u $p; done | awk '{print $1}' | sort -u - " (quoted_list (List.map pacman_package_name (PackageSet.elements pkgs))) - Config.pactree in - if !settings.debug >= 2 then printf "%s" cmd; - let lines = run_command_get_lines cmd in - let lines = filter_map pacman_package_of_string lines in - PackageSet.union pkgs (package_set_of_list lines) - -let pacman_get_all_files pkgs = - let cmd = - sprintf "%s -Ql %s | awk '{print $2}'" - Config.pacman - (quoted_list (List.map pacman_package_name (PackageSet.elements pkgs))) in - if !settings.debug >= 2 then printf "%s" cmd; - let lines = run_command_get_lines cmd in - List.map ( - fun path -> - (* Remove trailing / from directory names. *) - let path = - let len = String.length path in - if len >= 2 && path.[len-1] = '/' then - String.sub path 0 (len-1) - else - path in - let config = - try string_prefix "/etc/" path && (lstat path).st_kind = S_REG - with Unix_error _ -> false in - { ft_path = path; ft_source_path = path; ft_config = config } - ) lines - -let pacman_download_all_packages pkgs dir = - let tdir = !settings.tmpdir // string_random8 () in - mkdir tdir 0o755; - - let names = List.map pacman_package_name (PackageSet.elements pkgs) in - - (* Because we reuse the same temporary download directory (tdir), this - * only downloads each package once, even though each call to pacman will - * download dependent packages as well. - *) - List.iter ( - fun name -> - let cmd = sprintf "\ - set -e - umask 0000 - cd %s - mkdir -p var/lib/pacman - %s %s%s -Syw --noconfirm --cachedir=$(pwd) --root=$(pwd) %s - " - (quote tdir) - Config.fakeroot Config.pacman - (match !settings.packager_config with - | None -> "" - | Some filename -> " --config " ^ (quote filename)) - (quoted_list names) in - if !settings.debug >= 2 then printf "%s" cmd; - if Sys.command cmd <> 0 then ( - (* The package may not be in the main repos, check the AUR. *) - let cmd = sprintf "\ - set -e - umask 0000 - cd %s - wget %s - tar xf %s - cd %s - %s - mv %s-*.pkg.tar.xz %s - " - (quote tdir) - (quote ("https://aur.archlinux.org/packages/" ^ - (String.sub name 0 2) ^ - "/" ^ name ^ "/" ^ name ^ ".tar.gz")) - (quote (name ^ ".tar.gz")) - (quote name) (* cd *) - Config.makepkg - (quote name) (quote tdir) (* mv *) in - if !settings.debug >= 2 then printf "%s" cmd; - run_command cmd - ); - ) names; - - (* Unpack the downloaded packages. *) - let cmd = - sprintf " - umask 0000 - for f in %s/*.pkg.tar.xz; do tar -xf \"$f\" -C %s; done - " - (quote tdir) (quote dir) in - if !settings.debug >= 2 then printf "%s" cmd; - run_command cmd - -let () = - let ph = { - ph_detect = pacman_detect; - ph_init = pacman_init; - ph_fini = (fun () -> ()); - ph_package_of_string = pacman_package_of_string; - ph_package_to_string = pacman_package_to_string; - ph_package_name = pacman_package_name; - ph_get_package_database_mtime = pacman_get_package_database_mtime; - ph_get_requires = PHGetAllRequires pacman_get_all_requires; - ph_get_files = PHGetAllFiles pacman_get_all_files; - ph_download_package = PHDownloadAllPackages pacman_download_all_packages; - } in - register_package_handler "arch" "pacman" ph diff -Nru supermin-5.1.17/src/ph_dpkg.ml supermin-5.1.18/src/ph_dpkg.ml --- supermin-5.1.17/src/ph_dpkg.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/ph_dpkg.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,202 @@ +(* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Unix +open Printf + +open Utils +open Package_handler + +let dpkg_detect () = + Config.dpkg <> "no" && + Config.dpkg_deb <> "no" && + Config.dpkg_query <> "no" && + Config.dpkg_divert <> "no" && + Config.apt_get <> "no" && + (List.mem (Os_release.get_id ()) [ "debian"; "ubuntu" ] || + try (stat "/etc/debian_version").st_kind = S_REG with Unix_error _ -> false) + +let dpkg_primary_arch = ref "" +let settings = ref no_settings + +let dpkg_init s = + settings := s; + + let cmd = sprintf "%s --print-architecture" Config.dpkg in + let lines = run_command_get_lines cmd in + match lines with + | [] -> error "dpkg: expecting %s to return some output" cmd + | arch :: _ -> dpkg_primary_arch := arch + +type dpkg_t = { + name : string; + version : string; + arch : string; +} + +(* Memo from package type to internal dpkg_t. *) +let dpkg_of_pkg, pkg_of_dpkg = get_memo_functions () + +let dpkg_packages = Hashtbl.create 13 +let dpkg_package_of_string str = + if Hashtbl.length dpkg_packages == 0 then ( + let cmd = + sprintf "%s --show --showformat='${Package} ${Version} ${Architecture} ${Status}\\n'" + Config.dpkg_query in + let lines = run_command_get_lines cmd in + List.iter ( + fun line -> + match string_split " " line with + | [ name; version; arch; _; _; "installed" ] -> + let dpkg = { name = name; version = version; arch = arch } in + Hashtbl.add dpkg_packages name dpkg + | _ -> (); + ) lines + ); + let candidates = Hashtbl.find_all dpkg_packages str in + (* On multiarch setups, only consider the primary architecture *) + try + let pkg = List.find ( + fun cand -> + cand.arch = !dpkg_primary_arch || cand.arch = "all" + ) candidates in + Some (pkg_of_dpkg pkg) + with + Not_found -> None + +let dpkg_package_to_string pkg = + let dpkg = dpkg_of_pkg pkg in + sprintf "%s_%s_%s" dpkg.name dpkg.version dpkg.arch + +let dpkg_package_name pkg = + let dpkg = dpkg_of_pkg pkg in + dpkg.name + +let dpkg_package_name_arch pkg = + let dpkg = dpkg_of_pkg pkg in + sprintf "%s:%s" dpkg.name dpkg.arch + +let dpkg_get_package_database_mtime () = + (lstat "/var/lib/dpkg/status").st_mtime + +let dpkg_get_all_requires pkgs = + let dpkg_requires = Hashtbl.create 13 in + (* Prepare dpkg_requires hashtbl with depends, pre-depends from all + packages. Strip version information and discard alternative + dependencies *) + let cmd = sprintf "\ + %s --show --showformat='${Package} ${Depends} ${Pre-Depends}\n' | \ + sed -e 's/ *([^)]*) */ /g' \ + -e 's/ *, */ /g' \ + -e 's/ *| *[^ ]* */ /g'" + Config.dpkg_query in + let lines = run_command_get_lines cmd in + List.iter ( + fun line -> + match string_split " " line with + | [] -> () + | pkgname :: [] -> () + | pkgname :: deps -> Hashtbl.add dpkg_requires pkgname deps + ) lines; + + let get pkgs = + let pkgnames = List.map dpkg_package_name (PackageSet.elements pkgs) in + let deps = List.map (Hashtbl.find_all dpkg_requires) pkgnames in + let deps = List.flatten (List.flatten deps) in + let deps = filter_map dpkg_package_of_string deps in + PackageSet.union pkgs (package_set_of_list deps) + in + (* The command above only gets one level of dependencies. We need + * to keep iterating until we reach a fixpoint. + *) + let rec loop pkgs = + let pkgs' = get pkgs in + if PackageSet.equal pkgs pkgs' then pkgs + else loop pkgs' + in + loop pkgs + +let dpkg_diversions = Hashtbl.create 13 +let dpkg_get_all_files pkgs = + if Hashtbl.length dpkg_diversions = 0 then ( + let cmd = sprintf "%s --list" Config.dpkg_divert in + let lines = run_command_get_lines cmd in + List.iter ( + fun line -> + let items = string_split " " line in + match items with + | ["diversion"; "of"; path; "to"; real_path; "by"; pkg] -> + Hashtbl.add dpkg_diversions path real_path + | _ -> () + ) lines + ); + let cmd = + sprintf "%s --listfiles %s | grep '^/' | grep -v '^/.$' | sort -u" + Config.dpkg_query + (quoted_list (List.map dpkg_package_name_arch + (PackageSet.elements pkgs))) in + let lines = run_command_get_lines cmd in + List.map ( + fun path -> + let config = + try string_prefix "/etc/" path && (lstat path).st_kind = S_REG + with Unix_error _ -> false in + let source_path = + try Hashtbl.find dpkg_diversions path + with Not_found -> path in + { ft_path = path; ft_source_path = source_path; ft_config = config } + ) lines + +let dpkg_download_all_packages pkgs dir = + let tdir = !settings.tmpdir // string_random8 () in + mkdir tdir 0o755; + + let dpkgs = List.map dpkg_package_name (PackageSet.elements pkgs) in + + let cmd = + sprintf "cd %s && %s %s download %s" + (quote tdir) + Config.apt_get + (if !settings.debug >= 1 then "" else " --quiet --quiet") + (quoted_list dpkgs) in + run_command cmd; + + (* Unpack each downloaded package. *) + let cmd = + sprintf " +umask 0000 +for f in %s/*.deb; do + %s --fsys-tarfile \"$f\" | (cd %s && tar xf -) +done" + (quote tdir) Config.dpkg_deb (quote dir) in + run_command cmd + +let () = + let ph = { + ph_detect = dpkg_detect; + ph_init = dpkg_init; + ph_fini = (fun () -> ()); + ph_package_of_string = dpkg_package_of_string; + ph_package_to_string = dpkg_package_to_string; + ph_package_name = dpkg_package_name; + ph_get_package_database_mtime = dpkg_get_package_database_mtime; + ph_get_requires = PHGetAllRequires dpkg_get_all_requires; + ph_get_files = PHGetAllFiles dpkg_get_all_files; + ph_download_package = PHDownloadAllPackages dpkg_download_all_packages; + } in + register_package_handler "debian" "dpkg" ph diff -Nru supermin-5.1.17/src/ph_dpkg.mli supermin-5.1.18/src/ph_dpkg.mli --- supermin-5.1.17/src/ph_dpkg.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/ph_dpkg.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,22 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** dpkg package handler + + Nothing is exported. This module registers callbacks when it + is loaded. *) diff -Nru supermin-5.1.17/src/ph_pacman.ml supermin-5.1.18/src/ph_pacman.ml --- supermin-5.1.17/src/ph_pacman.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/ph_pacman.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,238 @@ +(* supermin 5 + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Unix +open Printf + +open Utils +open Package_handler + +let pacman_detect () = + Config.pacman <> "no" && Config.fakeroot <> "no" && + (Os_release.get_id () = "arch" || + ((stat "/etc/arch-release").st_kind = S_REG && + Config.pacman_g2 = "no")) (* not Frugalware with pacman-g2 *) + +let settings = ref no_settings + +let pacman_init s = settings := s + +type pac_t = { + name : string; + epoch : int; + version : string; + release : int; + arch : string; +} + +(* Memo from package type to internal pac_t. *) +let pac_of_pkg, pkg_of_pac = get_memo_functions () + +(* Memo of pacman_package_of_string. *) +let pach = Hashtbl.create 13 + +let pacman_package_of_string str = + (* Parse a package name into the fields like name and version. *) + let parse_pac str = + let cmd = sprintf "%s -Qi %s" Config.pacman (quote str) in + if !settings.debug >= 2 then printf "%s" cmd; + let lines = run_command_get_lines cmd in + + let name = ref "" and evr = ref "" and arch = ref "" in + List.iter ( + fun line -> + let get_value r = + let len = String.length line in + let i = String.index line ':' in + r := String.sub line (i+2) (len-(i+2)) + in + if string_prefix "Name " line then get_value name + else if string_prefix "Version " line then get_value evr + else if string_prefix "Architecture " line then get_value arch + ) lines; + + let name = !name and evr = !evr and arch = !arch in + if name = "" || evr = "" || arch = "" then + error "pacman: Name/Version/Architecture field missing in output of %s" cmd; + + (* Parse epoch:version-release field. *) + let epoch, version, release = + try + let epoch, vr = + try + let i = String.index evr ':' in + int_of_string (String.sub evr 0 i), + String.sub evr (i+1) (String.length evr - (i+1)) + with Not_found -> 0, evr in + let version, release = + match string_split "-" vr with + | [ v; r ] -> v, int_of_string r + | _ -> assert false in + epoch, version, release + with + Failure "int_of_string" -> + failwith ("failed to parse epoch:version-release field " ^ evr) in + + { name = name; + epoch = epoch; + version = version; + release = release; + arch = arch } + + (* Check if a package is installed. *) + and check_pac_installed name = + let cmd = sprintf "%s -Qq %s >/dev/null 2>&1" Config.pacman (quote name) in + if !settings.debug >= 2 then printf "%s" cmd; + 0 = Sys.command cmd + in + + try + Hashtbl.find pach str + with + Not_found -> + let r = + if check_pac_installed str then ( + let pac = parse_pac str in + Some (pkg_of_pac pac) + ) + else None in + Hashtbl.add pach str r; + r + +let pacman_package_to_string pkg = + let pac = pac_of_pkg pkg in + if pac.epoch = 0 then + sprintf "%s-%s-%d.%s" pac.name pac.version pac.release pac.arch + else + sprintf "%s-%d:%s-%d.%s" + pac.name pac.epoch pac.version pac.release pac.arch + +let pacman_package_name pkg = + let pac = pac_of_pkg pkg in + pac.name + +let pacman_get_package_database_mtime () = + (lstat "/var/lib/pacman/sync/core.db" (* XXX? *) ).st_mtime + +let pacman_get_all_requires pkgs = + let cmd = sprintf "\ + for p in %s; do %s -u $p; done | awk '{print $1}' | sort -u + " (quoted_list (List.map pacman_package_name (PackageSet.elements pkgs))) + Config.pactree in + if !settings.debug >= 2 then printf "%s" cmd; + let lines = run_command_get_lines cmd in + let lines = filter_map pacman_package_of_string lines in + PackageSet.union pkgs (package_set_of_list lines) + +let pacman_get_all_files pkgs = + let cmd = + sprintf "%s -Ql %s | awk '{print $2}'" + Config.pacman + (quoted_list (List.map pacman_package_name (PackageSet.elements pkgs))) in + if !settings.debug >= 2 then printf "%s" cmd; + let lines = run_command_get_lines cmd in + List.map ( + fun path -> + (* Remove trailing / from directory names. *) + let path = + let len = String.length path in + if len >= 2 && path.[len-1] = '/' then + String.sub path 0 (len-1) + else + path in + let config = + try string_prefix "/etc/" path && (lstat path).st_kind = S_REG + with Unix_error _ -> false in + { ft_path = path; ft_source_path = path; ft_config = config } + ) lines + +let pacman_download_all_packages pkgs dir = + let tdir = !settings.tmpdir // string_random8 () in + mkdir tdir 0o755; + + let names = List.map pacman_package_name (PackageSet.elements pkgs) in + + (* Because we reuse the same temporary download directory (tdir), this + * only downloads each package once, even though each call to pacman will + * download dependent packages as well. + *) + List.iter ( + fun name -> + let cmd = sprintf "\ + set -e + umask 0000 + cd %s + mkdir -p var/lib/pacman + %s %s%s -Syw --noconfirm --cachedir=$(pwd) --root=$(pwd) %s + " + (quote tdir) + Config.fakeroot Config.pacman + (match !settings.packager_config with + | None -> "" + | Some filename -> " --config " ^ (quote filename)) + (quoted_list names) in + if !settings.debug >= 2 then printf "%s" cmd; + if Sys.command cmd <> 0 then ( + (* The package may not be in the main repos, check the AUR. *) + let cmd = sprintf "\ + set -e + umask 0000 + cd %s + wget %s + tar xf %s + cd %s + %s + mv %s-*.pkg.tar.xz %s + " + (quote tdir) + (quote ("https://aur.archlinux.org/packages/" ^ + (String.sub name 0 2) ^ + "/" ^ name ^ "/" ^ name ^ ".tar.gz")) + (quote (name ^ ".tar.gz")) + (quote name) (* cd *) + Config.makepkg + (quote name) (quote tdir) (* mv *) in + if !settings.debug >= 2 then printf "%s" cmd; + run_command cmd + ); + ) names; + + (* Unpack the downloaded packages. *) + let cmd = + sprintf " + umask 0000 + for f in %s/*.pkg.tar.xz; do tar -xf \"$f\" -C %s; done + " + (quote tdir) (quote dir) in + if !settings.debug >= 2 then printf "%s" cmd; + run_command cmd + +let () = + let ph = { + ph_detect = pacman_detect; + ph_init = pacman_init; + ph_fini = (fun () -> ()); + ph_package_of_string = pacman_package_of_string; + ph_package_to_string = pacman_package_to_string; + ph_package_name = pacman_package_name; + ph_get_package_database_mtime = pacman_get_package_database_mtime; + ph_get_requires = PHGetAllRequires pacman_get_all_requires; + ph_get_files = PHGetAllFiles pacman_get_all_files; + ph_download_package = PHDownloadAllPackages pacman_download_all_packages; + } in + register_package_handler "arch" "pacman" ph diff -Nru supermin-5.1.17/src/ph_pacman.mli supermin-5.1.18/src/ph_pacman.mli --- supermin-5.1.17/src/ph_pacman.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/ph_pacman.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,22 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** pacman package handler. + + Nothing is exported. This module registers callbacks when it + is loaded. *) diff -Nru supermin-5.1.17/src/ph_rpm.ml supermin-5.1.18/src/ph_rpm.ml --- supermin-5.1.17/src/ph_rpm.ml 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/ph_rpm.ml 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,486 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +open Unix +open Printf + +open Utils +open Package_handler +open Librpm + +module StringSet = Set.Make (String) + +let stringset_of_list pkgs = + List.fold_left (fun set elem -> StringSet.add elem set) StringSet.empty pkgs + +let fedora_detect () = + Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && + (Config.yumdownloader <> "no" || Config.dnf <> "no") && + (List.mem (Os_release.get_id ()) [ "fedora"; "rhel"; "centos" ] || + try + (stat "/etc/redhat-release").st_kind = S_REG || + (stat "/etc/fedora-release").st_kind = S_REG + with Unix_error _ -> false) + +let opensuse_detect () = + Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && + Config.zypper <> "no" && + (List.mem (Os_release.get_id ()) [ "opensuse"; "sled"; "sles" ] || + try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ -> false) + +let mageia_detect () = + Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && + ((Config.urpmi <> "no" && Config.fakeroot <> "no") || Config.dnf <> "no") && + (Os_release.get_id () = "mageia" || + try (stat "/etc/mageia-release").st_kind = S_REG with Unix_error _ -> false) + +let ibm_powerkvm_detect () = + Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && + Config.yumdownloader <> "no" && + try + (stat "/etc/ibm_powerkvm-release").st_kind = S_REG + with Unix_error _ -> false + +let settings = ref no_settings +let rpm_major, rpm_minor = ref 0, ref 0 +let zypper_major, zypper_minor, zypper_patch = ref 0, ref 0, ref 0 +let t = ref None + +let get_rpm () = + match !t with + | None -> error "rpm: get_rpm called too early" + | Some t -> t + +let rec rpm_init s = + settings := s; + + (* Get RPM version. We have to adjust some RPM commands based on + * the version. + *) + let version = rpm_version () in + let major, minor = + match string_split "." version with + | [] -> error "unable to parse empty rpm version string" + | [x] -> error "unable to parse rpm version string: %s" x + | major :: minor :: _ -> + try int_of_string major, int_of_string minor + with Failure "int_of_string" -> + error "unable to parse rpm version string: non-numeric, %s" version in + rpm_major := major; + rpm_minor := minor; + if !settings.debug >= 1 then + printf "supermin: rpm: detected RPM version %d.%d\n" major minor; + + t := Some (rpm_open ~debug:!settings.debug) + +and opensuse_init s = + rpm_init s; + + (* Get zypper version. We can use better zypper commands with more + * recent versions. + *) + let cmd = sprintf "%s --version | awk '{print $2}'" Config.zypper in + let lines = run_command_get_lines cmd in + let major, minor, patch = + match lines with + | [] -> error "zypper --version command had no output" + | line :: _ -> + let line = string_split "." line in + match line with + | [] -> error "unable to parse empty output of zypper --version" + | [x] -> error "unable to parse output of zypper --version: %s" x + | major :: minor :: [] -> + (try int_of_string major, int_of_string minor, 0 + with Failure "int_of_string" -> + error "unable to parse output of zypper --version: non-numeric") + | major :: minor :: patch :: _ -> + (try int_of_string major, int_of_string minor, int_of_string patch + with Failure "int_of_string" -> + error "unable to parse output of zypper --version: non-numeric") in + zypper_major := major; + zypper_minor := minor; + zypper_patch := patch; + if !settings.debug >= 1 then + printf "supermin: rpm: detected zypper version %d.%d.%d\n" major minor patch + +let rpm_fini () = + match !t with + | None -> () + | Some t -> rpm_close t + +(* Memo from package type to internal rpm_t. *) +let rpm_of_pkg, pkg_of_rpm = get_memo_functions () + +(* Memo of rpm_package_of_string. *) +let rpmh = Hashtbl.create 13 + +let rpm_package_of_string str = + let query rpm = + let rpms = Array.to_list (rpm_installed (get_rpm ()) rpm) in + (* RPM will return multiple hits when either multiple versions or + * multiple arches are installed at the same time. We are only + * interested in the highest version with the best + * architecture. + *) + let cmp { version = v1; arch = a1 } { version = v2; arch = a2 } = + let i = rpm_vercmp v2 v1 in + if i <> 0 then i + else compare_architecture a2 a1 + in + let rpms = List.sort cmp rpms in + List.hd rpms + in + + try + Hashtbl.find rpmh str + with + Not_found -> + let r = + try Some (pkg_of_rpm (query str)) + with Not_found -> + try + let p = rpm_pkg_whatprovides (get_rpm ()) str in + (* Pick only a provided package when there is just one of them, + * otherwise there is no reliable way to know which one to pick + * if there are multiple providers. + *) + if Array.length p = 1 then + Some (pkg_of_rpm (query p.(0))) + else + None + with Not_found -> None in + Hashtbl.add rpmh str r; + r + +let rpm_package_to_string pkg = + (* In RPM < 4.11 query commands that use the epoch number in the + * package name did not work. + * + * For example: + * RHEL 6 (rpm 4.8.0): + * $ rpm -q tar-2:1.23-11.el6.x86_64 + * package tar-2:1.23-11.el6.x86_64 is not installed + * Fedora 20 (rpm 4.11.2): + * $ rpm -q tar-2:1.26-30.fc20.x86_64 + * tar-1.26-30.fc20.x86_64 + * + *) + let is_rpm_lt_4_11 = + !rpm_major < 4 || (!rpm_major = 4 && !rpm_minor < 11) in + + let rpm = rpm_of_pkg pkg in + if is_rpm_lt_4_11 || rpm.epoch = 0 then + sprintf "%s-%s-%s.%s" rpm.name rpm.version rpm.release rpm.arch + else + sprintf "%s-%d:%s-%s.%s" + rpm.name rpm.epoch rpm.version rpm.release rpm.arch + +let rpm_package_name pkg = + let rpm = rpm_of_pkg pkg in + rpm.name + +let rpm_get_package_database_mtime () = + (lstat "/var/lib/rpm/Packages").st_mtime + +(* Return the best provider of a particular RPM requirement. + * + * There may be multiple, or no providers. In case there are multiple, + * choose the one with the shortest name (as yum used to). + * + * We could do better here: http://yum.baseurl.org/wiki/CompareProviders + *) +let provider = + (* Memo of resolved provides. *) + let rpm_providers = Hashtbl.create 13 in + fun req -> + try Hashtbl.find rpm_providers req + with Not_found -> + let ret = + try + (* 'providers' here is an array of just package names. *) + let providers = rpm_pkg_whatprovides (get_rpm ()) req in + let providers = Array.to_list providers in + (* --whatprovides will return duplicate identical packages, so: *) + let providers = sort_uniq providers in + (* Only packages which are actually installed: *) + let providers = + List.filter (fun name -> rpm_package_of_string name <> None) + providers in + + match providers with + | [] -> None + | [name] -> + Some name + | names -> + if !settings.debug >= 2 then + printf "supermin: rpm: multiple providers: requirement %s: providers: %s\n" + req (String.concat " " names); + let cmp name1 name2 = + let len1 = String.length name1 and len2 = String.length name2 in + if len1 <> len2 then compare len1 len2 + else compare name1 name2 in + let names = List.sort cmp names in + let best_name = List.hd names in + if !settings.debug >= 2 then + printf "supermin: rpm: multiple providers: picked %s\n" best_name; + Some best_name + with Not_found -> None in + Hashtbl.add rpm_providers req ret; + ret + +let rpm_get_all_requires pkgs = + let get pkg = + let reqs = + try + rpm_pkg_requires (get_rpm ()) pkg + with + Multiple_matches _ as ex -> + match rpm_package_of_string pkg with + | None -> raise ex + | Some pkg -> + rpm_pkg_requires (get_rpm ()) (rpm_package_to_string pkg) in + let pkgs' = Array.fold_left ( + fun set x -> + match provider x with + | None -> set + | Some p -> StringSet.add p set + ) StringSet.empty reqs in + pkgs' + in + let queue = Queue.create () in + let final = ref (stringset_of_list + (List.map rpm_package_name + (PackageSet.elements pkgs))) in + StringSet.iter (fun x -> Queue.push x queue) !final; + let resolved = ref StringSet.empty in + while not (Queue.is_empty queue) do + let current = Queue.pop queue in + if not (StringSet.mem current !resolved) then ( + try + let expanded = get current in + let diff = StringSet.diff expanded !final in + if not (StringSet.is_empty diff) then ( + final := StringSet.union !final diff; + StringSet.iter (fun x -> Queue.push x queue) diff; + ) + with Not_found -> (); + resolved := StringSet.add current !resolved + ) + done; + let pkgs' = filter_map rpm_package_of_string (StringSet.elements !final) in + package_set_of_list pkgs' + +let rpm_get_all_files pkgs = + let files_compare { filepath = a } { filepath = b } = + compare a b in + let files = List.map rpm_package_to_string (PackageSet.elements pkgs) in + let files = List.fold_right ( + fun pkg xs -> + let files = Array.to_list (rpm_pkg_filelist (get_rpm ()) pkg) in + files @ xs + ) files [] in + let files = sort_uniq ~cmp:files_compare files in + List.map ( + fun { filepath = path; filetype = flags } -> + let config = flags = FileConfig in + { ft_path = path; ft_source_path = path; ft_config = config } + ) files + +let rec fedora_download_all_packages pkgs dir = + let tdir = !settings.tmpdir // string_random8 () in + + if Config.dnf <> "no" then + download_all_packages_with_dnf pkgs dir tdir + else (* Config.yumdownloader <> "no" *) + fedora_download_all_packages_with_yum pkgs dir tdir; + + rpm_unpack tdir dir + +and fedora_download_all_packages_with_yum pkgs dir tdir = + (* It's quite complex to get yumdownloader to download specific + * RPMs. If we use the full NVR, then it will refuse if an installed + * RPM is older than whatever is currently in the repo. If we use + * just name, it will download all architectures (even with + * --archlist). + * + * Use name.arch so it can download any version but only the specific + * architecture. + *) + let rpms = pkgs_as_NA_rpms pkgs in + + let cmd = + sprintf "%s%s%s --destdir %s %s" + Config.yumdownloader + (if !settings.debug >= 1 then "" else " --quiet") + (match !settings.packager_config with + | None -> "" + | Some filename -> sprintf " -c %s" (quote filename)) + (quote tdir) + (quoted_list rpms) in + run_command cmd + +and opensuse_download_all_packages pkgs dir = + let tdir = !settings.tmpdir // string_random8 () in + + let rpms = pkgs_as_NA_rpms pkgs in + + let is_zypper_1_9_14 = + !zypper_major > 1 + || (!zypper_major = 1 && !zypper_minor > 9) + || (!zypper_major = 1 && !zypper_minor = 9 && !zypper_patch >= 14) in + + let cmd = + if is_zypper_1_9_14 then + sprintf " + %s%s \\ + --reposd-dir /etc/zypp/repos.d \\ + --cache-dir %s \\ + --pkg-cache-dir %s \\ + --gpg-auto-import-keys --no-gpg-checks --non-interactive \\ + download \\ + %s" + Config.zypper + (if !settings.debug >= 1 then " --verbose --verbose" else " --quiet") + (quote tdir) + (quote tdir) + (quoted_list rpms) + else + (* This isn't quite right because zypper will resolve the dependencies + * of the listed packages against the public repos and download all the + * dependencies too. We only really want it to download the named + * packages. XXX + *) + sprintf " + %s%s \\ + --root %s \\ + --reposd-dir /etc/zypp/repos.d \\ + --cache-dir %s \\ + --pkg-cache-dir %s \\ + --gpg-auto-import-keys --no-gpg-checks --non-interactive \\ + install \\ + --auto-agree-with-licenses --download-only --no-recommends \\ + %s" + Config.zypper + (if !settings.debug >= 1 then " --verbose --verbose" else " --quiet") + (quote tdir) + (quote tdir) + (quote tdir) + (quoted_list rpms) in + run_command cmd; + + rpm_unpack tdir dir + +and mageia_download_all_packages pkgs dir = + let tdir = !settings.tmpdir // string_random8 () in + + if Config.dnf <> "no" then + download_all_packages_with_dnf pkgs dir tdir + else (* Config.urpmi <> "no" && Config.fakeroot <> "no" *) + mageia_download_all_packages_with_urpmi pkgs dir tdir; + + rpm_unpack tdir dir + +and mageia_download_all_packages_with_urpmi pkgs dir tdir = + let rpms = List.map rpm_package_name (PackageSet.elements pkgs) in + + let cmd = + sprintf " + %s %s%s \\ + --download-all %s \\ + --replacepkgs \\ + --no-install \\ + %s" + Config.fakeroot + Config.urpmi + (if !settings.debug >= 1 then " --verbose" else " --quiet") + (quote tdir) + (quoted_list rpms) in + run_command cmd + +and download_all_packages_with_dnf pkgs dir tdir = + (* Old dnf didn't create the destdir directory, newer versions do. *) + mkdir tdir 0o700; + + let rpms = pkgs_as_NA_rpms pkgs in + + let cmd = + sprintf "%s download%s%s --destdir=%s --disableexcludes=all %s" + Config.dnf + (if !settings.debug >= 1 then " -v" else " -q") + (match !settings.packager_config with + | None -> "" + | Some filename -> sprintf " -c %s" (quote filename)) + (quote tdir) + (quoted_list rpms) in + run_command cmd + +and pkgs_as_NA_rpms pkgs = + let rpms = List.map rpm_of_pkg (PackageSet.elements pkgs) in + List.map ( + fun { name = name; arch = arch } -> + sprintf "%s.%s" name arch + ) rpms + +and rpm_unpack tdir dir = + (* Unpack each downloaded package. + * + * yumdownloader can't necessarily download the specific file that we + * requested, we might get a different (eg later) version. + *) + let cmd = + sprintf " +umask 0000 +for f in `find %s -name '*.rpm'`; do + %s \"$f\" | (cd %s && %s --quiet -id) +done" + (quote tdir) Config.rpm2cpio (quote dir) Config.cpio in + run_command cmd + +(* We register package handlers for each RPM distro variant. *) +let () = + let fedora = { + ph_detect = fedora_detect; + ph_init = rpm_init; + ph_fini = rpm_fini; + ph_package_of_string = rpm_package_of_string; + ph_package_to_string = rpm_package_to_string; + ph_package_name = rpm_package_name; + ph_get_package_database_mtime = rpm_get_package_database_mtime; + ph_get_requires = PHGetAllRequires rpm_get_all_requires; + ph_get_files = PHGetAllFiles rpm_get_all_files; + ph_download_package = PHDownloadAllPackages fedora_download_all_packages; + } in + register_package_handler "fedora" "rpm" fedora; + let ibm_powerkvm = { + fedora with + ph_detect = ibm_powerkvm_detect; + } in + register_package_handler "ibm_powerkvm" "rpm" ibm_powerkvm; + let opensuse = { + fedora with + ph_detect = opensuse_detect; + ph_init = opensuse_init; + ph_download_package = PHDownloadAllPackages opensuse_download_all_packages; + } in + register_package_handler "opensuse" "rpm" opensuse; + let mageia = { + fedora with + ph_detect = mageia_detect; + ph_download_package = PHDownloadAllPackages mageia_download_all_packages; + } in + register_package_handler "mageia" "rpm" mageia diff -Nru supermin-5.1.17/src/ph_rpm.mli supermin-5.1.18/src/ph_rpm.mli --- supermin-5.1.17/src/ph_rpm.mli 1970-01-01 00:00:00.000000000 +0000 +++ supermin-5.1.18/src/ph_rpm.mli 2017-03-01 11:34:37.000000000 +0000 @@ -0,0 +1,22 @@ +(* supermin 5 + * Copyright (C) 2009-2016 Red Hat Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *) + +(** RPM package handler + + Nothing is exported. This module registers callbacks when it + is loaded. *) diff -Nru supermin-5.1.17/src/prepare.ml supermin-5.1.18/src/prepare.ml --- supermin-5.1.17/src/prepare.ml 2016-03-18 13:15:15.000000000 +0000 +++ supermin-5.1.18/src/prepare.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,163 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2014 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -open Printf - -open Package_handler -open Utils - -let prepare debug (copy_kernel, dtb_wildcard, format, host_cpu, - packager_config, tmpdir, use_installed, size, - include_packagelist) - inputs outputdir = - if debug >= 1 then - printf "supermin: prepare: %s\n%!" (String.concat " " inputs); - - if inputs = [] then - error "prepare: no input packages specified"; - - let ph = get_package_handler () in - - (* Resolve the package names supplied by the user. Since - * ph_package_of_string returns None if a package is not installed, - * filter_map will return only packages which are installed. - *) - let packages = filter_map ph.ph_package_of_string inputs in - if packages = [] then - error "prepare: none of the packages listed on the command line seem to be installed"; - - if debug >= 1 then ( - printf "supermin: packages specified on the command line:\n"; - List.iter (printf " - %s\n") (List.map ph.ph_package_to_string packages); - flush stdout - ); - - (* Convert input packages to a set. This removes duplicates. *) - let packages = package_set_of_list packages in - - (* Write input packages to the 'packages' file. We don't need to - * write the dependencies because we do dependency resolution at - * build time too. - *) - let () = - let packages = PackageSet.elements packages in - let pkg_names = List.map ph.ph_package_name packages in - let pkg_names = List.sort compare pkg_names in - - let packages_file = outputdir // "packages" in - if debug >= 1 then - printf "supermin: writing %s\n%!" packages_file; - - let chan = open_out packages_file in - List.iter (fprintf chan "%s\n") pkg_names; - close_out chan in - - (* Resolve the dependencies. *) - let packages = get_all_requires packages in - - if debug >= 1 then ( - printf "supermin: after resolving dependencies there are %d packages:\n" - (PackageSet.cardinal packages); - let pkg_names = PackageSet.elements packages in - let pkg_names = List.map ph.ph_package_to_string pkg_names in - let pkg_names = List.sort compare pkg_names in - List.iter (printf " - %s\n") pkg_names; - flush stdout - ); - - (* List the files in each package. *) - let packages = - PackageSet.fold ( - fun pkg pkgs -> - let files = get_files pkg in - (pkg, files) :: pkgs - ) packages [] in - - if debug >= 2 then ( - List.iter ( - fun (pkg, files) -> - printf "supermin: files in '%s':\n" (ph.ph_package_to_string pkg); - List.iter - (fun { ft_path = path; ft_config = config } -> - printf " - %s%s\n" path (if config then " [config]" else "")) - files - ) packages; - flush stdout - ); - - let dir = - if not use_installed then ( - (* For packages that contain any config files, we have to download - * the original package, in order to construct the base image. We - * can skip packages that have no config files. - *) - let dir = tmpdir // "prepare.d" in - Unix.mkdir dir 0o755; - - let () = - let dl_packages = filter_map ( - fun (pkg, files) -> - let has_config_files = - List.exists (fun { ft_config = config } -> config) files in - if has_config_files then Some pkg else None - ) packages in - let dl_packages = package_set_of_list dl_packages in - download_all_packages dl_packages dir in - - dir - ) - else (* --use-installed *) "/" in - - (* Get the list of config files, which are the files we will place - * into base. We have to check the files exist too, since they can - * be missing either from the package or from the filesystem (the - * latter case with --use-installed). - *) - let files_from = - let config_files = - List.map ( - fun (_, files) -> - filter_map ( - function - | { ft_config = true; ft_path = path } -> Some path - | { ft_config = false } -> None - ) files - ) packages in - let config_files = List.flatten config_files in - - let config_files = List.filter ( - fun path -> - try close_in (open_in (dir // path)); true - with Sys_error _ -> false - ) config_files in - - (* Put the list of config files into a file, for tar to read. *) - let files_from = tmpdir // "files-from.txt" in - let chan = open_out files_from in - List.iter (fprintf chan ".%s\n") config_files; (* "./filename" *) - close_out chan; - - files_from in - - (* Write base.tar.gz. *) - let base = outputdir // "base.tar.gz" in - if debug >= 1 then printf "supermin: writing %s\n%!" base; - let cmd = - sprintf "tar -C %s -zcf %s -T %s" - (quote dir) (quote base) (quote files_from) in - run_command cmd; diff -Nru supermin-5.1.17/src/rpm.ml supermin-5.1.18/src/rpm.ml --- supermin-5.1.17/src/rpm.ml 2016-11-01 10:51:53.000000000 +0000 +++ supermin-5.1.18/src/rpm.ml 1970-01-01 00:00:00.000000000 +0000 @@ -1,486 +0,0 @@ -(* supermin 5 - * Copyright (C) 2009-2016 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - *) - -open Unix -open Printf - -open Utils -open Package_handler -open Librpm - -module StringSet = Set.Make (String) - -let stringset_of_list pkgs = - List.fold_left (fun set elem -> StringSet.add elem set) StringSet.empty pkgs - -let fedora_detect () = - Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && - (Config.yumdownloader <> "no" || Config.dnf <> "no") && - (List.mem (Os_release.get_id ()) [ "fedora"; "rhel"; "centos" ] || - try - (stat "/etc/redhat-release").st_kind = S_REG || - (stat "/etc/fedora-release").st_kind = S_REG - with Unix_error _ -> false) - -let opensuse_detect () = - Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && - Config.zypper <> "no" && - (List.mem (Os_release.get_id ()) [ "opensuse"; "sled"; "sles" ] || - try (stat "/etc/SuSE-release").st_kind = S_REG with Unix_error _ -> false) - -let mageia_detect () = - Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && - ((Config.urpmi <> "no" && Config.fakeroot <> "no") || Config.dnf <> "no") && - (Os_release.get_id () = "mageia" || - try (stat "/etc/mageia-release").st_kind = S_REG with Unix_error _ -> false) - -let ibm_powerkvm_detect () = - Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () && - Config.yumdownloader <> "no" && - try - (stat "/etc/ibm_powerkvm-release").st_kind = S_REG - with Unix_error _ -> false - -let settings = ref no_settings -let rpm_major, rpm_minor = ref 0, ref 0 -let zypper_major, zypper_minor, zypper_patch = ref 0, ref 0, ref 0 -let t = ref None - -let get_rpm () = - match !t with - | None -> error "rpm: get_rpm called too early" - | Some t -> t - -let rec rpm_init s = - settings := s; - - (* Get RPM version. We have to adjust some RPM commands based on - * the version. - *) - let version = rpm_version () in - let major, minor = - match string_split "." version with - | [] -> error "unable to parse empty rpm version string" - | [x] -> error "unable to parse rpm version string: %s" x - | major :: minor :: _ -> - try int_of_string major, int_of_string minor - with Failure "int_of_string" -> - error "unable to parse rpm version string: non-numeric, %s" version in - rpm_major := major; - rpm_minor := minor; - if !settings.debug >= 1 then - printf "supermin: rpm: detected RPM version %d.%d\n" major minor; - - t := Some (rpm_open ~debug:!settings.debug) - -and opensuse_init s = - rpm_init s; - - (* Get zypper version. We can use better zypper commands with more - * recent versions. - *) - let cmd = sprintf "%s --version | awk '{print $2}'" Config.zypper in - let lines = run_command_get_lines cmd in - let major, minor, patch = - match lines with - | [] -> error "zypper --version command had no output" - | line :: _ -> - let line = string_split "." line in - match line with - | [] -> error "unable to parse empty output of zypper --version" - | [x] -> error "unable to parse output of zypper --version: %s" x - | major :: minor :: [] -> - (try int_of_string major, int_of_string minor, 0 - with Failure "int_of_string" -> - error "unable to parse output of zypper --version: non-numeric") - | major :: minor :: patch :: _ -> - (try int_of_string major, int_of_string minor, int_of_string patch - with Failure "int_of_string" -> - error "unable to parse output of zypper --version: non-numeric") in - zypper_major := major; - zypper_minor := minor; - zypper_patch := patch; - if !settings.debug >= 1 then - printf "supermin: rpm: detected zypper version %d.%d.%d\n" major minor patch - -let rpm_fini () = - match !t with - | None -> () - | Some t -> rpm_close t - -(* Memo from package type to internal rpm_t. *) -let rpm_of_pkg, pkg_of_rpm = get_memo_functions () - -(* Memo of rpm_package_of_string. *) -let rpmh = Hashtbl.create 13 - -let rpm_package_of_string str = - let query rpm = - let rpms = Array.to_list (rpm_installed (get_rpm ()) rpm) in - (* RPM will return multiple hits when either multiple versions or - * multiple arches are installed at the same time. We are only - * interested in the highest version with the best - * architecture. - *) - let cmp { version = v1; arch = a1 } { version = v2; arch = a2 } = - let i = rpm_vercmp v2 v1 in - if i <> 0 then i - else compare_architecture a2 a1 - in - let rpms = List.sort cmp rpms in - List.hd rpms - in - - try - Hashtbl.find rpmh str - with - Not_found -> - let r = - try Some (pkg_of_rpm (query str)) - with Not_found -> - try - let p = rpm_pkg_whatprovides (get_rpm ()) str in - (* Pick only a provided package when there is just one of them, - * otherwise there is no reliable way to know which one to pick - * if there are multiple providers. - *) - if Array.length p = 1 then - Some (pkg_of_rpm (query p.(0))) - else - None - with Not_found -> None in - Hashtbl.add rpmh str r; - r - -let rpm_package_to_string pkg = - (* In RPM < 4.11 query commands that use the epoch number in the - * package name did not work. - * - * For example: - * RHEL 6 (rpm 4.8.0): - * $ rpm -q tar-2:1.23-11.el6.x86_64 - * package tar-2:1.23-11.el6.x86_64 is not installed - * Fedora 20 (rpm 4.11.2): - * $ rpm -q tar-2:1.26-30.fc20.x86_64 - * tar-1.26-30.fc20.x86_64 - * - *) - let is_rpm_lt_4_11 = - !rpm_major < 4 || (!rpm_major = 4 && !rpm_minor < 11) in - - let rpm = rpm_of_pkg pkg in - if is_rpm_lt_4_11 || rpm.epoch = 0 then - sprintf "%s-%s-%s.%s" rpm.name rpm.version rpm.release rpm.arch - else - sprintf "%s-%d:%s-%s.%s" - rpm.name rpm.epoch rpm.version rpm.release rpm.arch - -let rpm_package_name pkg = - let rpm = rpm_of_pkg pkg in - rpm.name - -let rpm_get_package_database_mtime () = - (lstat "/var/lib/rpm/Packages").st_mtime - -(* Return the best provider of a particular RPM requirement. - * - * There may be multiple, or no providers. In case there are multiple, - * choose the one with the shortest name (as yum used to). - * - * We could do better here: http://yum.baseurl.org/wiki/CompareProviders - *) -let provider = - (* Memo of resolved provides. *) - let rpm_providers = Hashtbl.create 13 in - fun req -> - try Hashtbl.find rpm_providers req - with Not_found -> - let ret = - try - (* 'providers' here is an array of just package names. *) - let providers = rpm_pkg_whatprovides (get_rpm ()) req in - let providers = Array.to_list providers in - (* --whatprovides will return duplicate identical packages, so: *) - let providers = sort_uniq providers in - (* Only packages which are actually installed: *) - let providers = - List.filter (fun name -> rpm_package_of_string name <> None) - providers in - - match providers with - | [] -> None - | [name] -> - Some name - | names -> - if !settings.debug >= 2 then - printf "supermin: rpm: multiple providers: requirement %s: providers: %s\n" - req (String.concat " " names); - let cmp name1 name2 = - let len1 = String.length name1 and len2 = String.length name2 in - if len1 <> len2 then compare len1 len2 - else compare name1 name2 in - let names = List.sort cmp names in - let best_name = List.hd names in - if !settings.debug >= 2 then - printf "supermin: rpm: multiple providers: picked %s\n" best_name; - Some best_name - with Not_found -> None in - Hashtbl.add rpm_providers req ret; - ret - -let rpm_get_all_requires pkgs = - let get pkg = - let reqs = - try - rpm_pkg_requires (get_rpm ()) pkg - with - Multiple_matches _ as ex -> - match rpm_package_of_string pkg with - | None -> raise ex - | Some pkg -> - rpm_pkg_requires (get_rpm ()) (rpm_package_to_string pkg) in - let pkgs' = Array.fold_left ( - fun set x -> - match provider x with - | None -> set - | Some p -> StringSet.add p set - ) StringSet.empty reqs in - pkgs' - in - let queue = Queue.create () in - let final = ref (stringset_of_list - (List.map rpm_package_name - (PackageSet.elements pkgs))) in - StringSet.iter (fun x -> Queue.push x queue) !final; - let resolved = ref StringSet.empty in - while not (Queue.is_empty queue) do - let current = Queue.pop queue in - if not (StringSet.mem current !resolved) then ( - try - let expanded = get current in - let diff = StringSet.diff expanded !final in - if not (StringSet.is_empty diff) then ( - final := StringSet.union !final diff; - StringSet.iter (fun x -> Queue.push x queue) diff; - ) - with Not_found -> (); - resolved := StringSet.add current !resolved - ) - done; - let pkgs' = filter_map rpm_package_of_string (StringSet.elements !final) in - package_set_of_list pkgs' - -let rpm_get_all_files pkgs = - let files_compare { filepath = a } { filepath = b } = - compare a b in - let files = List.map rpm_package_to_string (PackageSet.elements pkgs) in - let files = List.fold_right ( - fun pkg xs -> - let files = Array.to_list (rpm_pkg_filelist (get_rpm ()) pkg) in - files @ xs - ) files [] in - let files = sort_uniq ~cmp:files_compare files in - List.map ( - fun { filepath = path; filetype = flags } -> - let config = flags = FileConfig in - { ft_path = path; ft_source_path = path; ft_config = config } - ) files - -let rec fedora_download_all_packages pkgs dir = - let tdir = !settings.tmpdir // string_random8 () in - - if Config.dnf <> "no" then - download_all_packages_with_dnf pkgs dir tdir - else (* Config.yumdownloader <> "no" *) - fedora_download_all_packages_with_yum pkgs dir tdir; - - rpm_unpack tdir dir - -and fedora_download_all_packages_with_yum pkgs dir tdir = - (* It's quite complex to get yumdownloader to download specific - * RPMs. If we use the full NVR, then it will refuse if an installed - * RPM is older than whatever is currently in the repo. If we use - * just name, it will download all architectures (even with - * --archlist). - * - * Use name.arch so it can download any version but only the specific - * architecture. - *) - let rpms = pkgs_as_NA_rpms pkgs in - - let cmd = - sprintf "%s%s%s --destdir %s %s" - Config.yumdownloader - (if !settings.debug >= 1 then "" else " --quiet") - (match !settings.packager_config with - | None -> "" - | Some filename -> sprintf " -c %s" (quote filename)) - (quote tdir) - (quoted_list rpms) in - run_command cmd - -and opensuse_download_all_packages pkgs dir = - let tdir = !settings.tmpdir // string_random8 () in - - let rpms = pkgs_as_NA_rpms pkgs in - - let is_zypper_1_9_14 = - !zypper_major > 1 - || (!zypper_major = 1 && !zypper_minor > 9) - || (!zypper_major = 1 && !zypper_minor = 9 && !zypper_patch >= 14) in - - let cmd = - if is_zypper_1_9_14 then - sprintf " - %s%s \\ - --reposd-dir /etc/zypp/repos.d \\ - --cache-dir %s \\ - --pkg-cache-dir %s \\ - --gpg-auto-import-keys --no-gpg-checks --non-interactive \\ - download \\ - %s" - Config.zypper - (if !settings.debug >= 1 then " --verbose --verbose" else " --quiet") - (quote tdir) - (quote tdir) - (quoted_list rpms) - else - (* This isn't quite right because zypper will resolve the dependencies - * of the listed packages against the public repos and download all the - * dependencies too. We only really want it to download the named - * packages. XXX - *) - sprintf " - %s%s \\ - --root %s \\ - --reposd-dir /etc/zypp/repos.d \\ - --cache-dir %s \\ - --pkg-cache-dir %s \\ - --gpg-auto-import-keys --no-gpg-checks --non-interactive \\ - install \\ - --auto-agree-with-licenses --download-only --no-recommends \\ - %s" - Config.zypper - (if !settings.debug >= 1 then " --verbose --verbose" else " --quiet") - (quote tdir) - (quote tdir) - (quote tdir) - (quoted_list rpms) in - run_command cmd; - - rpm_unpack tdir dir - -and mageia_download_all_packages pkgs dir = - let tdir = !settings.tmpdir // string_random8 () in - - if Config.dnf <> "no" then - download_all_packages_with_dnf pkgs dir tdir - else (* Config.urpmi <> "no" && Config.fakeroot <> "no" *) - mageia_download_all_packages_with_urpmi pkgs dir tdir; - - rpm_unpack tdir dir - -and mageia_download_all_packages_with_urpmi pkgs dir tdir = - let rpms = List.map rpm_package_name (PackageSet.elements pkgs) in - - let cmd = - sprintf " - %s %s%s \\ - --download-all %s \\ - --replacepkgs \\ - --no-install \\ - %s" - Config.fakeroot - Config.urpmi - (if !settings.debug >= 1 then " --verbose" else " --quiet") - (quote tdir) - (quoted_list rpms) in - run_command cmd - -and download_all_packages_with_dnf pkgs dir tdir = - (* Old dnf didn't create the destdir directory, newer versions do. *) - mkdir tdir 0o700; - - let rpms = pkgs_as_NA_rpms pkgs in - - let cmd = - sprintf "%s download%s%s --destdir=%s --disableexcludes=all %s" - Config.dnf - (if !settings.debug >= 1 then " -v" else " -q") - (match !settings.packager_config with - | None -> "" - | Some filename -> sprintf " -c %s" (quote filename)) - (quote tdir) - (quoted_list rpms) in - run_command cmd - -and pkgs_as_NA_rpms pkgs = - let rpms = List.map rpm_of_pkg (PackageSet.elements pkgs) in - List.map ( - fun { name = name; arch = arch } -> - sprintf "%s.%s" name arch - ) rpms - -and rpm_unpack tdir dir = - (* Unpack each downloaded package. - * - * yumdownloader can't necessarily download the specific file that we - * requested, we might get a different (eg later) version. - *) - let cmd = - sprintf " -umask 0000 -for f in `find %s -name '*.rpm'`; do - %s \"$f\" | (cd %s && %s --quiet -id) -done" - (quote tdir) Config.rpm2cpio (quote dir) Config.cpio in - run_command cmd - -(* We register package handlers for each RPM distro variant. *) -let () = - let fedora = { - ph_detect = fedora_detect; - ph_init = rpm_init; - ph_fini = rpm_fini; - ph_package_of_string = rpm_package_of_string; - ph_package_to_string = rpm_package_to_string; - ph_package_name = rpm_package_name; - ph_get_package_database_mtime = rpm_get_package_database_mtime; - ph_get_requires = PHGetAllRequires rpm_get_all_requires; - ph_get_files = PHGetAllFiles rpm_get_all_files; - ph_download_package = PHDownloadAllPackages fedora_download_all_packages; - } in - register_package_handler "fedora" "rpm" fedora; - let ibm_powerkvm = { - fedora with - ph_detect = ibm_powerkvm_detect; - } in - register_package_handler "ibm_powerkvm" "rpm" ibm_powerkvm; - let opensuse = { - fedora with - ph_detect = opensuse_detect; - ph_init = opensuse_init; - ph_download_package = PHDownloadAllPackages opensuse_download_all_packages; - } in - register_package_handler "opensuse" "rpm" opensuse; - let mageia = { - fedora with - ph_detect = mageia_detect; - ph_download_package = PHDownloadAllPackages mageia_download_all_packages; - } in - register_package_handler "mageia" "rpm" mageia diff -Nru supermin-5.1.17/src/supermin.1 supermin-5.1.18/src/supermin.1 --- supermin-5.1.17/src/supermin.1 2016-11-01 10:56:58.000000000 +0000 +++ supermin-5.1.18/src/supermin.1 2017-03-01 11:36:34.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) +.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== @@ -67,7 +67,7 @@ .\" ======================================================================== .\" .IX Title "SUPERMIN 1" -.TH SUPERMIN 1 "2016-10-23" "supermin-5.1.17" "Virtualization Support" +.TH SUPERMIN 1 "2017-03-01" "supermin-5.1.17" "Virtualization Support" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -218,31 +218,6 @@ .Sp This is fractionally slower, but is necessary if you want to change the permissions or SELinux label on the kernel or device tree. -.IP "\fB\-\-dtb\fR \s-1WILDCARD\s0" 4 -.IX Item "--dtb WILDCARD" -(\fI\-\-build\fR mode only) -.Sp -If specified, search for a device tree which is compatible with the -selected kernel and the name of which matches the given wildcard. You -can use a wildcard such as \f(CW\*(C`vexpress\-*a9*.dtb\*(C'\fR which would match -\&\fIvexpress\-v2p\-ca9.dtb\fR. -.Sp -Notes: -.RS 4 -.IP "\(bu" 4 -You may need to quote the wildcard to prevent it from being expanded -by your shell. -.IP "\(bu" 4 -If no \fI\-\-dtb\fR option is given, no device tree will be looked for. -.IP "\(bu" 4 -You only need a device tree on architectures such as \s-1ARM\s0 and PowerPC -which use them. On other architectures, don't use this option. -.IP "\(bu" 4 -If you use this option and no compatible device tree can be found, -supermin will exit with an error. -.RE -.RS 4 -.RE .IP "\fB\-f\fR \s-1FORMAT\s0" 4 .IX Item "-f FORMAT" .PD 0 @@ -268,20 +243,20 @@ into this directory afterwards, although it's a better idea to use a container technology (\s-1LXC,\s0 etc.). .Sp -No kernel, initrd or dtb is generated in this mode because it is +No kernel or initrd is generated in this mode because it is assumed that you will be running the appliance using the host kernel. .IP "ext2" 4 .IX Item "ext2" An ext2 filesystem disk image. .Sp -The output kernel is written to \fIOUTPUTDIR/kernel\fR, the device tree -(if using) to \fIOUTPUTDIR/dtb\fR, a small initramfs which can mount the +The output kernel is written to \fIOUTPUTDIR/kernel\fR, +a small initramfs which can mount the appliance to \fIOUTPUTDIR/initrd\fR, and the ext2 filesystem image to \&\fIOUTPUTDIR/root\fR. (Where \fI\s-1OUTPUTDIR\s0\fR is specified by the \fI\-o\fR option). .Sp -The filesystem (\fIOUTPUTDIR/root\fR) has a default size of 4 \s-1GB -\&\s0(see also the \fI\-\-size\fR option). +The filesystem (\fIOUTPUTDIR/root\fR) has a default size of 4 \s-1GB\s0 +(see also the \fI\-\-size\fR option). .RE .RS 4 .RE @@ -289,7 +264,7 @@ .IX Item "--host-cpu CPU" (\fI\-\-build\fR mode only) .Sp -Specify the host \s-1CPU \s0(eg. \f(CW\*(C`i686\*(C'\fR, \f(CW\*(C`x86_64\*(C'\fR). This is used as a +Specify the host \s-1CPU\s0 (eg. \f(CW\*(C`i686\*(C'\fR, \f(CW\*(C`x86_64\*(C'\fR). This is used as a substring match when searching for compatible kernels. If not specified, it defaults to the host \s-1CPU\s0 that supermin was compiled on. .IP "\fB\-\-if\-newer\fR" 4 @@ -424,7 +399,7 @@ .IX Header "SUPERMIN APPLIANCES" Supermin appliances consist of just enough information to be able to build an appliance containing the same operating system (Linux -version, distro, release etc) as the host \s-1OS. \s0 Since the host and +version, distro, release etc) as the host \s-1OS.\s0 Since the host and appliance share many common files such as \fI/bin/bash\fR and \&\fI/lib/libc.so\fR there is no reason to ship these files in the appliance. They can simply be read from the host on demand when the @@ -569,7 +544,7 @@ .IX Subsection "ENFORCING AVAILABILITY OF PACKAGES" Supermin builds the appliance by copying in the packages listed in \&\fIpackages\fR. For this to work those packages must be available. We -usually enforce this by adding requirements (eg. \s-1RPM \s0\f(CW\*(C`Requires:\*(C'\fR +usually enforce this by adding requirements (eg. \s-1RPM\s0 \f(CW\*(C`Requires:\*(C'\fR lines) on the package that uses the supermin appliance, so that package cannot be installed without pulling in the dependent packages and thus making sure the packages are installed for supermin to use. @@ -588,9 +563,6 @@ .Sp The environment variable should point to a module directory, eg. \fI/lib/modules/3.0.x86_64/\fR -.IP "\s-1SUPERMIN_DTB\s0" 4 -.IX Item "SUPERMIN_DTB" -Force the given device tree file to be used. .IP "\s-1SUPERMIN_KERNEL_VERSION\s0" 4 .IX Item "SUPERMIN_KERNEL_VERSION" On non\-x86 architectures, you may need to set this environment @@ -618,7 +590,7 @@ .PP This program is distributed in the hope that it will be useful, but \s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of -\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the +\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE.\s0 See the \&\s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License diff -Nru supermin-5.1.17/src/supermin.ml supermin-5.1.18/src/supermin.ml --- supermin-5.1.17/src/supermin.ml 2016-07-06 13:12:21.000000000 +0000 +++ supermin-5.1.18/src/supermin.ml 2017-03-01 11:34:37.000000000 +0000 @@ -21,8 +21,6 @@ open Types open Utils -open Prepare -open Build open Package_handler type mode = Prepare | Build @@ -86,7 +84,6 @@ let copy_kernel = ref false in let debug = ref 0 in - let dtb_wildcard = ref "" in let format = ref None in let host_cpu = ref Config.host_cpu in let if_newer = ref false in @@ -130,11 +127,21 @@ " in + let error_dtb_option _ = + error "\ +*** error: The --dtb option was removed in supermin 5.1.18. + +Normally you can just drop this option and the wildcard following +it. Modern QEMU will generate a correct DTB for the supermin +appliance automatically. +" + in + let ditto = " -\"-" in let argspec = Arg.align [ "--build", Arg.Unit set_build_mode, " Build a full appliance"; "--copy-kernel", Arg.Set copy_kernel, " Copy kernel instead of symlinking"; - "--dtb", Arg.Set_string dtb_wildcard, "WILDCARD Find device tree matching wildcard"; + "--dtb", Arg.String error_dtb_option, " Obsolete option, do not use"; "-f", Arg.String set_format, "chroot|ext2 Set output format"; "--format", Arg.String set_format, ditto; "--host-cpu", Arg.Set_string host_cpu, "ARCH Set host CPU architecture"; @@ -160,7 +167,6 @@ let copy_kernel = !copy_kernel in let debug = !debug in - let dtb_wildcard = match !dtb_wildcard with "" -> None | s -> Some s in let host_cpu = !host_cpu in let if_newer = !if_newer in let inputs = List.rev !inputs in @@ -191,7 +197,7 @@ else outputdir in debug, mode, if_newer, inputs, lockfile, outputdir, - (copy_kernel, dtb_wildcard, format, host_cpu, + (copy_kernel, format, host_cpu, packager_config, tmpdir, use_installed, size, include_packagelist) in @@ -201,7 +207,7 @@ * This fails with an error if one could not be located. *) let () = - let (_, _, _, _, packager_config, tmpdir, _, _, _) = args in + let (_, _, _, packager_config, tmpdir, _, _, _) = args in let settings = { debug = debug; tmpdir = tmpdir; @@ -252,8 +258,8 @@ ignore (Sys.command cmd)); (match mode with - | Prepare -> prepare debug args inputs new_outputdir - | Build -> build debug args inputs new_outputdir + | Prepare -> Mode_prepare.prepare debug args inputs new_outputdir + | Build -> Mode_build.build debug args inputs new_outputdir ); (* Delete the old output directory if it exists. *) diff -Nru supermin-5.1.17/src/supermin.pod supermin-5.1.18/src/supermin.pod --- supermin-5.1.17/src/supermin.pod 2016-10-23 08:45:38.000000000 +0000 +++ supermin-5.1.18/src/supermin.pod 2017-03-01 11:34:37.000000000 +0000 @@ -143,40 +143,6 @@ This is fractionally slower, but is necessary if you want to change the permissions or SELinux label on the kernel or device tree. -=item B<--dtb> WILDCARD - -(I<--build> mode only) - -If specified, search for a device tree which is compatible with the -selected kernel and the name of which matches the given wildcard. You -can use a wildcard such as C which would match -F. - -Notes: - -=over 4 - -=item * - -You may need to quote the wildcard to prevent it from being expanded -by your shell. - -=item * - -If no I<--dtb> option is given, no device tree will be looked for. - -=item * - -You only need a device tree on architectures such as ARM and PowerPC -which use them. On other architectures, don't use this option. - -=item * - -If you use this option and no compatible device tree can be found, -supermin will exit with an error. - -=back - =item B<-f> FORMAT =item B<--format> FORMAT @@ -202,15 +168,15 @@ into this directory afterwards, although it's a better idea to use a container technology (LXC, etc.). -No kernel, initrd or dtb is generated in this mode because it is +No kernel or initrd is generated in this mode because it is assumed that you will be running the appliance using the host kernel. =item ext2 An ext2 filesystem disk image. -The output kernel is written to F, the device tree -(if using) to F, a small initramfs which can mount the +The output kernel is written to F, +a small initramfs which can mount the appliance to F, and the ext2 filesystem image to F. (Where F is specified by the I<-o> option). @@ -543,10 +509,6 @@ The environment variable should point to a module directory, eg. F -=item SUPERMIN_DTB - -Force the given device tree file to be used. - =item SUPERMIN_KERNEL_VERSION On non-x86 architectures, you may need to set this environment diff -Nru supermin-5.1.17/src/utils.ml supermin-5.1.18/src/utils.ml --- supermin-5.1.17/src/utils.ml 2016-03-18 13:15:15.000000000 +0000 +++ supermin-5.1.18/src/utils.ml 2017-03-01 11:34:37.000000000 +0000 @@ -183,6 +183,8 @@ | a when string_prefix "armv6" a -> 32 | a when string_prefix "armv7" a -> 32 | a when string_prefix "armv8" a -> 64 + | "hppa" | "parisc" -> 32 + | "hppa64" | "parisc64" -> 64 | "ppc" | "ppc32" -> 32 | a when string_prefix "ppc64" a -> 64 | "sparc" | "sparc32" -> 32 @@ -216,3 +218,7 @@ ) else ( error "cannot parse size field '%s'" field ) + +let isalnum = function + | '0'..'9' | 'a'..'z' | 'A'..'Z' -> true + | _ -> false diff -Nru supermin-5.1.17/src/utils.mli supermin-5.1.18/src/utils.mli --- supermin-5.1.17/src/utils.mli 2016-03-18 13:15:15.000000000 +0000 +++ supermin-5.1.18/src/utils.mli 2017-03-01 11:34:37.000000000 +0000 @@ -91,3 +91,6 @@ val parse_size : string -> int64 (** Parse a size field, eg. [10G] *) + +val isalnum : char -> bool +(** Return true iff the character is alphanumeric. *) diff -Nru supermin-5.1.17/test-driver supermin-5.1.18/test-driver --- supermin-5.1.17/test-driver 2014-03-12 19:05:34.000000000 +0000 +++ supermin-5.1.18/test-driver 2016-02-17 14:57:44.000000000 +0000 @@ -1,9 +1,9 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2012-06-27.10; # UTC +scriptversion=2013-07-13.22; # UTC -# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# Copyright (C) 2011-2014 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -44,13 +44,12 @@ Usage: test-driver --test-name=NAME --log-file=PATH --trs-file=PATH [--expect-failure={yes|no}] [--color-tests={yes|no}] - [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT + [--enable-hard-errors={yes|no}] [--] + TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] The '--test-name', '--log-file' and '--trs-file' options are mandatory. END } -# TODO: better error handling in option parsing (in particular, ensure -# TODO: $log_file, $trs_file and $test_name are defined). test_name= # Used for reporting. log_file= # Where to save the output of the test script. trs_file= # Where to save the metadata of the test run. @@ -69,10 +68,23 @@ --enable-hard-errors) enable_hard_errors=$2; shift;; --) shift; break;; -*) usage_error "invalid option: '$1'";; + *) break;; esac shift done +missing_opts= +test x"$test_name" = x && missing_opts="$missing_opts --test-name" +test x"$log_file" = x && missing_opts="$missing_opts --log-file" +test x"$trs_file" = x && missing_opts="$missing_opts --trs-file" +if test x"$missing_opts" != x; then + usage_error "the following mandatory options are missing:$missing_opts" +fi + +if test $# -eq 0; then + usage_error "missing argument" +fi + if test $color_tests = yes; then # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. red='' # Red. @@ -94,11 +106,14 @@ # Test script is run here. "$@" >$log_file 2>&1 estatus=$? + if test $enable_hard_errors = no && test $estatus -eq 99; then - estatus=1 + tweaked_estatus=1 +else + tweaked_estatus=$estatus fi -case $estatus:$expect_failure in +case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; @@ -107,6 +122,12 @@ *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>$log_file + # Report outcome to console. echo "${col}${res}${std}: $test_name" diff -Nru supermin-5.1.17/tests/Makefile.in supermin-5.1.18/tests/Makefile.in --- supermin-5.1.17/tests/Makefile.in 2016-11-01 10:56:09.000000000 +0000 +++ supermin-5.1.18/tests/Makefile.in 2017-07-13 09:32:34.000000000 +0000 @@ -127,17 +127,19 @@ $(top_srcdir)/m4/fcntl-o.m4 $(top_srcdir)/m4/fcntl-safer.m4 \ $(top_srcdir)/m4/fcntl.m4 $(top_srcdir)/m4/fcntl_h.m4 \ $(top_srcdir)/m4/fdopendir.m4 $(top_srcdir)/m4/filenamecat.m4 \ - $(top_srcdir)/m4/fstat.m4 $(top_srcdir)/m4/fts.m4 \ - $(top_srcdir)/m4/getcwd.m4 $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/flexmember.m4 $(top_srcdir)/m4/fstat.m4 \ + $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getcwd.m4 \ + $(top_srcdir)/m4/getdtablesize.m4 \ + $(top_srcdir)/m4/getprogname.m4 \ $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/i-ring.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/largefile.m4 \ - $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lstat.m4 \ - $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/memchr.m4 \ - $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \ - $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/mode_t.m4 \ - $(top_srcdir)/m4/msvc-inval.m4 \ + $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ + $(top_srcdir)/m4/memrchr.m4 $(top_srcdir)/m4/mmap-anon.m4 \ + $(top_srcdir)/m4/mode_t.m4 $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/ocaml.m4 $(top_srcdir)/m4/off_t.m4 \ $(top_srcdir)/m4/onceonly.m4 $(top_srcdir)/m4/open.m4 \ @@ -145,16 +147,16 @@ $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/readdir.m4 \ $(top_srcdir)/m4/realloc.m4 $(top_srcdir)/m4/save-cwd.m4 \ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/stat.m4 \ - $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ - $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio_h.m4 \ - $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strdup.m4 \ - $(top_srcdir)/m4/strerror.m4 $(top_srcdir)/m4/string_h.m4 \ - $(top_srcdir)/m4/sys_socket_h.m4 \ + $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdbool.m4 \ + $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ + $(top_srcdir)/m4/stdio_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strerror.m4 \ + $(top_srcdir)/m4/string_h.m4 $(top_srcdir)/m4/sys_socket_h.m4 \ $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ $(top_srcdir)/m4/sys_types_h.m4 $(top_srcdir)/m4/time_h.m4 \ $(top_srcdir)/m4/unistd-safer.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/warn-on-use.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) @@ -546,6 +548,7 @@ GNULIB_OPEN = @GNULIB_OPEN@ GNULIB_OPENAT = @GNULIB_OPENAT@ GNULIB_OPENDIR = @GNULIB_OPENDIR@ +GNULIB_OVERRIDES_WINT_T = @GNULIB_OVERRIDES_WINT_T@ GNULIB_PCLOSE = @GNULIB_PCLOSE@ GNULIB_PERROR = @GNULIB_PERROR@ GNULIB_PIPE = @GNULIB_PIPE@ @@ -562,6 +565,7 @@ GNULIB_PUTENV = @GNULIB_PUTENV@ GNULIB_PUTS = @GNULIB_PUTS@ GNULIB_PWRITE = @GNULIB_PWRITE@ +GNULIB_QSORT_R = @GNULIB_QSORT_R@ GNULIB_RANDOM = @GNULIB_RANDOM@ GNULIB_RANDOM_R = @GNULIB_RANDOM_R@ GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@ @@ -613,6 +617,7 @@ GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@ GNULIB_TIMEGM = @GNULIB_TIMEGM@ GNULIB_TIME_R = @GNULIB_TIME_R@ +GNULIB_TIME_RZ = @GNULIB_TIME_RZ@ GNULIB_TMPFILE = @GNULIB_TMPFILE@ GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@ GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@ @@ -639,6 +644,7 @@ GREP = @GREP@ HAVE_ALPHASORT = @HAVE_ALPHASORT@ HAVE_ATOLL = @HAVE_ATOLL@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@ HAVE_CHOWN = @HAVE_CHOWN@ HAVE_CLOSEDIR = @HAVE_CLOSEDIR@ @@ -654,6 +660,7 @@ HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ @@ -709,6 +716,7 @@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBSLEN = @HAVE_MBSLEN@ HAVE_MEMCHR = @HAVE_MEMCHR@ HAVE_MEMPCPY = @HAVE_MEMPCPY@ @@ -736,6 +744,7 @@ HAVE_PTSNAME = @HAVE_PTSNAME@ HAVE_PTSNAME_R = @HAVE_PTSNAME_R@ HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RANDOM = @HAVE_RANDOM@ HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ @@ -778,6 +787,7 @@ HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@ HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ @@ -806,6 +816,7 @@ LIBRPM_CFLAGS = @LIBRPM_CFLAGS@ LIBRPM_LIBS = @LIBRPM_LIBS@ LIBS = @LIBS@ +LIMITS_H = @LIMITS_H@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ @@ -816,6 +827,7 @@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ @@ -829,6 +841,7 @@ NEXT_DIRENT_H = @NEXT_DIRENT_H@ NEXT_ERRNO_H = @NEXT_ERRNO_H@ NEXT_FCNTL_H = @NEXT_FCNTL_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDIO_H = @NEXT_STDIO_H@ @@ -942,9 +955,11 @@ REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@ REPLACE_PUTENV = @REPLACE_PUTENV@ REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_QSORT_R = @REPLACE_QSORT_R@ REPLACE_RANDOM_R = @REPLACE_RANDOM_R@ REPLACE_READ = @REPLACE_READ@ REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ REPLACE_REALLOC = @REPLACE_REALLOC@ REPLACE_REALPATH = @REPLACE_REALPATH@ REPLACE_REMOVE = @REPLACE_REMOVE@ @@ -973,6 +988,7 @@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ REPLACE_TMPFILE = @REPLACE_TMPFILE@ REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ @@ -996,6 +1012,7 @@ SHELL = @SHELL@ SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDALIGN_H = @STDALIGN_H@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ STDINT_H = @STDINT_H@ @@ -1003,6 +1020,7 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ URPMI = @URPMI@ @@ -1020,6 +1038,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ diff -Nru supermin-5.1.17/tests/test-binaries-exist.sh supermin-5.1.18/tests/test-binaries-exist.sh --- supermin-5.1.17/tests/test-binaries-exist.sh 2014-03-21 12:31:40.000000000 +0000 +++ supermin-5.1.18/tests/test-binaries-exist.sh 2017-03-01 11:34:37.000000000 +0000 @@ -56,7 +56,7 @@ fi # These binaries should be runnable (since they are the same as the host). -`find $d2 -name sync | head` +`find $d2 -name sync ! -path '*/bash/*' | head` # Need to chmod $d2 since rm -r can't remove unwritable directories. chmod -R +w $d2 ||: