Hello community, here is the log from the commit of package apr for openSUSE:Factory checked in at 2018-05-13 15:56:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/apr (Old) and /work/SRC/openSUSE:Factory/.apr.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "apr" Sun May 13 15:56:33 2018 rev:7 rq:606135 version:1.6.3 Changes: -------- --- /work/SRC/openSUSE:Factory/apr/apr.changes 2018-04-22 14:34:35.391932010 +0200 +++ /work/SRC/openSUSE:Factory/.apr.new/apr.changes 2018-05-13 15:56:36.304852201 +0200 @@ -1,0 +2,10 @@ +Thu May 10 08:23:39 UTC 2018 - [email protected] + +- Version 1.6.3: + * apr_file_trunc: Truncating a buffered file could add unexpected + data after the truncate position. PR 51017. + * apr_file_trunc: Fix an issue where reading from a buffered file + after truncate could return stale data from the buffer. + * apr_ipsubnet_create() now fails for an empty input string. + +------------------------------------------------------------------- Old: ---- apr-1.6.2.tar.bz2 apr-1.6.2.tar.bz2.asc New: ---- apr-1.6.3.tar.bz2 apr-1.6.3.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ apr.spec ++++++ --- /var/tmp/diff_new_pack.BbJQPk/_old 2018-05-13 15:56:37.404812063 +0200 +++ /var/tmp/diff_new_pack.BbJQPk/_new 2018-05-13 15:56:37.408811917 +0200 @@ -21,7 +21,7 @@ %define installbuilddir %{_libdir}/apr-%{aprver}/build %define includedir %{_includedir}/apr-%{aprver} Name: apr -Version: 1.6.2 +Version: 1.6.3 Release: 0 Summary: Apache Portable Runtime (APR) Library License: Apache-2.0 ++++++ apr-1.4.5-linux3.patch ++++++ --- /var/tmp/diff_new_pack.BbJQPk/_old 2018-05-13 15:56:37.428811187 +0200 +++ /var/tmp/diff_new_pack.BbJQPk/_new 2018-05-13 15:56:37.432811041 +0200 @@ -1,3 +1,5 @@ +Index: configure.in +=================================================================== --- configure.in.orig +++ configure.in @@ -181,7 +181,7 @@ dnl Do the various CC checks *before* pr @@ -24,7 +26,7 @@ APR_EBCDIC dnl this is our library name -@@ -664,15 +657,7 @@ case $host in +@@ -692,15 +685,7 @@ case $host in fi ;; *linux*) @@ -40,7 +42,7 @@ ;; *os390) os_version=`uname -r | sed -e 's/\.//g'` -@@ -2060,6 +2045,8 @@ fi +@@ -2148,6 +2133,8 @@ fi AC_SUBST(have_proc_invoked) @@ -49,7 +51,7 @@ AC_MSG_CHECKING(for Variable Length Arrays) APR_TRY_COMPILE_NO_WARNING([], [ -@@ -2226,6 +2213,9 @@ APR_IFALLYES(header:OS.h func:create_sem +@@ -2314,6 +2301,9 @@ APR_IFALLYES(header:OS.h func:create_sem if test "x$apr_lock_method" != "x"; then APR_DECISION_FORCE($apr_lock_method) fi @@ -59,6 +61,8 @@ APR_END_DECISION AC_DEFINE_UNQUOTED($ac_decision) +Index: poll/unix/poll.c +=================================================================== --- poll/unix/poll.c.orig +++ poll/unix/poll.c @@ -73,7 +73,7 @@ APR_DECLARE(apr_status_t) apr_poll(apr_p ++++++ apr-1.6.2.tar.bz2 -> apr-1.6.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/CHANGES new/apr-1.6.3/CHANGES --- old/apr-1.6.2/CHANGES 2017-06-09 14:47:54.000000000 +0200 +++ new/apr-1.6.3/CHANGES 2017-09-11 17:28:41.000000000 +0200 @@ -1,4 +1,17 @@ -*- coding: utf-8 -*- +Changes for APR 1.6.3 + + *) apr_file_trunc: Truncating a buffered file could add unexpected + data after the truncate position. PR 51017. + [Evgeny Kotkov <evgeny.kotkov visualsvn.com>] + + *) apr_file_trunc: Fix an issue where reading from a buffered file + after truncate could return stale data from the buffer. + [Evgeny Kotkov <evgeny.kotkov visualsvn.com>] + + *) apr_ipsubnet_create() now fails for an empty input string. + [Joe Orton] + Changes for APR 1.6.2 *) Corrected non-Unix builds for APR_LOCK_DEFAULT. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/apr.spec new/apr-1.6.3/apr.spec --- old/apr-1.6.2/apr.spec 2017-06-09 14:56:21.000000000 +0200 +++ new/apr-1.6.3/apr.spec 2017-10-18 16:50:19.000000000 +0200 @@ -3,7 +3,7 @@ Summary: Apache Portable Runtime library Name: apr -Version: 1.6.2 +Version: 1.6.3 Release: 1 License: Apache Software License Group: System Environment/Libraries diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/build/buildcheck.sh new/apr-1.6.3/build/buildcheck.sh --- old/apr-1.6.2/build/buildcheck.sh 2009-11-13 01:27:16.000000000 +0100 +++ new/apr-1.6.3/build/buildcheck.sh 2017-06-09 14:54:37.000000000 +0200 @@ -1,35 +1,37 @@ #! /bin/sh echo "buildconf: checking installation..." +res=0 # any python python=`build/PrintPath python` if test -z "$python"; then -echo "buildconf: python not found." -echo " You need python installed" -echo " to build APR from SVN." -exit 1 + echo "buildconf: python not found." + echo " You need python installed" + echo " to build APR from SVN." + res=1 else -py_version=`python -c 'import sys; print sys.version' 2>&1|sed 's/ .*//;q'` -echo "buildconf: python version $py_version (ok)" + py_version=`python -c 'import sys; print sys.version' 2>&1|sed 's/ .*//;q'` + echo "buildconf: python version $py_version (ok)" fi # autoconf 2.59 or newer ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a-z]* *$//;q'` if test -z "$ac_version"; then -echo "buildconf: autoconf not found." -echo " You need autoconf version 2.59 or newer installed" -echo " to build APR from SVN." -exit 1 -fi -IFS=.; set $ac_version; IFS=' ' -if test "$1" = "2" -a "$2" -lt "59" || test "$1" -lt "2"; then -echo "buildconf: autoconf version $ac_version found." -echo " You need autoconf version 2.59 or newer installed" -echo " to build APR from SVN." -exit 1 + echo "buildconf: autoconf not found." + echo " You need autoconf version 2.59 or newer installed" + echo " to build APR from SVN." + res=1 else -echo "buildconf: autoconf version $ac_version (ok)" + IFS=.; set $ac_version; IFS=' ' + if test "$1" = "2" -a "$2" -lt "59" || test "$1" -lt "2"; then + echo "buildconf: autoconf version $ac_version found." + echo " You need autoconf version 2.59 or newer installed" + echo " to build APR from SVN." + res=1 + else + echo "buildconf: autoconf version $ac_version (ok)" + fi fi # Sample libtool --version outputs: @@ -41,26 +43,28 @@ libtool=`build/PrintPath glibtool1 glibtool libtool libtool15 libtool14` lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'` if test -z "$lt_pversion"; then -echo "buildconf: libtool not found." -echo " You need libtool version 1.4 or newer installed" -echo " to build APR from SVN." -exit 1 -fi -lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'` -IFS=.; set $lt_version; IFS=' ' -lt_status="good" -if test "$1" = "1"; then - if test "$2" -lt "4"; then + echo "buildconf: libtool not found." + echo " You need libtool version 1.4 or newer installed" + echo " to build APR from SVN." + res=1 +else + lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'` + IFS=.; set $lt_version; IFS=' ' + lt_status="good" + if test "$1" = "1"; then + if test "$2" -lt "4"; then lt_status="bad" - fi -fi -if test $lt_status = "good"; then - echo "buildconf: libtool version $lt_pversion (ok)" - exit 0 + fi + fi + if test $lt_status = "good"; then + echo "buildconf: libtool version $lt_pversion (ok)" + else + echo "buildconf: libtool version $lt_pversion found." + echo " You need libtool version 1.4 or newer installed" + echo " to build APR from SVN." + res=1 + fi fi -echo "buildconf: libtool version $lt_pversion found." -echo " You need libtool version 1.4 or newer installed" -echo " to build APR from SVN." +exit $res -exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/build/config.guess new/apr-1.6.3/build/config.guess --- old/apr-1.6.2/build/config.guess 2017-04-16 13:05:22.000000000 +0200 +++ new/apr-1.6.3/build/config.guess 2017-09-25 20:23:17.000000000 +0200 @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-03-05' +timestamp='2017-09-16' # 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 @@ -15,7 +15,7 @@ # 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 <http://www.gnu.org/licenses/>. +# along with this program; if not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -27,7 +27,7 @@ # 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 +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to <[email protected]>. @@ -259,6 +259,9 @@ *:Sortix:*:*) echo ${UNAME_MACHINE}-unknown-sortix exit ;; + *:Redox:*:*) + echo ${UNAME_MACHINE}-unknown-redox + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -315,15 +318,6 @@ exitcode=$? trap '' 0 exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; @@ -855,10 +849,6 @@ *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; @@ -874,27 +864,12 @@ echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; @@ -1304,14 +1279,21 @@ 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 + (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 + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub @@ -1335,16 +1317,16 @@ *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) + NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; - NSR-?:NONSTOP_KERNEL:*:*) + NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; - NSX-?:NONSTOP_KERNEL:*:*) + NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) @@ -1422,12 +1404,12 @@ $0: unable to guess system type This script (version $timestamp), has failed to recognize the -operating system you are using. If your script is old, overwrite -config.guess and config.sub with the latest versions from: +operating system you are using. If your script is old, overwrite *all* +copies of config.guess and config.sub with the latest versions from: - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess + https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess and - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub + https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub If $0 has already been updated, send the following data and any information you think might be pertinent to [email protected] to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/build/config.sub new/apr-1.6.3/build/config.sub --- old/apr-1.6.2/build/config.sub 2017-04-16 13:05:22.000000000 +0200 +++ new/apr-1.6.3/build/config.sub 2017-09-25 20:23:17.000000000 +0200 @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-04-02' +timestamp='2017-09-16' # 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 @@ -15,7 +15,7 @@ # 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 <http://www.gnu.org/licenses/>. +# along with this program; if not, see <https://www.gnu.org/licenses/>. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -229,9 +229,6 @@ -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; -psos*) os=-psos ;; @@ -1259,6 +1256,9 @@ basic_machine=hppa1.1-winbond os=-proelf ;; + x64) + basic_machine=x86_64-pc + ;; xbox) basic_machine=i686-pc os=-mingw32 @@ -1366,8 +1366,8 @@ if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases that might get confused + # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux @@ -1387,9 +1387,9 @@ -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; - # First accept the basic system types. + # Now accept the basic system types. # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. + # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/build/fixwin32mak.pl new/apr-1.6.3/build/fixwin32mak.pl --- old/apr-1.6.2/build/fixwin32mak.pl 2013-10-03 12:53:42.000000000 +0200 +++ new/apr-1.6.3/build/fixwin32mak.pl 2017-09-27 16:51:50.000000000 +0200 @@ -140,7 +140,7 @@ $dstfl = new IO::File $tname, "w" || die; while ($src = <$srcfl>) { if (($src =~ m/^\t"(\.\.\\)+(apr|apr-util|apr-iconv)\\.*"\\/) || - ($src =~ m/^\t{\$\(INCLUDE\)}".*"\\/)) { + ($src =~ m/^\t\{\$\(INCLUDE\)\}".*"\\/)) { $verchg = -1; } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/configure new/apr-1.6.3/configure --- old/apr-1.6.2/configure 2017-06-09 14:56:21.000000000 +0200 +++ new/apr-1.6.3/configure 2017-10-18 16:50:19.000000000 +0200 @@ -18496,6 +18496,31 @@ done fi + case `($CC --version) 2>/dev/null` in + *clang-900* | *"clang version 5.0.0"*) + + if test "x$CFLAGS" = "x"; then + test "x$silent" != "xyes" && echo " setting CFLAGS to \"-Wno-error=strict-prototypes\"" + CFLAGS="-Wno-error=strict-prototypes" + else + apr_addto_bugger="-Wno-error=strict-prototypes" + for i in $apr_addto_bugger; do + apr_addto_duplicate="0" + for j in $CFLAGS; do + if test "x$i" = "x$j"; then + apr_addto_duplicate="1" + break + fi + done + if test $apr_addto_duplicate = "0"; then + test "x$silent" != "xyes" && echo " adding \"$i\" to CFLAGS" + CFLAGS="$CFLAGS $i" + fi + done + fi + + ;; + esac elif test "$AIX_XLC" = "yes"; then if test "x$CFLAGS" = "x"; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/configure.in new/apr-1.6.3/configure.in --- old/apr-1.6.2/configure.in 2017-05-24 17:21:43.000000000 +0200 +++ new/apr-1.6.3/configure.in 2017-10-03 14:55:19.000000000 +0200 @@ -346,6 +346,11 @@ [APR_ADDTO(CFLAGS,-g) if test "$GCC" = "yes"; then APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations]) + case `($CC --version) 2>/dev/null` in + *clang-900* | *"clang version 5.0.0"*) + APR_ADDTO(CFLAGS,[-Wno-error=strict-prototypes]) + ;; + esac elif test "$AIX_XLC" = "yes"; then APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro) fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/docs/pool-design.html new/apr-1.6.3/docs/pool-design.html --- old/apr-1.6.2/docs/pool-design.html 2017-04-04 15:09:00.000000000 +0200 +++ new/apr-1.6.3/docs/pool-design.html 2017-09-27 16:44:56.000000000 +0200 @@ -3,10 +3,6 @@ <title>Using APR Pools</title> </head> <body> - <div align="right"> - Last modified at [$Date: 2017-04-04 08:09:00 -0500 (Tue, 04 Apr 2017) $] - </div> - <h1>Using APR Pools</h1> <p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/file_io/unix/seek.c new/apr-1.6.3/file_io/unix/seek.c --- old/apr-1.6.2/file_io/unix/seek.c 2012-05-06 20:02:06.000000000 +0200 +++ new/apr-1.6.3/file_io/unix/seek.c 2017-06-30 22:44:56.000000000 +0200 @@ -117,6 +117,13 @@ /* Reset buffer positions for write mode */ fp->bufpos = fp->direction = fp->dataRead = 0; } + else if (fp->direction == 0) { + /* Discard the read buffer, as we are about to reposition + * ourselves to the end of file. + */ + fp->bufpos = 0; + fp->dataRead = 0; + } file_unlock(fp); if (rc) { return rc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/file_io/win32/pipe.c new/apr-1.6.3/file_io/win32/pipe.c --- old/apr-1.6.2/file_io/win32/pipe.c 2016-03-25 02:28:13.000000000 +0100 +++ new/apr-1.6.3/file_io/win32/pipe.c 2017-09-26 17:29:52.000000000 +0200 @@ -76,7 +76,7 @@ apr_int32_t blocking, apr_pool_t *p) { - return apr_file_pipe_create_pools(in, out, APR_FULL_BLOCK, p, p); + return apr_file_pipe_create_pools(in, out, blocking, p, p); } APR_DECLARE(apr_status_t) apr_file_pipe_create_pools(apr_file_t **in, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/file_io/win32/seek.c new/apr-1.6.3/file_io/win32/seek.c --- old/apr-1.6.2/file_io/win32/seek.c 2011-03-21 15:47:28.000000000 +0100 +++ new/apr-1.6.3/file_io/win32/seek.c 2017-06-30 22:44:56.000000000 +0200 @@ -161,17 +161,43 @@ LONG offhi = (LONG)(offset >> 32); DWORD rc; + if (thefile->buffered) { + if (thefile->direction == 1) { + /* Figure out what needs to be flushed. Don't flush the part + * of the write buffer that will get truncated anyway. + */ + if (offset < thefile->filePtr) { + thefile->bufpos = 0; + } + else if (offset < thefile->filePtr + (apr_off_t)thefile->bufpos) { + thefile->bufpos = offset - thefile->filePtr; + } + + if (thefile->bufpos != 0) { + rv = apr_file_flush(thefile); + if (rv != APR_SUCCESS) + return rv; + } + } + else if (thefile->direction == 0) { + /* Discard the read buffer, as we are about to reposition + * ourselves to the end of file. + */ + thefile->bufpos = 0; + thefile->dataRead = 0; + } + } + rc = SetFilePointer(thefile->filehand, offlo, &offhi, FILE_BEGIN); if (rc == 0xFFFFFFFF) if ((rv = apr_get_os_error()) != APR_SUCCESS) return rv; + thefile->filePtr = offset; + /* Don't report EOF until the next read. */ + thefile->eof_hit = 0; if (!SetEndOfFile(thefile->filehand)) return apr_get_os_error(); - if (thefile->buffered) { - return setptr(thefile, offset); - } - return APR_SUCCESS; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/include/apr_version.h new/apr-1.6.3/include/apr_version.h --- old/apr-1.6.2/include/apr_version.h 2017-06-09 14:50:03.000000000 +0200 +++ new/apr-1.6.3/include/apr_version.h 2017-10-18 16:35:49.000000000 +0200 @@ -62,14 +62,14 @@ * The Patch Level never includes API changes, simply bug fixes. * Reset to 0 when upgrading APR_MINOR_VERSION */ -#define APR_PATCH_VERSION 2 +#define APR_PATCH_VERSION 3 /** * The symbol APR_IS_DEV_VERSION is only defined for internal, * "development" copies of APR. It is undefined for released versions * of APR. */ -/* #define APR_IS_DEV_VERSION */ +/* #undef APR_IS_DEV_VERSION */ /** * Check at compile time if the APR version is at least a certain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/include/arch/unix/apr_arch_poll_private.h new/apr-1.6.3/include/arch/unix/apr_arch_poll_private.h --- old/apr-1.6.2/include/arch/unix/apr_arch_poll_private.h 2016-03-25 02:19:34.000000000 +0100 +++ new/apr-1.6.3/include/arch/unix/apr_arch_poll_private.h 2017-09-11 17:23:23.000000000 +0200 @@ -126,7 +126,7 @@ apr_file_t *wakeup_pipe[2]; apr_pollfd_t wakeup_pfd; apr_pollset_private_t *p; - apr_pollset_provider_t *provider; + const apr_pollset_provider_t *provider; }; typedef union { @@ -156,7 +156,7 @@ int fd; apr_pollcb_pset pollset; apr_pollfd_t **copyset; - apr_pollcb_provider_t *provider; + const apr_pollcb_provider_t *provider; }; struct apr_pollset_provider_t { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/network_io/unix/sockaddr.c new/apr-1.6.3/network_io/unix/sockaddr.c --- old/apr-1.6.2/network_io/unix/sockaddr.c 2014-10-27 18:50:14.000000000 +0100 +++ new/apr-1.6.3/network_io/unix/sockaddr.c 2017-09-11 17:29:46.000000000 +0200 @@ -277,19 +277,13 @@ return APR_EINVAL; } addrlen = scope_delim - str - 1; - *scope_id = apr_palloc(p, end_bracket - scope_delim); - memcpy(*scope_id, scope_delim + 1, end_bracket - scope_delim - 1); - (*scope_id)[end_bracket - scope_delim - 1] = '\0'; + *scope_id = apr_pstrmemdup(p, scope_delim, end_bracket - scope_delim - 1); } else { addrlen = addrlen - 2; /* minus 2 for '[' and ']' */ } - *addr = apr_palloc(p, addrlen + 1); - memcpy(*addr, - str + 1, - addrlen); - (*addr)[addrlen] = '\0'; + *addr = apr_pstrmemdup(p, str + 1, addrlen); if (apr_inet_pton(AF_INET6, *addr, &ipaddr) != 1) { *addr = NULL; *scope_id = NULL; @@ -303,9 +297,7 @@ /* XXX If '%' is not a valid char in a DNS name, we *could* check * for bogus scope ids first. */ - *addr = apr_palloc(p, addrlen + 1); - memcpy(*addr, str, addrlen); - (*addr)[addrlen] = '\0'; + *addr = apr_pstrmemdup(p, str, addrlen); } return APR_SUCCESS; } @@ -1062,6 +1054,10 @@ static int looks_like_ip(const char *ipstr) { + if (strlen(ipstr) == 0) { + return 0; + } + if (strchr(ipstr, ':')) { /* definitely not a hostname; assume it is intended to be an IPv6 address */ return 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/poll/unix/epoll.c new/apr-1.6.3/poll/unix/epoll.c --- old/apr-1.6.2/poll/unix/epoll.c 2016-08-10 17:06:16.000000000 +0200 +++ new/apr-1.6.3/poll/unix/epoll.c 2017-09-11 17:23:23.000000000 +0200 @@ -320,7 +320,7 @@ return rv; } -static apr_pollset_provider_t impl = { +static const apr_pollset_provider_t impl = { impl_pollset_create, impl_pollset_add, impl_pollset_remove, @@ -329,7 +329,7 @@ "epoll" }; -apr_pollset_provider_t *apr_pollset_provider_epoll = &impl; +const apr_pollset_provider_t *const apr_pollset_provider_epoll = &impl; static apr_status_t impl_pollcb_cleanup(apr_pollcb_t *pollcb) { @@ -476,7 +476,7 @@ return rv; } -static apr_pollcb_provider_t impl_cb = { +static const apr_pollcb_provider_t impl_cb = { impl_pollcb_create, impl_pollcb_add, impl_pollcb_remove, @@ -485,6 +485,6 @@ "epoll" }; -apr_pollcb_provider_t *apr_pollcb_provider_epoll = &impl_cb; +const apr_pollcb_provider_t *const apr_pollcb_provider_epoll = &impl_cb; #endif /* HAVE_EPOLL */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/poll/unix/kqueue.c new/apr-1.6.3/poll/unix/kqueue.c --- old/apr-1.6.2/poll/unix/kqueue.c 2016-08-10 17:06:16.000000000 +0200 +++ new/apr-1.6.3/poll/unix/kqueue.c 2017-09-11 17:23:23.000000000 +0200 @@ -316,7 +316,7 @@ return rv; } -static apr_pollset_provider_t impl = { +static const apr_pollset_provider_t impl = { impl_pollset_create, impl_pollset_add, impl_pollset_remove, @@ -325,7 +325,7 @@ "kqueue" }; -apr_pollset_provider_t *apr_pollset_provider_kqueue = &impl; +const apr_pollset_provider_t *apr_pollset_provider_kqueue = &impl; static apr_status_t impl_pollcb_cleanup(apr_pollcb_t *pollcb) { @@ -491,7 +491,7 @@ return rv; } -static apr_pollcb_provider_t impl_cb = { +static const apr_pollcb_provider_t impl_cb = { impl_pollcb_create, impl_pollcb_add, impl_pollcb_remove, @@ -500,6 +500,6 @@ "kqueue" }; -apr_pollcb_provider_t *apr_pollcb_provider_kqueue = &impl_cb; +const apr_pollcb_provider_t *apr_pollcb_provider_kqueue = &impl_cb; #endif /* HAVE_KQUEUE */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/poll/unix/poll.c new/apr-1.6.3/poll/unix/poll.c --- old/apr-1.6.2/poll/unix/poll.c 2016-08-10 17:06:16.000000000 +0200 +++ new/apr-1.6.3/poll/unix/poll.c 2017-09-11 17:23:23.000000000 +0200 @@ -299,7 +299,7 @@ return rv; } -static apr_pollset_provider_t impl = { +static const apr_pollset_provider_t impl = { impl_pollset_create, impl_pollset_add, impl_pollset_remove, @@ -308,7 +308,7 @@ "poll" }; -apr_pollset_provider_t *apr_pollset_provider_poll = &impl; +const apr_pollset_provider_t *apr_pollset_provider_poll = &impl; /* Poll method pollcb. * This is probably usable only for WIN32 having WSAPoll @@ -446,7 +446,7 @@ return rv; } -static apr_pollcb_provider_t impl_cb = { +static const apr_pollcb_provider_t impl_cb = { impl_pollcb_create, impl_pollcb_add, impl_pollcb_remove, @@ -455,6 +455,6 @@ "poll" }; -apr_pollcb_provider_t *apr_pollcb_provider_poll = &impl_cb; +const apr_pollcb_provider_t *apr_pollcb_provider_poll = &impl_cb; #endif /* HAVE_POLL */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/poll/unix/pollcb.c new/apr-1.6.3/poll/unix/pollcb.c --- old/apr-1.6.2/poll/unix/pollcb.c 2016-03-25 02:19:34.000000000 +0100 +++ new/apr-1.6.3/poll/unix/pollcb.c 2017-09-11 17:23:23.000000000 +0200 @@ -29,21 +29,21 @@ static apr_pollset_method_e pollset_default_method = POLLSET_DEFAULT_METHOD; #if defined(HAVE_KQUEUE) -extern apr_pollcb_provider_t *apr_pollcb_provider_kqueue; +extern const apr_pollcb_provider_t *apr_pollcb_provider_kqueue; #endif #if defined(HAVE_PORT_CREATE) -extern apr_pollcb_provider_t *apr_pollcb_provider_port; +extern const apr_pollcb_provider_t *apr_pollcb_provider_port; #endif #if defined(HAVE_EPOLL) -extern apr_pollcb_provider_t *apr_pollcb_provider_epoll; +extern const apr_pollcb_provider_t *apr_pollcb_provider_epoll; #endif #if defined(HAVE_POLL) -extern apr_pollcb_provider_t *apr_pollcb_provider_poll; +extern const apr_pollcb_provider_t *apr_pollcb_provider_poll; #endif -static apr_pollcb_provider_t *pollcb_provider(apr_pollset_method_e method) +static const apr_pollcb_provider_t *pollcb_provider(apr_pollset_method_e method) { - apr_pollcb_provider_t *provider = NULL; + const apr_pollcb_provider_t *provider = NULL; switch (method) { case APR_POLLSET_KQUEUE: #if defined(HAVE_KQUEUE) @@ -95,7 +95,7 @@ { apr_status_t rv; apr_pollcb_t *pollcb; - apr_pollcb_provider_t *provider = NULL; + const apr_pollcb_provider_t *provider = NULL; *ret_pollcb = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/poll/unix/pollset.c new/apr-1.6.3/poll/unix/pollset.c --- old/apr-1.6.2/poll/unix/pollset.c 2016-08-10 12:29:03.000000000 +0200 +++ new/apr-1.6.3/poll/unix/pollset.c 2017-09-11 17:23:23.000000000 +0200 @@ -44,25 +44,25 @@ } #if defined(HAVE_KQUEUE) -extern apr_pollset_provider_t *apr_pollset_provider_kqueue; +extern const apr_pollset_provider_t *apr_pollset_provider_kqueue; #endif #if defined(HAVE_PORT_CREATE) -extern apr_pollset_provider_t *apr_pollset_provider_port; +extern const apr_pollset_provider_t *apr_pollset_provider_port; #endif #if defined(HAVE_EPOLL) -extern apr_pollset_provider_t *apr_pollset_provider_epoll; +extern const apr_pollset_provider_t *apr_pollset_provider_epoll; #endif #if defined(HAVE_AIO_MSGQ) -extern apr_pollset_provider_t *apr_pollset_provider_aio_msgq; +extern const apr_pollset_provider_t *apr_pollset_provider_aio_msgq; #endif #if defined(HAVE_POLL) -extern apr_pollset_provider_t *apr_pollset_provider_poll; +extern const apr_pollset_provider_t *apr_pollset_provider_poll; #endif -extern apr_pollset_provider_t *apr_pollset_provider_select; +extern const apr_pollset_provider_t *apr_pollset_provider_select; -static apr_pollset_provider_t *pollset_provider(apr_pollset_method_e method) +static const apr_pollset_provider_t *pollset_provider(apr_pollset_method_e method) { - apr_pollset_provider_t *provider = NULL; + const apr_pollset_provider_t *provider = NULL; switch (method) { case APR_POLLSET_KQUEUE: #if defined(HAVE_KQUEUE) @@ -106,7 +106,7 @@ { apr_status_t rv; apr_pollset_t *pollset; - apr_pollset_provider_t *provider = NULL; + const apr_pollset_provider_t *provider = NULL; *ret_pollset = NULL; @@ -190,7 +190,7 @@ APR_DECLARE(const char *) apr_poll_method_defname() { - apr_pollset_provider_t *provider = NULL; + const apr_pollset_provider_t *provider = NULL; provider = pollset_provider(pollset_default_method); if (provider) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/poll/unix/port.c new/apr-1.6.3/poll/unix/port.c --- old/apr-1.6.2/poll/unix/port.c 2016-08-10 17:06:16.000000000 +0200 +++ new/apr-1.6.3/poll/unix/port.c 2017-09-11 17:23:23.000000000 +0200 @@ -455,7 +455,7 @@ return rv; } -static apr_pollset_provider_t impl = { +static const apr_pollset_provider_t impl = { impl_pollset_create, impl_pollset_add, impl_pollset_remove, @@ -464,7 +464,7 @@ "port" }; -apr_pollset_provider_t *apr_pollset_provider_port = &impl; +const apr_pollset_provider_t *apr_pollset_provider_port = &impl; static apr_status_t impl_pollcb_cleanup(apr_pollcb_t *pollcb) { @@ -588,7 +588,7 @@ return rv; } -static apr_pollcb_provider_t impl_cb = { +static const apr_pollcb_provider_t impl_cb = { impl_pollcb_create, impl_pollcb_add, impl_pollcb_remove, @@ -597,6 +597,6 @@ "port" }; -apr_pollcb_provider_t *apr_pollcb_provider_port = &impl_cb; +const apr_pollcb_provider_t *apr_pollcb_provider_port = &impl_cb; #endif /* HAVE_PORT_CREATE */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/poll/unix/select.c new/apr-1.6.3/poll/unix/select.c --- old/apr-1.6.2/poll/unix/select.c 2016-08-10 17:06:16.000000000 +0200 +++ new/apr-1.6.3/poll/unix/select.c 2017-09-11 17:23:23.000000000 +0200 @@ -437,7 +437,7 @@ return rv; } -static apr_pollset_provider_t impl = { +static const apr_pollset_provider_t impl = { impl_pollset_create, impl_pollset_add, impl_pollset_remove, @@ -446,4 +446,4 @@ "select" }; -apr_pollset_provider_t *apr_pollset_provider_select = &impl; +const apr_pollset_provider_t *apr_pollset_provider_select = &impl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/poll/unix/z_asio.c new/apr-1.6.3/poll/unix/z_asio.c --- old/apr-1.6.2/poll/unix/z_asio.c 2016-09-02 20:47:06.000000000 +0200 +++ new/apr-1.6.3/poll/unix/z_asio.c 2017-09-11 17:23:23.000000000 +0200 @@ -768,7 +768,7 @@ return rv; } /* end of asio_pollset_poll */ -static apr_pollset_provider_t impl = { +static const apr_pollset_provider_t impl = { asio_pollset_create, asio_pollset_add, asio_pollset_remove, @@ -777,6 +777,6 @@ "asio" }; -apr_pollset_provider_t *apr_pollset_provider_aio_msgq = &impl; +const apr_pollset_provider_t *apr_pollset_provider_aio_msgq = &impl; #endif /* HAVE_AIO_MSGQ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/test/testfile.c new/apr-1.6.3/test/testfile.c --- old/apr-1.6.2/test/testfile.c 2013-03-30 14:54:42.000000000 +0100 +++ new/apr-1.6.3/test/testfile.c 2017-06-30 23:12:31.000000000 +0200 @@ -811,6 +811,253 @@ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } +static void test_file_trunc(abts_case *tc, void *data) +{ + apr_status_t rv; + apr_file_t *f; + const char *fname = "data/testtruncate.dat"; + const char *s; + apr_size_t nbytes; + apr_finfo_t finfo; + + apr_file_remove(fname, p); + + /* Test unbuffered */ + rv = apr_file_open(&f, fname, + APR_FOPEN_CREATE | APR_FOPEN_READ | + APR_FOPEN_WRITE, + APR_FPROT_UREAD | APR_FPROT_UWRITE, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + + s = "some data"; + nbytes = strlen(s); + rv = apr_file_write(f, s, &nbytes); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); + rv = apr_file_trunc(f, 4); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_file_close(f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_ASSERT(tc, "File size mismatch, expected 4", finfo.size == 4); + + rv = apr_file_remove(fname, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + /* Test buffered */ + rv = apr_file_open(&f, fname, + APR_FOPEN_CREATE | APR_FOPEN_READ | + APR_FOPEN_WRITE | APR_FOPEN_BUFFERED, + APR_FPROT_UREAD | APR_FPROT_UWRITE, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + + nbytes = strlen(s); + rv = apr_file_write(f, s, &nbytes); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); + rv = apr_file_trunc(f, 4); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_file_close(f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_ASSERT(tc, "File size mismatch, expected 4", finfo.size == 4); + + rv = apr_file_remove(fname, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); +} + +static void test_file_trunc2(abts_case *tc, void *data) +{ + apr_status_t rv; + apr_file_t *f; + const char *fname = "data/testtruncate.dat"; + const char *s; + apr_size_t nbytes; + apr_finfo_t finfo; + char c; + + apr_file_remove(fname, p); + + rv = apr_file_open(&f, fname, + APR_FOPEN_CREATE | APR_FOPEN_READ | + APR_FOPEN_WRITE, + APR_FPROT_UREAD | APR_FPROT_UWRITE, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + + s = "some data"; + nbytes = strlen(s); + rv = apr_file_write(f, s, &nbytes); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); + rv = apr_file_trunc(f, 4); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + /* Test apr_file_info_get(). */ + rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_INT_EQUAL(tc, 4, (int)finfo.size); + /* EOF is not reported until the next read. */ + rv = apr_file_eof(f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_file_getc(&c, f); + ABTS_INT_EQUAL(tc, APR_EOF, rv); + rv = apr_file_eof(f); + ABTS_INT_EQUAL(tc, APR_EOF, rv); + + rv = apr_file_close(f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_INT_EQUAL(tc, 4, (int)finfo.size); + + rv = apr_file_remove(fname, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); +} + +static void test_file_trunc_buffered_write(abts_case *tc, void *data) +{ + apr_status_t rv; + apr_file_t *f; + const char *fname = "data/testtruncate_buffered_write.dat"; + const char *s; + apr_size_t nbytes; + apr_finfo_t finfo; + char c; + + apr_file_remove(fname, p); + + rv = apr_file_open(&f, fname, + APR_FOPEN_CREATE | APR_FOPEN_READ | + APR_FOPEN_WRITE | APR_FOPEN_BUFFERED, + APR_FPROT_UREAD | APR_FPROT_UWRITE, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + + s = "some data"; + nbytes = strlen(s); + rv = apr_file_write(f, s, &nbytes); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); + rv = apr_file_trunc(f, 4); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + /* Test apr_file_info_get(). */ + rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_INT_EQUAL(tc, 4, (int)finfo.size); + /* EOF is not reported until the next read. */ + rv = apr_file_eof(f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_file_getc(&c, f); + ABTS_INT_EQUAL(tc, APR_EOF, rv); + rv = apr_file_eof(f); + ABTS_INT_EQUAL(tc, APR_EOF, rv); + + rv = apr_file_close(f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_INT_EQUAL(tc, 4, (int)finfo.size); + + rv = apr_file_remove(fname, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); +} + +static void test_file_trunc_buffered_write2(abts_case *tc, void *data) +{ + apr_status_t rv; + apr_file_t *f; + const char *fname = "data/testtruncate_buffered_write2.dat"; + apr_finfo_t finfo; + char c; + + apr_file_remove(fname, p); + + rv = apr_file_open(&f, fname, + APR_FOPEN_CREATE | APR_FOPEN_READ | + APR_FOPEN_WRITE | APR_FOPEN_BUFFERED, + APR_FPROT_OS_DEFAULT, p); + APR_ASSERT_SUCCESS(tc, "open test file", rv); + + rv = apr_file_puts("abc", f); + APR_ASSERT_SUCCESS(tc, "write first string", rv); + rv = apr_file_flush(f); + APR_ASSERT_SUCCESS(tc, "flush", rv); + rv = apr_file_puts("def", f); + APR_ASSERT_SUCCESS(tc, "write second string", rv); + /* Truncate behind the write buffer. */ + rv = apr_file_trunc(f, 2); + APR_ASSERT_SUCCESS(tc, "truncate the file", rv); + /* Test apr_file_info_get(). */ + rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, f); + APR_ASSERT_SUCCESS(tc, "get file info", rv); + ABTS_INT_EQUAL(tc, 2, (int)finfo.size); + /* EOF is not reported until the next read. */ + rv = apr_file_eof(f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_file_getc(&c, f); + ABTS_INT_EQUAL(tc, APR_EOF, rv); + rv = apr_file_eof(f); + ABTS_INT_EQUAL(tc, APR_EOF, rv); + + apr_file_close(f); + + rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p); + APR_ASSERT_SUCCESS(tc, "stat file", rv); + ABTS_INT_EQUAL(tc, 2, (int)finfo.size); + + apr_file_remove(fname, p); +} + +static void test_file_trunc_buffered_read(abts_case *tc, void *data) +{ + apr_status_t rv; + apr_file_t *f; + const char *fname = "data/testtruncate_buffered_read.dat"; + apr_finfo_t finfo; + char c; + + apr_file_remove(fname, p); + + rv = apr_file_open(&f, fname, + APR_FOPEN_CREATE | APR_FOPEN_READ | + APR_FOPEN_WRITE, APR_FPROT_OS_DEFAULT, p); + APR_ASSERT_SUCCESS(tc, "open test file", rv); + + rv = apr_file_puts("abc", f); + APR_ASSERT_SUCCESS(tc, "write test data", rv); + apr_file_close(f); + + rv = apr_file_open(&f, fname, + APR_FOPEN_READ | APR_FOPEN_WRITE | + APR_FOPEN_BUFFERED, APR_FPROT_OS_DEFAULT, p); + APR_ASSERT_SUCCESS(tc, "re-open test file", rv); + + /* Read to fill in the buffer. */ + rv = apr_file_getc(&c, f); + APR_ASSERT_SUCCESS(tc, "read char", rv); + /* Truncate the file. */ + rv = apr_file_trunc(f, 1); + APR_ASSERT_SUCCESS(tc, "truncate the file", rv); + /* Test apr_file_info_get(). */ + rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, f); + APR_ASSERT_SUCCESS(tc, "get file info", rv); + ABTS_INT_EQUAL(tc, 1, (int)finfo.size); + /* EOF is not reported until the next read. */ + rv = apr_file_eof(f); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + rv = apr_file_getc(&c, f); + ABTS_INT_EQUAL(tc, APR_EOF, rv); + rv = apr_file_eof(f); + ABTS_INT_EQUAL(tc, APR_EOF, rv); + + apr_file_close(f); + + rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p); + APR_ASSERT_SUCCESS(tc, "stat file", rv); + ABTS_INT_EQUAL(tc, 1, (int)finfo.size); + + apr_file_remove(fname, p); +} + static void test_bigfprintf(abts_case *tc, void *data) { apr_file_t *f; @@ -1006,6 +1253,11 @@ abts_run_test(suite, test_bigread, NULL); abts_run_test(suite, test_mod_neg, NULL); abts_run_test(suite, test_truncate, NULL); + abts_run_test(suite, test_file_trunc, NULL); + abts_run_test(suite, test_file_trunc2, NULL); + abts_run_test(suite, test_file_trunc_buffered_write, NULL); + abts_run_test(suite, test_file_trunc_buffered_write2, NULL); + abts_run_test(suite, test_file_trunc_buffered_read, NULL); abts_run_test(suite, test_bigfprintf, NULL); abts_run_test(suite, test_fail_write_flush, NULL); abts_run_test(suite, test_fail_read_flush, NULL); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/test/testipsub.c new/apr-1.6.3/test/testipsub.c --- old/apr-1.6.2/test/testipsub.c 2012-12-11 13:00:26.000000000 +0100 +++ new/apr-1.6.3/test/testipsub.c 2017-09-19 10:09:32.000000000 +0200 @@ -45,6 +45,7 @@ ,{"127.0.0.1.2", NULL, APR_EBADIP} ,{"127.0.0.1.2", "8", APR_EBADIP} ,{"127", "255.0.0.0", APR_EBADIP} /* either EBADIP or EBADMASK seems fine */ + ,{"", NULL, APR_EINVAL} #if APR_HAVE_IPV6 ,{"::1", NULL, APR_SUCCESS} ,{"::1", "20", APR_SUCCESS} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/time/unix/time.c new/apr-1.6.3/time/unix/time.c --- old/apr-1.6.2/time/unix/time.c 2006-08-03 12:55:31.000000000 +0200 +++ new/apr-1.6.3/time/unix/time.c 2017-09-11 00:30:34.000000000 +0200 @@ -142,6 +142,9 @@ static const int dayoffset[12] = {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275}; + if (xt->tm_mon < 0 || xt->tm_mon >= 12) + return APR_EBADDATE; + /* shift new year to 1st March in order to make leap year calc easy */ if (xt->tm_mon < 2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/apr-1.6.2/time/win32/time.c new/apr-1.6.3/time/win32/time.c --- old/apr-1.6.2/time/win32/time.c 2012-08-11 23:04:05.000000000 +0200 +++ new/apr-1.6.3/time/win32/time.c 2017-09-11 00:30:34.000000000 +0200 @@ -54,6 +54,9 @@ static const int dayoffset[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; + if (tm->wMonth < 1 || tm->wMonth > 12) + return APR_EBADDATE; + /* Note; the caller is responsible for filling in detailed tm_usec, * tm_gmtoff and tm_isdst data when applicable. */ @@ -224,6 +227,9 @@ static const int dayoffset[12] = {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275}; + if (xt->tm_mon < 0 || xt->tm_mon >= 12) + return APR_EBADDATE; + /* shift new year to 1st March in order to make leap year calc easy */ if (xt->tm_mon < 2) ++++++ apr-visibility.patch ++++++ --- /var/tmp/diff_new_pack.BbJQPk/_old 2018-05-13 15:56:38.304779222 +0200 +++ /var/tmp/diff_new_pack.BbJQPk/_new 2018-05-13 15:56:38.304779222 +0200 @@ -1,6 +1,8 @@ ---- apr-1.5.0.orig/include/apr.h.in -+++ apr-1.5.0/include/apr.h.in -@@ -476,7 +476,7 @@ typedef apr_uint32_t apr_uin +Index: apr-1.6.3/include/apr.h.in +=================================================================== +--- apr-1.6.3.orig/include/apr.h.in ++++ apr-1.6.3/include/apr.h.in +@@ -477,7 +477,7 @@ typedef apr_uint32_t apr_uin * headers, without defining APR_DECLARE_STATIC, will prepare the code to be * linked to the dynamic library. */ @@ -9,7 +11,7 @@ /** * The public APR functions using variable arguments are declared with -@@ -489,7 +489,7 @@ typedef apr_uint32_t apr_uin +@@ -490,7 +490,7 @@ typedef apr_uint32_t apr_uin * * </PRE> */ @@ -18,7 +20,7 @@ /** * The public APR variables are declared with AP_MODULE_DECLARE_DATA. -@@ -505,7 +505,7 @@ typedef apr_uint32_t apr_uin +@@ -506,7 +506,7 @@ typedef apr_uint32_t apr_uin * * </PRE> */ @@ -27,8 +29,10 @@ #elif defined(APR_DECLARE_STATIC) #define APR_DECLARE(type) type __stdcall ---- apr-1.5.0.orig/include/apr_support.h -+++ apr-1.5.0/include/apr_support.h +Index: apr-1.6.3/include/apr_support.h +=================================================================== +--- apr-1.6.3.orig/include/apr_support.h ++++ apr-1.6.3/include/apr_support.h @@ -45,7 +45,7 @@ extern "C" { * otherwise wait for data to be able to be written. * @return APR_TIMEUP if we run out of time.
