From owner-svn-src-stable-10@freebsd.org Sun Feb 12 09:27:36 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 383E0CDC9D7; Sun, 12 Feb 2017 09:27:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1054AB5D; Sun, 12 Feb 2017 09:27:35 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1C9RZHK072191; Sun, 12 Feb 2017 09:27:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1C9RZdx072190; Sun, 12 Feb 2017 09:27:35 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702120927.v1C9RZdx072190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 12 Feb 2017 09:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313682 - stable/10/sbin/kldload X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2017 09:27:36 -0000 Author: ngie Date: Sun Feb 12 09:27:34 2017 New Revision: 313682 URL: https://svnweb.freebsd.org/changeset/base/313682 Log: MFC r313273: style(9) cleanup - Delete trailing whitespace - Fix alignment/variable sorting - Delete single-line enclosing braces Modified: stable/10/sbin/kldload/kldload.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/kldload/kldload.c ============================================================================== --- stable/10/sbin/kldload/kldload.c Sun Feb 12 09:27:27 2017 (r313681) +++ stable/10/sbin/kldload/kldload.c Sun Feb 12 09:27:34 2017 (r313682) @@ -41,9 +41,6 @@ __FBSDID("$FreeBSD$"); #define PATHCTL "kern.module_path" -static int path_check(const char *, int); -static void usage(void); - /* * Check to see if the requested module is specified as a filename with no * path. If so and if a file by the same name exists in the module path, @@ -52,43 +49,37 @@ static void usage(void); static int path_check(const char *kldname, int quiet) { - int mib[5], found; - size_t miblen, pathlen; - char kldpath[MAXPATHLEN]; char *path, *tmppath, *element; struct stat sb; + int mib[5]; + char kldpath[MAXPATHLEN]; + size_t miblen, pathlen; dev_t dev; ino_t ino; + int found; - if (strchr(kldname, '/') != NULL) { + if (strchr(kldname, '/') != NULL) return (0); - } - if (strstr(kldname, ".ko") == NULL) { + if (strstr(kldname, ".ko") == NULL) return (0); - } - if (stat(kldname, &sb) != 0) { + if (stat(kldname, &sb) != 0) return (0); - } found = 0; dev = sb.st_dev; ino = sb.st_ino; miblen = sizeof(mib) / sizeof(mib[0]); - if (sysctlnametomib(PATHCTL, mib, &miblen) != 0) { + if (sysctlnametomib(PATHCTL, mib, &miblen) != 0) err(1, "sysctlnametomib(%s)", PATHCTL); - } - if (sysctl(mib, miblen, NULL, &pathlen, NULL, 0) == -1) { + if (sysctl(mib, miblen, NULL, &pathlen, NULL, 0) == -1) err(1, "getting path: sysctl(%s) - size only", PATHCTL); - } path = malloc(pathlen + 1); - if (path == NULL) { + if (path == NULL) err(1, "allocating %lu bytes for the path", (unsigned long)pathlen + 1); - } - if (sysctl(mib, miblen, path, &pathlen, NULL, 0) == -1) { + if (sysctl(mib, miblen, path, &pathlen, NULL, 0) == -1) err(1, "getting path: sysctl(%s)", PATHCTL); - } tmppath = path; while ((element = strsep(&tmppath, ";")) != NULL) { @@ -97,39 +88,36 @@ path_check(const char *kldname, int quie strlcat(kldpath, "/", MAXPATHLEN); } strlcat(kldpath, kldname, MAXPATHLEN); - - if (stat(kldpath, &sb) == -1) { + + if (stat(kldpath, &sb) == -1) continue; - } found = 1; if (sb.st_dev != dev || sb.st_ino != ino) { - if (!quiet) { + if (!quiet) warnx("%s will be loaded from %s, not the " "current directory", kldname, element); - } break; - } else if (sb.st_dev == dev && sb.st_ino == ino) { + } else if (sb.st_dev == dev && sb.st_ino == ino) break; - } } free(path); - + if (!found) { - if (!quiet) { + if (!quiet) warnx("%s is not in the module path", kldname); - } return (-1); } - + return (0); } static void usage(void) { + fprintf(stderr, "usage: kldload [-nqv] file ...\n"); exit(1); } @@ -138,17 +126,17 @@ int main(int argc, char** argv) { int c; + int check_loaded; int errors; int fileid; - int verbose; int quiet; - int check_loaded; + int verbose; errors = 0; verbose = 0; quiet = 0; check_loaded = 0; - + while ((c = getopt(argc, argv, "nqv")) != -1) { switch (c) { case 'q': @@ -204,9 +192,8 @@ main(int argc, char** argv) printf("Loaded %s, id=%d\n", argv[0], fileid); } - } else { + } else errors++; - } argv++; } From owner-svn-src-stable-10@freebsd.org Sun Feb 12 18:52:03 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12790CDCC73; Sun, 12 Feb 2017 18:52:03 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6B4F17E9; Sun, 12 Feb 2017 18:52:02 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1CIq1Bx002858; Sun, 12 Feb 2017 18:52:01 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1CIq1Ur002671; Sun, 12 Feb 2017 18:52:01 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201702121852.v1CIq1Ur002671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 12 Feb 2017 18:52:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313685 - in stable/10: lib/libc/sys share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Feb 2017 18:52:03 -0000 Author: jilles Date: Sun Feb 12 18:52:01 2017 New Revision: 313685 URL: https://svnweb.freebsd.org/changeset/base/313685 Log: MFC r313174: Clean up documentation of AF_UNIX control messages. Document AF_UNIX control messages in unix(4) only, not split between unix(4) and recv(2). Also, warn about LOCAL_CREDS effective uid/gid fields, since the write could be from a setuid or setgid program (with the explicit SCM_CREDS and LOCAL_PEERCRED, the credentials are read at such a time that it can be assumed that the process intends for them to be used in this context). Modified: stable/10/lib/libc/sys/recv.2 stable/10/share/man/man4/unix.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/sys/recv.2 ============================================================================== --- stable/10/lib/libc/sys/recv.2 Sun Feb 12 15:22:50 2017 (r313684) +++ stable/10/lib/libc/sys/recv.2 Sun Feb 12 18:52:01 2017 (r313685) @@ -28,7 +28,7 @@ .\" @(#)recv.2 8.3 (Berkeley) 2/21/94 .\" $FreeBSD$ .\" -.Dd March 19, 2013 +.Dd February 3, 2017 .Dt RECV 2 .Os .Sh NAME @@ -218,57 +218,10 @@ with no data buffer provided immediately .Fn accept system call. .Pp -Open file descriptors are now passed as ancillary data for +With .Dv AF_UNIX -domain sockets, with -.Fa cmsg_level -set to -.Dv SOL_SOCKET -and -.Fa cmsg_type -set to -.Dv SCM_RIGHTS . -The close-on-exec flag on received descriptors is set according to the -.Dv MSG_CMSG_CLOEXEC -flag passed to -.Fn recvmsg . -.Pp -Process credentials can also be passed as ancillary data for -.Dv AF_UNIX -domain sockets using a -.Fa cmsg_type -of -.Dv SCM_CREDS . -In this case, -.Fa cmsg_data -should be a structure of type -.Fa cmsgcred , -which is defined in -.In sys/socket.h -as follows: -.Bd -literal -struct cmsgcred { - pid_t cmcred_pid; /* PID of sending process */ - uid_t cmcred_uid; /* real UID of sending process */ - uid_t cmcred_euid; /* effective UID of sending process */ - gid_t cmcred_gid; /* real GID of sending process */ - short cmcred_ngroups; /* number or groups */ - gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ -}; -.Ed -.Pp -If a sender supplies ancillary data with enough space for the above struct -tagged as -.Dv SCM_CREDS -control message type to the -.Fn sendmsg -system call, then kernel will fill in the credential information of the -sending process and deliver it to the receiver. -Since receiver usually has no control over a sender, this method of retrieving -credential information isn't reliable. -For reliable retrieval of remote side credentials it is advised to use the -.Dv LOCAL_CREDS -socket option on the receiving socket. +domain sockets, ancillary data can be used to pass file descriptors and +process credentials. See .Xr unix 4 for details. Modified: stable/10/share/man/man4/unix.4 ============================================================================== --- stable/10/share/man/man4/unix.4 Sun Feb 12 15:22:50 2017 (r313684) +++ stable/10/share/man/man4/unix.4 Sun Feb 12 18:52:01 2017 (r313685) @@ -32,7 +32,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd March 19, 2013 +.Dd February 3, 2017 .Dt UNIX 4 .Os .Sh NAME @@ -123,12 +123,12 @@ of a or .Xr sendto 2 must be writable. -.Sh PASSING FILE DESCRIPTORS +.Sh CONTROL MESSAGES The .Ux Ns -domain sockets support the communication of .Ux -file descriptors through the use of the +file descriptors and process credentials through the use of the .Va msg_control field in the .Fa msg @@ -136,13 +136,12 @@ argument to .Xr sendmsg 2 and .Xr recvmsg 2 . -.Pp -Any valid descriptor may be sent in a message. -The file descriptor(s) to be passed are described using a +The items to be passed are described using a .Vt "struct cmsghdr" that is defined in the include file .In sys/socket.h . -The type of the message is +.Pp +To send file descriptors, the type of the message is .Dv SCM_RIGHTS , and the data portion of the messages is an array of integers representing the file descriptors to be passed. @@ -165,6 +164,39 @@ call. Descriptors that are awaiting delivery, or that are purposely not received, are automatically closed by the system when the destination socket is closed. +.Pp +Credentials of the sending process can be transmitted explicitly using a +control message of type +.Dv SCM_CREDS +with a data portion of type +.Vt "struct cmsgcred" , +defined in +.In sys/socket.h +as follows: +.Bd -literal +struct cmsgcred { + pid_t cmcred_pid; /* PID of sending process */ + uid_t cmcred_uid; /* real UID of sending process */ + uid_t cmcred_euid; /* effective UID of sending process */ + gid_t cmcred_gid; /* real GID of sending process */ + short cmcred_ngroups; /* number of groups */ + gid_t cmcred_groups[CMGROUP_MAX]; /* groups */ +}; +.Ed +.Pp +The sender should pass a zeroed buffer which will be filled in by the system. +.Pp +The group list is truncated to at most +.Dv CMGROUP_MAX +GIDs. +.Pp +The process ID +.Fa cmcred_pid +should not be looked up (such as via the +.Dv KERN_PROC_PID +sysctl) for making security decisions. +The sending process could have exited and its process ID already been +reused for a new process. .Sh SOCKET OPTIONS .Tn UNIX domain sockets support a number of socket options which can be set with @@ -180,7 +212,13 @@ or a .Dv SOCK_STREAM socket. This option provides a mechanism for the receiver to -receive the credentials of the process as a +receive the credentials of the process calling +.Xr write 2 , +.Xr send 2 , +.Xr sendto 2 +or +.Xr sendmsg 2 +as a .Xr recvmsg 2 control message. The @@ -205,6 +243,10 @@ struct sockcred { }; .Ed .Pp +The current implementation truncates the group list to at most +.Dv CMGROUP_MAX +groups. +.Pp The .Fn SOCKCREDSIZE macro computes the size of the @@ -225,7 +267,28 @@ On and .Dv SOCK_SEQPACKET sockets credentials are passed only on the first read from a socket, -then system clears the option on socket. +then the system clears the option on the socket. +.Pp +This option and the above explicit +.Vt "struct cmsgcred" +both use the same value +.Dv SCM_CREDS +but incompatible control messages. +If this option is enabled and the sender attached a +.Dv SCM_CREDS +control message with a +.Vt "struct cmsgcred" , +it will be discarded and a +.Vt "struct sockcred" +will be included. +.Pp +Many setuid programs will +.Xr write 2 +data at least partially controlled by the invoker, +such as error messages. +Therefore, a message accompanied by a particular +.Fa sc_euid +value should not be trusted as being from that user. .It Dv LOCAL_CONNWAIT Used with .Dv SOCK_STREAM From owner-svn-src-stable-10@freebsd.org Mon Feb 13 08:23:02 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C351FCDC66A for ; Mon, 13 Feb 2017 08:23:02 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yb0-x231.google.com (mail-yb0-x231.google.com [IPv6:2607:f8b0:4002:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B27C1860 for ; Mon, 13 Feb 2017 08:23:02 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yb0-x231.google.com with SMTP id w194so25298338ybe.0 for ; Mon, 13 Feb 2017 00:23:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Hp2GqAOQlmbHgvXNgMws9a7QpSv/vIQ62jVxr5JZFfs=; b=sr6Wi055xmnHJ9zkCJWNp2LCGdh/qoQLmrJ7Dg+Ew43VDQum80Oncg6tre4lsslEMx 2HPS6btbSLx8aAgH0TDedcOSM822kEUDc3CWL6MJkioNMKznvgi5Y2PHT9Khx6cUO0qN UC2HkiwHYV7aCQ0QxmgVj3MnFOD/OqzD739qZqgKDKsDD3GDdtcO9GMRNFu3e5nvaftQ FXE3e96ZHgMYX5yPzqlNfVV+CPPTvyrbPcqp7r13O1r1czxXqHAasMqLgks8tK7z8mjy 5f0aDGti3uzkJFtsSwlfSX4iadQM8Md65Dd/C0mSZ9KBx5uicck3dPnRGj0HAelFi6Bf A7Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Hp2GqAOQlmbHgvXNgMws9a7QpSv/vIQ62jVxr5JZFfs=; b=JImgaSs92aH35iHUWdYj3bpOtAS4oevWmZw9HC/DriKLjta2fTKsoVMlpldb+rQF5k ArvU3WH9PUOSxBIof3Tj3ETN3m/i9Pja5p37ncddgvmaI04p3aNiU3b4kajMaGbyKB4u JsuwEL5Lklkq6u5xDcacV3JKPriYAbHfCxhPYj7SDqcOQh1nQQ5KZeDqSa6VsHOyodzK l7DxwQ+oDeaw6HVZX287yiLx66hIDhRW8MfnaMoZE6RMOzcV8zu14eI8sEGBB8bljWv8 544Zjo6DBFtc/cGzURqMB6877pboguguKtiQ60r7fNMQGVGxgQLEbpmE9qibwC2CiGK7 puqg== X-Gm-Message-State: AMke39n6y89Y2i31eflmbG4+fILHrx2PxVhC7d0e2HF2PUZeqyQxHogoV33WlimBdB9OmZWyTx7UUyXh+QEPTw== X-Received: by 10.37.104.73 with SMTP id d70mr16159588ybc.148.1486974181153; Mon, 13 Feb 2017 00:23:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.52.76 with HTTP; Mon, 13 Feb 2017 00:22:30 -0800 (PST) In-Reply-To: <65538136-4b19-bc06-f3e0-302ef2fc2359@vangyzen.net> References: <201702110735.v1B7ZROH028648@repo.freebsd.org> <65538136-4b19-bc06-f3e0-302ef2fc2359@vangyzen.net> From: Ed Schouten Date: Mon, 13 Feb 2017 09:22:30 +0100 Message-ID: Subject: Re: svn commit: r313632 - in stable/10/contrib/netbsd-tests/lib/libc/gen: . posix_spawn To: Eric van Gyzen Cc: Ngie Cooper , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2017 08:23:02 -0000 2017-02-11 15:28 GMT+01:00 Eric van Gyzen : > I would be concerned that app developers would read this definition, ignore > the one in the man page, and use the __-prefixed types in their apps. I think that's a concern that's not specific to the change at hand, as that's simply how BSD header files work. Take a look at the declaration of kill() in our copy of : int kill(__pid_t, int); This is simply the construct that the BSDs use to depend on a type without exposing it. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717 From owner-svn-src-stable-10@freebsd.org Mon Feb 13 15:16:25 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80E0ACDDB7E; Mon, 13 Feb 2017 15:16:25 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) by mx1.freebsd.org (Postfix) with ESMTP id 68D491E9C; Mon, 13 Feb 2017 15:16:25 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 844FD564DF; Mon, 13 Feb 2017 09:16:24 -0600 (CST) Subject: Re: svn commit: r313632 - in stable/10/contrib/netbsd-tests/lib/libc/gen: . posix_spawn To: Ed Schouten References: <201702110735.v1B7ZROH028648@repo.freebsd.org> <65538136-4b19-bc06-f3e0-302ef2fc2359@vangyzen.net> Cc: Ngie Cooper , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org From: Eric van Gyzen Message-ID: Date: Mon, 13 Feb 2017 09:16:20 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2017 15:16:25 -0000 On 02/13/2017 02:22, Ed Schouten wrote: > 2017-02-11 15:28 GMT+01:00 Eric van Gyzen : >> I would be concerned that app developers would read this definition, ignore >> the one in the man page, and use the __-prefixed types in their apps. > > I think that's a concern that's not specific to the change at hand, as > that's simply how BSD header files work. Take a look at the > declaration of kill() in our copy of : > > int kill(__pid_t, int); > > This is simply the construct that the BSDs use to depend on a type > without exposing it. Note that we [usually] expose that type earlier in that same file: #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif #endif Apparently, signal.h should not expose pid_t in a strict pre-2001 POSIX environment. Without this restriction, the prototype for kill() would probably use pid_t, as is done in several other files, such as spawn.h: #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED #endif int posix_spawn(pid_t * __restrict, const char * __restrict, ... Let me be clear: Your change is useful and good, and I think you should commit it. I would suggest using the above construct for the __-prefixed types, but it's only a suggestion. Cheers, Eric From owner-svn-src-stable-10@freebsd.org Mon Feb 13 16:11:39 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38DAFCDDFE1; Mon, 13 Feb 2017 16:11:39 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB10CD37; Mon, 13 Feb 2017 16:11:38 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1DGBcnd024466; Mon, 13 Feb 2017 16:11:38 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1DGBbfe024465; Mon, 13 Feb 2017 16:11:37 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201702131611.v1DGBbfe024465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 13 Feb 2017 16:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313700 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2017 16:11:39 -0000 Author: ken Date: Mon Feb 13 16:11:37 2017 New Revision: 313700 URL: https://svnweb.freebsd.org/changeset/base/313700 Log: MFC r313568: ------------------------------------------------------------------------ r313568 | ken | 2017-02-10 15:02:45 -0700 (Fri, 10 Feb 2017) | 68 lines Change the isp(4) driver to not adjust the tag type for REQUEST SENSE. The isp(4) driver was changing the tag type for REQUEST SENSE commands to Head of Queue, when the CAM CCB flag CAM_TAG_ACTION_VALID was NOT set. CAM_TAG_ACTION_VALID is set when the tag action in the XPT_SCSI_IO is not CAM_TAG_ACTION_NONE and when the target has tagged queueing turned on. In most cases when CAM_TAG_ACTION_VALID is not set, it is because the target is not doing tagged queueing. In those cases, trying to send a Head of Queue tag may cause problems. Instead, default to sending a simple tag. IBM tape drives claim to support tagged queueing in their standard Inquiry data, but have the DQue bit set in the control mode page (mode page 10). CAM correctly detects that these drives do not support tagged queueing, and clears the CAM_TAG_ACTION_VALID flag on CCBs sent down to the drives. This caused the isp(4) driver to go down the path of setting the tag action to a default value, and for Request Sense commands only, set the tag action to Head of Queue. If an IBM tape drive does get a Head of Queue tag, it rejects it with Invalid Message Error (0x49,0x00). (The Qlogic firmware translates that to a Transport Error, which the driver translates to an Unrecoverable HBA Error, or CAM_UNREC_HBA_ERROR.) So, by default, it wasn't possible to get a good response from a REQUEST SENSE to an FC-attached IBM tape drive with the isp(4) driver. IBM tape drives (tested on an LTO-5 with G9N1 firmware and a TS1150 with 4470 firmware) also have a bug in that sending a command with a non-simple tag attribute breaks the tape drive's Command Reference Number (CRN) accounting and causes it to ignore all subsequent commands because it and the initiator disagree about the next expected CRN. The drives do reject the initial command with a head of queue tag with an Invalid Message Error (0x49,0x00), but after that they ignore any subsequent commands. IBM confirmed that it is a bug, and sent me test firmware that fixes the bug. However tape drives in the field will still exhibit the bug until they are upgraded. Request Sense is not often sent to targets because most errors are reported automatically through autosense in Fibre Channel and other modern transports. ("Modern" meaning post SCSI-2.) So this is not an error that would crop up frequently. But Request Sense is useful on tape devices to report status information, aside from error reporting. This problem is less serious without FC-Tape features turned on, specifically precise delivery of commands (which enables Command Reference Numbers), enabled on the target and initiator. Without FC-Tape features turned on, the target would return an error and things would continue on. And it also does not cause problems for targets that do tagged queueing, because in those cases the isp(4) driver just uses the tag type that is specified in the CCB, assuming the CAM_TAG_ACTION_VALID flag is set, and defaults to sending a Simple tag action if it isn't an ordered or head of queue tag. sys/dev/isp/isp.c: In isp_start(), don't try to send Request Sense commands with the Head of Queue tag attribute if the CCB doesn't have a valid tag action. The tag action likely isn't valid because the target doesn't support tagged queueing. Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/10/sys/dev/isp/isp.c Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Mon Feb 13 16:06:38 2017 (r313699) +++ stable/10/sys/dev/isp/isp.c Mon Feb 13 16:11:37 2017 (r313700) @@ -4451,11 +4451,7 @@ isp_start(XS_T *xs) if (XS_TAG_P(xs)) { ttype = XS_TAG_TYPE(xs); } else { - if (XS_CDBP(xs)[0] == 0x3) { - ttype = REQFLAG_HTAG; - } else { - ttype = REQFLAG_STAG; - } + ttype = REQFLAG_STAG; } if (ttype == REQFLAG_OTAG) { ttype = FCP_CMND_TASK_ATTR_ORDERED; @@ -4479,14 +4475,7 @@ isp_start(XS_T *xs) if (XS_TAG_P(xs)) { ((ispreqt2_t *)reqp)->req_flags = XS_TAG_TYPE(xs); } else { - /* - * If we don't know what tag to use, use HEAD OF QUEUE - * for Request Sense or Simple. - */ - if (XS_CDBP(xs)[0] == 0x3) /* REQUEST SENSE */ - ((ispreqt2_t *)reqp)->req_flags = REQFLAG_HTAG; - else - ((ispreqt2_t *)reqp)->req_flags = REQFLAG_STAG; + ((ispreqt2_t *)reqp)->req_flags = REQFLAG_STAG; } } else { sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); From owner-svn-src-stable-10@freebsd.org Mon Feb 13 19:27:52 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFF37CDDBC3; Mon, 13 Feb 2017 19:27:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C9D9DEB; Mon, 13 Feb 2017 19:27:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x244.google.com with SMTP id e1so16333798qkh.1; Mon, 13 Feb 2017 11:27:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WIL88ibV6n+GPJj2AVdVemh6ttknSuyItS95uF8icX8=; b=ndOvkhNfH//duaXnAyHHSM3/XczS6yVP36HBUmxXhNIdo+t5NzmbDD8a+jFKJWXm6P aTyK6zI/SQcmW7lw+e1R7n2E+JzFj/oNCHUhIUWw1YGLt8HFrRRotdNMAD3kHn5qZ0RG BAS5l+0a4rQIIMet5qWdJx8YE5iMsIZ18gwukEdd1aEAiq/DJGFCcSak4wpFKj2qDS2/ HVoXCno5mJDbdi9lcSanAqgnoZo/akaO9+eY0hjQQnssmb+CQVPU9CfIpF8i4L41r5Cr f1hBj3jEIXMLaNnenrtLOpBUQNERxjVWSr2/kDS+HyGt67kvHw2M/pado8mgujhce7VZ EAlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WIL88ibV6n+GPJj2AVdVemh6ttknSuyItS95uF8icX8=; b=o6SS7sQBwpRIrUehhm4YA8e5vN07M0m2xSNqnQiRHG7E3LoAXkk76auw1cJlCVrdkV WMa3ShsSeJ80wQeUhjI5ZPk2DMl77N2iGfLbttv2rsJmVKIyA84hMPFa1F0fvxk5DN9P PZp8m6ZL+wUYN2zRxehu9JSftT8ikW6gkvdzYAlanl/5G3aDEN4naByfTEwEXXEA6Iyz 6Tw6ulu9Jg+4E3AB+dhYWGGVcNFTML8DWMZKQBzoA9yA20ndxAb3J4ceYe5skGYH7VW0 6bL1C3+ox8eDIlhKCQDzFfMUFvpMOpv0S1Inq5rxvSYHRWtjBuzVb7jnoC7Ay3YYrd9R zgwg== X-Gm-Message-State: AMke39naH51XRQHbC2emgurjEeRbcd4C3YHkDGTDF5+oXXAauy+5nRBBC8KTKrvdp6EyIYp1FGVDivd0pEKLhA== X-Received: by 10.55.22.74 with SMTP id g71mr7724032qkh.40.1487014071600; Mon, 13 Feb 2017 11:27:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.84.230 with HTTP; Mon, 13 Feb 2017 11:27:51 -0800 (PST) In-Reply-To: References: <201702110735.v1B7ZROH028648@repo.freebsd.org> From: Ngie Cooper Date: Mon, 13 Feb 2017 11:27:51 -0800 Message-ID: Subject: Re: svn commit: r313632 - in stable/10/contrib/netbsd-tests/lib/libc/gen: . posix_spawn To: Ed Schouten Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2017 19:27:52 -0000 On Sat, Feb 11, 2017 at 1:12 AM, Ed Schouten wrote: > 2017-02-11 8:35 GMT+01:00 Ngie Cooper : >> Note that sys/types.h is required on FreeBSD for kqueue(2), unlike NetBSD > > Which is a bug on its own in my opinion. What do you think of this patch? I don't mind the intent of your proposed change.. it's just that it's documented as necessary already in the manpage... so *meh*. I've hacked around this in libnetbsd, so I'm not sure if it makes sense to deviate from previous behavior. I was just backporting this change because it diff reduces with what I introduced later. Thanks! -Ngie From owner-svn-src-stable-10@freebsd.org Tue Feb 14 04:38:38 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64ACFCDD66B; Tue, 14 Feb 2017 04:38:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33D2A1302; Tue, 14 Feb 2017 04:38:38 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1E4cbpN033400; Tue, 14 Feb 2017 04:38:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1E4cb6A033399; Tue, 14 Feb 2017 04:38:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702140438.v1E4cb6A033399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 14 Feb 2017 04:38:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313716 - stable/10/usr.sbin/syslogd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 04:38:38 -0000 Author: ngie Date: Tue Feb 14 04:38:37 2017 New Revision: 313716 URL: https://svnweb.freebsd.org/changeset/base/313716 Log: MFC r313358,r313360: r313358: Sort sys/ #includes and zap an unnecessary trailing space nearby r313360: Sort sys/ #includes some more Modified: stable/10/usr.sbin/syslogd/syslogd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/10/usr.sbin/syslogd/syslogd.c Tue Feb 14 03:32:37 2017 (r313715) +++ stable/10/usr.sbin/syslogd/syslogd.c Tue Feb 14 04:38:37 2017 (r313716) @@ -79,15 +79,15 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include #include -#include -#include -#include #include +#include +#include #include +#include +#include +#include +#include #include #include From owner-svn-src-stable-10@freebsd.org Tue Feb 14 04:42:48 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C205CDD9B2; Tue, 14 Feb 2017 04:42:48 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B39418EA; Tue, 14 Feb 2017 04:42:48 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1E4glm6037234; Tue, 14 Feb 2017 04:42:47 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1E4gloZ037233; Tue, 14 Feb 2017 04:42:47 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702140442.v1E4gloZ037233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 14 Feb 2017 04:42:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313718 - stable/10/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 04:42:48 -0000 Author: ngie Date: Tue Feb 14 04:42:47 2017 New Revision: 313718 URL: https://svnweb.freebsd.org/changeset/base/313718 Log: MFC r313377: Expect :floatunditf to fail on FreeBSD/i386 The precision error on FreeBSD/i386 doesn't match the expected output in long double form. Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_floatunditf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_floatunditf.c ============================================================================== --- stable/10/contrib/netbsd-tests/lib/libc/gen/t_floatunditf.c Tue Feb 14 04:38:39 2017 (r313717) +++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_floatunditf.c Tue Feb 14 04:42:47 2017 (r313718) @@ -119,6 +119,11 @@ ATF_TC_BODY(floatunditf, tc) #else size_t i; +#if defined(__FreeBSD__) && defined(__i386__) + atf_tc_expect_fail("the floating point error on FreeBSD/i386 doesn't " + "match the expected floating point error on NetBSD"); +#endif + for (i = 0; i < __arraycount(testcases); ++i) ATF_CHECK_MSG( testcases[i].ld == (long double)testcases[i].u64, From owner-svn-src-stable-10@freebsd.org Tue Feb 14 04:46:21 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 276DACDDC5D; Tue, 14 Feb 2017 04:46:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFA041C36; Tue, 14 Feb 2017 04:46:20 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1E4kJvS037560; Tue, 14 Feb 2017 04:46:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1E4kJPH037559; Tue, 14 Feb 2017 04:46:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702140446.v1E4kJPH037559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 14 Feb 2017 04:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313720 - stable/10/lib/libc/tests/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 04:46:21 -0000 Author: ngie Date: Tue Feb 14 04:46:19 2017 New Revision: 313720 URL: https://svnweb.freebsd.org/changeset/base/313720 Log: MFC r313376: Fix :hexadecimal_floating_point on i386 Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in that case. While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2 reasons: - Gather as many results as possible instead of failing early and not testing the rest of the cases. - Simplify logic when checking test inputs vs outputs and printing test result. Tested on: amd64, i386 Modified: stable/10/lib/libc/tests/stdio/printfloat_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/tests/stdio/printfloat_test.c ============================================================================== --- stable/10/lib/libc/tests/stdio/printfloat_test.c Tue Feb 14 04:43:03 2017 (r313719) +++ stable/10/lib/libc/tests/stdio/printfloat_test.c Tue Feb 14 04:46:19 2017 (r313720) @@ -70,22 +70,19 @@ _testfmt(const char *result, const char va_copy(ap2, ap); smash_stack(); vsnprintf(s, sizeof(s), fmt, ap); - if (strcmp(result, s) != 0) { - atf_tc_fail( - "printf(\"%s\", %s) ==> [%s], expected [%s]", - fmt, argstr, s, result); - } + ATF_CHECK_MSG(strcmp(result, s) == 0, + "printf(\"%s\", %s) ==> [%s], expected [%s]", + fmt, argstr, s, result); smash_stack(); mbstowcs(ws, s, BUF - 1); mbstowcs(wfmt, fmt, BUF - 1); mbstowcs(wresult, result, BUF - 1); vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2); - if (wcscmp(wresult, ws) != 0) { - atf_tc_fail( - "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", - wfmt, argstr, ws, wresult); - } + ATF_CHECK_MSG(wcscmp(wresult, ws) == 0, + "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", + wfmt, argstr, ws, wresult); + va_end(ap); va_end(ap2); } @@ -318,7 +315,7 @@ ATF_TC_BODY(hexadecimal_floating_point, testfmt("0x1p-1074", "%a", 0x1p-1074); testfmt("0x1.2345p-1024", "%a", 0x1.2345p-1024); -#if (LDBL_MANT_DIG == 64) && !defined(__i386__) +#if (LDBL_MANT_DIG == 64) testfmt("0x1.921fb54442d18468p+1", "%La", 0x3.243f6a8885a308dp0L); testfmt("0x1p-16445", "%La", 0x1p-16445L); testfmt("0x1.30ecap-16381", "%La", 0x9.8765p-16384L); From owner-svn-src-stable-10@freebsd.org Tue Feb 14 04:49:25 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B17C4CDDE9D; Tue, 14 Feb 2017 04:49:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66B411011; Tue, 14 Feb 2017 04:49:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1E4nO4m037914; Tue, 14 Feb 2017 04:49:24 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1E4nOM0037913; Tue, 14 Feb 2017 04:49:24 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702140449.v1E4nOM0037913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 14 Feb 2017 04:49:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313723 - stable/10/lib/libc/tests/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 04:49:25 -0000 Author: ngie Date: Tue Feb 14 04:49:24 2017 New Revision: 313723 URL: https://svnweb.freebsd.org/changeset/base/313723 Log: MFC r313378,r313379: r313378: Wrap strcmp/wcscmp calls with ATF_CHECK_MSG and drop atf_tc_fail use The reasoning here was the same as what was done in r313376: - Gather as many results as possible instead of failing early and not testing the rest of the cases. - Simplify logic when checking test inputs vs outputs and printing test result. r313379: Expect :int_within_limits to fail when ptrdiff_t/*intmax_t differ in base type The %t{d,u} (ptrdiff_t) tests fail for the following reasons: - ptrdiff_t is by definition int32_t on !LP64 architectures and int64_t on LP64 architectures. - intmax_t is by definition fixed to int64_t on all architectures. - Some of the code in lib/libc/stdio/... is promoting ptrdiff_t to *intmax_t when parsing/representing the value. PR: 191674 Modified: stable/10/lib/libc/tests/stdio/printbasic_test.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/tests/stdio/printbasic_test.c ============================================================================== --- stable/10/lib/libc/tests/stdio/printbasic_test.c Tue Feb 14 04:49:06 2017 (r313722) +++ stable/10/lib/libc/tests/stdio/printbasic_test.c Tue Feb 14 04:49:24 2017 (r313723) @@ -78,22 +78,19 @@ _testfmt(const char *result, const char va_copy(ap2, ap); smash_stack(); vsnprintf(s, sizeof(s), fmt, ap); - if (strcmp(result, s) != 0) { - atf_tc_fail( - "printf(\"%s\", %s) ==> [%s], expected [%s]", - fmt, argstr, s, result); - } + ATF_CHECK_MSG(strcmp(result, s) == 0, + "printf(\"%s\", %s) ==> [%s], expected [%s]", + fmt, argstr, s, result); smash_stack(); mbstowcs(ws, s, BUF - 1); mbstowcs(wfmt, fmt, BUF - 1); mbstowcs(wresult, result, BUF - 1); vswprintf(ws, sizeof(ws) / sizeof(ws[0]), wfmt, ap2); - if (wcscmp(wresult, ws) != 0) { - atf_tc_fail( - "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", - wfmt, argstr, ws, wresult); - } + ATF_CHECK_MSG(wcscmp(wresult, ws) == 0, + "wprintf(\"%ls\", %s) ==> [%ls], expected [%ls]", + wfmt, argstr, ws, wresult); + va_end(ap); va_end(ap2); } @@ -114,6 +111,11 @@ ATF_TC_BODY(int_within_limits, tc) testfmt("-1", "%jd", (intmax_t)-1); testfmt(S_UINT64MAX, "%ju", UINT64_MAX); + if (sizeof(ptrdiff_t) != sizeof(uintmax_t)) + atf_tc_expect_fail("the %%t qualifier is broken on 32-bit " + "platforms where there's a mismatch between ptrdiff_t and " + "uintmax_t's type width; bug # 191674"); + testfmt("-1", "%td", (ptrdiff_t)-1); testfmt(S_SIZEMAX, "%tu", (size_t)-1); From owner-svn-src-stable-10@freebsd.org Tue Feb 14 04:52:26 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54A2ACDE3DA; Tue, 14 Feb 2017 04:52:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 206231818; Tue, 14 Feb 2017 04:52:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1E4qP26042193; Tue, 14 Feb 2017 04:52:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1E4qPmU042191; Tue, 14 Feb 2017 04:52:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702140452.v1E4qPmU042191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 14 Feb 2017 04:52:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313726 - in stable/10: sys/netpfil/ipfw usr.sbin/syslogd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 04:52:26 -0000 Author: ngie Date: Tue Feb 14 04:52:24 2017 New Revision: 313726 URL: https://svnweb.freebsd.org/changeset/base/313726 Log: MFC r313356: Fix typos in comments (returing -> returning) Modified: stable/10/sys/netpfil/ipfw/dn_heap.h stable/10/usr.sbin/syslogd/syslogd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/ipfw/dn_heap.h ============================================================================== --- stable/10/sys/netpfil/ipfw/dn_heap.h Tue Feb 14 04:52:16 2017 (r313725) +++ stable/10/sys/netpfil/ipfw/dn_heap.h Tue Feb 14 04:52:24 2017 (r313726) @@ -85,7 +85,7 @@ enum { * HEAP_TOP() returns a pointer to the top element of the heap, * but makes no checks on its existance (XXX should we change ?) * - * heap_extract() removes the entry at the top, returing the pointer. + * heap_extract() removes the entry at the top, returning the pointer. * (the key should have been read before). * * heap_scan() invokes a callback on each entry of the heap. Modified: stable/10/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/10/usr.sbin/syslogd/syslogd.c Tue Feb 14 04:52:16 2017 (r313725) +++ stable/10/usr.sbin/syslogd/syslogd.c Tue Feb 14 04:52:24 2017 (r313726) @@ -2129,7 +2129,7 @@ markit(void) /* * fork off and become a daemon, but wait for the child to come online - * before returing to the parent, or we get disk thrashing at boot etc. + * before returning to the parent, or we get disk thrashing at boot etc. * Set a timer so we don't hang forever if it wedges. */ static int From owner-svn-src-stable-10@freebsd.org Tue Feb 14 13:45:40 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04AE1CDE74E; Tue, 14 Feb 2017 13:45:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BED7911C7; Tue, 14 Feb 2017 13:45:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1EDjcB2061185; Tue, 14 Feb 2017 13:45:38 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1EDjcss061184; Tue, 14 Feb 2017 13:45:38 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201702141345.v1EDjcss061184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 14 Feb 2017 13:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313729 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 13:45:40 -0000 Author: avg Date: Tue Feb 14 13:45:38 2017 New Revision: 313729 URL: https://svnweb.freebsd.org/changeset/base/313729 Log: MFC r312991: put very expensive sanity checks of advisory locks under DIAGNOSTIC Sponsored by: Panzura Modified: stable/10/sys/kern/kern_lockf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_lockf.c ============================================================================== --- stable/10/sys/kern/kern_lockf.c Tue Feb 14 13:45:20 2017 (r313728) +++ stable/10/sys/kern/kern_lockf.c Tue Feb 14 13:45:38 2017 (r313729) @@ -687,7 +687,7 @@ retry_setlock: break; } -#ifdef INVARIANTS +#ifdef DIAGNOSTIC /* * Check for some can't happen stuff. In this case, the active * lock list becoming disordered or containing mutually @@ -915,7 +915,7 @@ lf_add_edge(struct lockf_entry *x, struc struct lockf_edge *e; int error; -#ifdef INVARIANTS +#ifdef DIAGNOSTIC LIST_FOREACH(e, &x->lf_outedges, le_outlink) KASSERT(e->le_to != y, ("adding lock edge twice")); #endif From owner-svn-src-stable-10@freebsd.org Tue Feb 14 21:02:28 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C445ECDF9D0; Tue, 14 Feb 2017 21:02:28 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9397611EC; Tue, 14 Feb 2017 21:02:28 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1EL2Rbd047402; Tue, 14 Feb 2017 21:02:27 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1EL2R5Y047398; Tue, 14 Feb 2017 21:02:27 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201702142102.v1EL2R5Y047398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 14 Feb 2017 21:02:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313743 - stable/10/etc/mtree X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2017 21:02:28 -0000 Author: asomers Date: Tue Feb 14 21:02:27 2017 New Revision: 313743 URL: https://svnweb.freebsd.org/changeset/base/313743 Log: MFC r311349, r311445 r311349: tabs -> spaces in etc/mtree MFC after: 4 weeks r311445: Fix typo from r311349 Reported by: lwhsu Pointy-hat-to: asomers MFC after: 4 weeks X-MFC-with: 311349 Modified: stable/10/etc/mtree/BSD.tests.dist stable/10/etc/mtree/BSD.var.dist Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/mtree/BSD.tests.dist ============================================================================== --- stable/10/etc/mtree/BSD.tests.dist Tue Feb 14 21:02:17 2017 (r313742) +++ stable/10/etc/mtree/BSD.tests.dist Tue Feb 14 21:02:27 2017 (r313743) @@ -566,8 +566,8 @@ .. .. .. - bsdcat - .. + bsdcat + .. calendar .. cmp Modified: stable/10/etc/mtree/BSD.var.dist ============================================================================== --- stable/10/etc/mtree/BSD.var.dist Tue Feb 14 21:02:17 2017 (r313742) +++ stable/10/etc/mtree/BSD.var.dist Tue Feb 14 21:02:27 2017 (r313743) @@ -28,7 +28,7 @@ /set gname=wheel backups .. - cache mode=0755 + cache mode=0755 .. crash .. From owner-svn-src-stable-10@freebsd.org Wed Feb 15 00:16:54 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AF6CCDE474; Wed, 15 Feb 2017 00:16:54 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BE571A3B; Wed, 15 Feb 2017 00:16:53 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1F0Grjb026575; Wed, 15 Feb 2017 00:16:53 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1F0Gqqn026572; Wed, 15 Feb 2017 00:16:52 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201702150016.v1F0Gqqn026572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 15 Feb 2017 00:16:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313754 - in stable/10: . tests/sys/geom/class/gate X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2017 00:16:54 -0000 Author: asomers Date: Wed Feb 15 00:16:52 2017 New Revision: 313754 URL: https://svnweb.freebsd.org/changeset/base/313754 Log: MFC r311893, r313008, r313081 I had to modify the tests slightly for the MFC to stable/10, because stable/10 lacks r294037, which enabled /sbin/md5 to work on md(4) devices. r311893: ATFify the geom gate tests. This ensures their cleanup routines will be run even if they should timeout. tests/sys/geom/class/gate/ggate_test.sh tests/sys/geom/class/gate/Makefile Add an ATF test with three testcases, one for each TAP test. Use ATF-style cleanup functions, and convert sleeps to polling loops. ObsoleteFiles.inc tests/sys/geom/class/gate/conf.sh tests/sys/geom/class/gate/1_test.sh tests/sys/geom/class/gate/2_test.sh tests/sys/geom/class/gate/3_test.sh Delete TAP test files Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8891 r313008: Wait for /dev/ggate* to appear after calling `ggatel create` in :ggatel_{file,md} The test assumed that `ggatel create` created a device on completion, but that's incorrect. This squashes the race by waiting for the device to appear, as `ggatel create` daemonizes before issuing an ioctl to geom_gate(4) if not called with `-v`. Discussed with: asomers MFC after: 1 week PR: 204616 Sponsored by: Dell EMC Isilon r313081: Replace for/retry loops with "wait_for_ggate_device" calls and check results of commands As noted in r313008, the underlying issue was that geom_gate device creation wasn't created at ggatel command completion, but some short time after. ggatec(8) employs similar logic when creating geom_gate(4) devices. Switch from retry loops (after the ggatec/dd write calls) to wait_for_ggate_device function calls after calling ggatec(8) instead to detect the presence of the /dev/ggate* device, as this function is sufficient for determining whether or not the character device is ready for testing While here, use atf_check consistently with all dd calls to ensure that data output is as expected. MFC after: 1 week Reviewed by: asomers Differential Revision: D9409 Sponsored by: Dell EMC Isilon Added: stable/10/tests/sys/geom/class/gate/ggate_test.sh - copied, changed from r311893, head/tests/sys/geom/class/gate/ggate_test.sh Deleted: stable/10/tests/sys/geom/class/gate/1_test.sh stable/10/tests/sys/geom/class/gate/2_test.sh stable/10/tests/sys/geom/class/gate/3_test.sh stable/10/tests/sys/geom/class/gate/conf.sh Modified: stable/10/ObsoleteFiles.inc stable/10/tests/sys/geom/class/gate/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/ObsoleteFiles.inc ============================================================================== --- stable/10/ObsoleteFiles.inc Wed Feb 15 00:15:24 2017 (r313753) +++ stable/10/ObsoleteFiles.inc Wed Feb 15 00:16:52 2017 (r313754) @@ -38,6 +38,11 @@ # xargs -n1 | sort | uniq -d; # done +# 20170214: Four files from ggate tests consolidated into one +OLD_FILES+=usr/tests/sys/geom/class/gate/1_test +OLD_FILES+=usr/tests/sys/geom/class/gate/2_test +OLD_FILES+=usr/tests/sys/geom/class/gate/3_test +OLD_FILES+=usr/tests/sys/geom/class/gate/conf.sh # 20170211: libarchive ACL pax test renamed to test_acl_pax_posix1e.tar.uu OLD_FILES+=usr/tests/lib/libarchive/test_acl_pax.tar.uu # 20161229: Three files from gnop tests consolidated into one Modified: stable/10/tests/sys/geom/class/gate/Makefile ============================================================================== --- stable/10/tests/sys/geom/class/gate/Makefile Wed Feb 15 00:15:24 2017 (r313753) +++ stable/10/tests/sys/geom/class/gate/Makefile Wed Feb 15 00:16:52 2017 (r313754) @@ -2,16 +2,6 @@ TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} -TAP_TESTS_SH+= 1_test -TAP_TESTS_SH+= 2_test -TAP_TESTS_SH+= 3_test - -FILES+= conf.sh -FILESNAME_conf.sh= conf.sh -FILESDIR= ${TESTSDIR} - -.for t in ${TAP_TESTS_SH} -TEST_METADATA.$t+= required_user="root" -.endfor +ATF_TESTS_SH+= ggate_test .include Copied and modified: stable/10/tests/sys/geom/class/gate/ggate_test.sh (from r311893, head/tests/sys/geom/class/gate/ggate_test.sh) ============================================================================== --- head/tests/sys/geom/class/gate/ggate_test.sh Tue Jan 10 20:35:09 2017 (r311893, copy source) +++ stable/10/tests/sys/geom/class/gate/ggate_test.sh Wed Feb 15 00:16:52 2017 (r313754) @@ -4,7 +4,6 @@ PIDFILE=ggated.pid PLAINFILES=plainfiles PORT=33080 CONF=gg.exports -RETRIES=16 atf_test_case ggated cleanup ggated_head() @@ -21,31 +20,23 @@ ggated_body() work=$(alloc_md) src=$(alloc_md) - dd if=/dev/random of=/dev/$work bs=1m count=1 conv=notrunc - dd if=/dev/random of=/dev/$src bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=/dev/random of=/dev/$work bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=/dev/random of=/dev/$src bs=1m count=1 conv=notrunc echo $CONF >> $PLAINFILES echo "127.0.0.1 RW /dev/$work" > $CONF atf_check ggated -p $PORT -F $PIDFILE $CONF - for try in `jot $RETRIES`; do - ggatec create -p $PORT -u $us 127.0.0.1 /dev/$work && break - # wait for ggated to be ready - sleep 0.25 - done - if [ "$try" -eq "$RETRIES" ]; then - atf_fail "ggatec create failed" - fi + atf_check ggatec create -p $PORT -u $us 127.0.0.1 /dev/$work - for try in `jot $RETRIES`; do - dd if=/dev/${src} of=/dev/ggate${us} bs=1m count=1 conv=notrunc\ - && break - # Wait for /dev/ggate${us} to be ready - sleep 0.25 - done - if [ "$try" -eq "$RETRIES" ]; then - atf_fail "dd failed; /dev/ggate${us} isn't working" - fi + ggate_dev=/dev/ggate${us} + + wait_for_ggate_device ${ggate_dev} + + atf_check -e ignore -o ignore \ + dd if=/dev/${src} of=${ggate_dev} bs=1m count=1 conv=notrunc checksum /dev/$src /dev/$work } @@ -74,7 +65,12 @@ ggatel_file_body() atf_check ggatel create -u $us work - dd if=src of=/dev/ggate${us} bs=1m count=1 conv=notrunc + ggate_dev=/dev/ggate${us} + + wait_for_ggate_device ${ggate_dev} + + atf_check -e ignore -o ignore \ + dd if=src of=${ggate_dev} bs=1m count=1 conv=notrunc checksum src work } @@ -99,12 +95,19 @@ ggatel_md_body() work=$(alloc_md) src=$(alloc_md) - dd if=/dev/random of=$work bs=1m count=1 conv=notrunc - dd if=/dev/random of=$src bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=/dev/random of=$work bs=1m count=1 conv=notrunc + atf_check -e ignore -o ignore \ + dd if=/dev/random of=$src bs=1m count=1 conv=notrunc atf_check ggatel create -u $us /dev/$work - dd if=/dev/$src of=/dev/ggate${us} bs=1m count=1 conv=notrunc + ggate_dev=/dev/ggate${us} + + wait_for_ggate_device ${ggate_dev} + + atf_check -e ignore -o ignore \ + dd if=/dev/$src of=${ggate_dev} bs=1m count=1 conv=notrunc checksum /dev/$src /dev/$work } @@ -149,14 +152,14 @@ checksum() src=$1 work=$2 - src_checksum=$(md5 -q $src) - work_checksum=$(md5 -q $work) + src_checksum=$(dd if=${src} bs=1m | md5 -q) + work_checksum=$(dd if=${work} bs=1m | md5 -q) if [ "$work_checksum" != "$src_checksum" ]; then atf_fail "work md5 checksum didn't match" fi - ggate_checksum=$(md5 -q /dev/ggate${us}) + ggate_checksum=$(dd if=/dev/ggate${us} bs=1m | md5 -q) if [ "$ggate_checksum" != "$src_checksum" ]; then atf_fail "ggate md5 checksum didn't match" fi @@ -191,3 +194,14 @@ common_cleanup() fi true } + +# Bug 204616: ggatel(8) creates /dev/ggate* asynchronously if `ggatel create` +# isn't called with `-v`. +wait_for_ggate_device() +{ + ggate_device=$1 + + while [ ! -c $ggate_device ]; do + sleep 0.5 + done +} From owner-svn-src-stable-10@freebsd.org Wed Feb 15 09:15:56 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC616CDEC68; Wed, 15 Feb 2017 09:15:56 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7EC2F1DD3; Wed, 15 Feb 2017 09:15:56 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1F9FqKM046041; Wed, 15 Feb 2017 09:15:52 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1F9FqmK046040; Wed, 15 Feb 2017 09:15:52 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201702150915.v1F9FqmK046040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Wed, 15 Feb 2017 09:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313764 - stable/10/usr.sbin/bsdinstall/scripts X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2017 09:15:56 -0000 Author: garga (ports committer) Date: Wed Feb 15 09:15:51 2017 New Revision: 313764 URL: https://svnweb.freebsd.org/changeset/base/313764 Log: MFC r313448: bsdinstall: Make sure chroot filesystems are umounted after use * DISTDIR_IS_UNIONFS is set every time BSDINSTALL_DISTDIR is mounted inside BSDINSTALL_CHROOT. Use this flag to decide if it needs to be umounted * BSDINSTALL_CHROOT/dev is mounted when 'bsdinstall mount' is called, there is no need to mount it again when user goes to shell after installation Reviewed by: allanjude Obtained from: pfSense MFC after: 1 week Sponsored by: Rubicon Communications (Netgate) Differential Revision: https://reviews.freebsd.org/D8573 Modified: stable/10/usr.sbin/bsdinstall/scripts/auto Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsdinstall/scripts/auto ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/auto Wed Feb 15 08:49:28 2017 (r313763) +++ stable/10/usr.sbin/bsdinstall/scripts/auto Wed Feb 15 09:15:51 2017 (r313764) @@ -387,9 +387,11 @@ finalconfig trap error SIGINT # SIGINT is bad again bsdinstall config || error "Failed to save config" +if [ -n "$DISTDIR_IS_UNIONFS" ]; then + umount -f $BSDINSTALL_DISTDIR +fi + if [ ! -z "$BSDINSTALL_FETCHDEST" ]; then - [ "$BSDINSTALL_FETCHDEST" != "$BSDINSTALL_DISTDIR" ] && \ - umount "$BSDINSTALL_DISTDIR" rm -rf "$BSDINSTALL_FETCHDEST" fi @@ -398,7 +400,6 @@ dialog --backtitle "FreeBSD Installer" - "The installation is now finished. Before exiting the installer, would you like to open a shell in the new system to make any final manual modifications?" 0 0 if [ $? -eq 0 ]; then clear - mount -t devfs devfs "$BSDINSTALL_CHROOT/dev" echo This shell is operating in a chroot in the new system. \ When finished making configuration changes, type \"exit\". chroot "$BSDINSTALL_CHROOT" /bin/sh 2>&1 From owner-svn-src-stable-10@freebsd.org Wed Feb 15 09:18:10 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2AD13CDED06; Wed, 15 Feb 2017 09:18:10 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0FE71F3D; Wed, 15 Feb 2017 09:18:09 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1F9I9Px046164; Wed, 15 Feb 2017 09:18:09 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1F9I9eu046163; Wed, 15 Feb 2017 09:18:09 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201702150918.v1F9I9eu046163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Wed, 15 Feb 2017 09:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313765 - stable/10/usr.sbin/arp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2017 09:18:10 -0000 Author: garga (ports committer) Date: Wed Feb 15 09:18:08 2017 New Revision: 313765 URL: https://svnweb.freebsd.org/changeset/base/313765 Log: MFC r313457: Fix style(9) Reviewed by: vangyzen, allanjude, cem Approved by: allanjude MFC after: 1 week Sponsored by: Rubicon Communications (Netgate) Differential Revision: https://reviews.freebsd.org/D9494 Modified: stable/10/usr.sbin/arp/arp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/arp/arp.c ============================================================================== --- stable/10/usr.sbin/arp/arp.c Wed Feb 15 09:15:51 2017 (r313764) +++ stable/10/usr.sbin/arp/arp.c Wed Feb 15 09:18:08 2017 (r313765) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); * arp - display, set, and delete arp table entries */ - #include #include #include @@ -80,8 +79,8 @@ __FBSDID("$FreeBSD$"); #include #include -typedef void (action_fn)(struct sockaddr_dl *sdl, - struct sockaddr_in *s_in, struct rt_msghdr *rtm); +typedef void (action_fn)(struct sockaddr_dl *sdl, struct sockaddr_in *s_in, + struct rt_msghdr *rtm); static int search(u_long addr, action_fn *action); static action_fn print_entry; @@ -344,18 +343,20 @@ set(int argc, char **argv) } } else if (strncmp(argv[0], "blackhole", 9) == 0) { if (flags & RTF_REJECT) { - printf("Choose one of blackhole or reject, not both.\n"); + printf("Choose one of blackhole or reject, " + "not both."); } flags |= RTF_BLACKHOLE; } else if (strncmp(argv[0], "reject", 6) == 0) { if (flags & RTF_BLACKHOLE) { - printf("Choose one of blackhole or reject, not both.\n"); + printf("Choose one of blackhole or reject, " + "not both."); } flags |= RTF_REJECT; } else if (strncmp(argv[0], "trail", 5) == 0) { /* XXX deprecated and undocumented feature */ printf("%s: Sending trailers is no longer supported\n", - host); + host); } argv++; } @@ -381,7 +382,7 @@ set(int argc, char **argv) /* * In the case a proxy-arp entry is being added for - * a remote end point, the RTF_ANNOUNCE flag in the + * a remote end point, the RTF_ANNOUNCE flag in the * RTM_GET command is an indication to the kernel * routing code that the interface associated with * the prefix route covering the local end of the @@ -467,7 +468,7 @@ delete(char *host) sdl = (struct sockaddr_dl *)(SA_SIZE(addr) + (char *)addr); /* - * With the new L2/L3 restructure, the route + * With the new L2/L3 restructure, the route * returned is a prefix route. The important * piece of information from the previous * RTM_GET is the interface index. In the @@ -486,7 +487,7 @@ delete(char *host) * is a proxy-arp entry to remove. */ if (flags & RTF_ANNOUNCE) { - fprintf(stderr, "delete: cannot locate %s\n",host); + fprintf(stderr, "delete: cannot locate %s\n", host); return (1); } @@ -525,7 +526,7 @@ search(u_long addr, action_fn *action) mib[5] = RTF_LLINFO; #else mib[5] = 0; -#endif +#endif if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) err(1, "route-sysctl-estimate"); if (needed == 0) /* empty table */ @@ -575,7 +576,7 @@ print_entry(struct sockaddr_dl *sdl, struct if_nameindex *p; int seg; - if (ifnameindex == NULL) + if (ifnameindex == NULL) if ((ifnameindex = if_nameindex()) == NULL) err(1, "cannot retrieve interface names"); @@ -597,7 +598,8 @@ print_entry(struct sockaddr_dl *sdl, sdl->sdl_type == IFT_L2VLAN || sdl->sdl_type == IFT_BRIDGE) && sdl->sdl_alen == ETHER_ADDR_LEN) - printf("%s", ether_ntoa((struct ether_addr *)LLADDR(sdl))); + printf("%s", + ether_ntoa((struct ether_addr *)LLADDR(sdl))); else { int n = sdl->sdl_nlen > 0 ? sdl->sdl_nlen + 1 : 0; @@ -607,7 +609,7 @@ print_entry(struct sockaddr_dl *sdl, printf("(incomplete)"); for (p = ifnameindex; p && ifnameindex->if_index && - ifnameindex->if_name; p++) { + ifnameindex->if_name; p++) { if (p->if_index == sdl->sdl_index) { printf(" on %s", p->if_name); break; @@ -629,31 +631,31 @@ print_entry(struct sockaddr_dl *sdl, printf(" published"); switch(sdl->sdl_type) { case IFT_ETHER: - printf(" [ethernet]"); - break; + printf(" [ethernet]"); + break; case IFT_ISO88025: - printf(" [token-ring]"); + printf(" [token-ring]"); trld = SDL_ISO88025(sdl); if (trld->trld_rcf != 0) { printf(" rt=%x", ntohs(trld->trld_rcf)); for (seg = 0; seg < ((TR_RCF_RIFLEN(trld->trld_rcf) - 2 ) / 2); - seg++) + seg++) printf(":%x", ntohs(*(trld->trld_route[seg]))); } break; case IFT_FDDI: - printf(" [fddi]"); - break; + printf(" [fddi]"); + break; case IFT_ATM: - printf(" [atm]"); - break; + printf(" [atm]"); + break; case IFT_L2VLAN: printf(" [vlan]"); break; case IFT_IEEE1394: - printf(" [firewire]"); - break; + printf(" [firewire]"); + break; case IFT_BRIDGE: printf(" [bridge]"); break; @@ -662,8 +664,8 @@ print_entry(struct sockaddr_dl *sdl, break; default: break; - } - + } + printf("\n"); } @@ -688,13 +690,13 @@ static void usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n", - "usage: arp [-n] [-i interface] hostname", - " arp [-n] [-i interface] -a", - " arp -d hostname [pub]", - " arp -d [-i interface] -a", - " arp -s hostname ether_addr [temp] [reject | blackhole] [pub [only]]", - " arp -S hostname ether_addr [temp] [reject | blackhole] [pub [only]]", - " arp -f filename"); + "usage: arp [-n] [-i interface] hostname", + " arp [-n] [-i interface] -a", + " arp -d hostname [pub]", + " arp -d [-i interface] -a", + " arp -s hostname ether_addr [temp] [reject | blackhole] [pub [only]]", + " arp -S hostname ether_addr [temp] [reject | blackhole] [pub [only]]", + " arp -f filename"); exit(1); } @@ -753,12 +755,12 @@ rtmsg(int cmd, struct sockaddr_in *dst, case RTM_GET: rtm->rtm_addrs |= RTA_DST; } -#define NEXTADDR(w, s) \ - do { \ - if ((s) != NULL && rtm->rtm_addrs & (w)) { \ - bcopy((s), cp, sizeof(*(s))); \ - cp += SA_SIZE(s); \ - } \ +#define NEXTADDR(w, s) \ + do { \ + if ((s) != NULL && rtm->rtm_addrs & (w)) { \ + bcopy((s), cp, sizeof(*(s))); \ + cp += SA_SIZE(s); \ + } \ } while (0) NEXTADDR(RTA_DST, dst); @@ -814,7 +816,7 @@ get_ether_addr(in_addr_t ipaddr, struct } #define NEXTIFR(i) \ - ((struct ifreq *)((char *)&(i)->ifr_addr \ + ((struct ifreq *)((char *)&(i)->ifr_addr \ + MAX((i)->ifr_addr.sa_len, sizeof((i)->ifr_addr))) ) /* @@ -835,14 +837,10 @@ get_ether_addr(in_addr_t ipaddr, struct if (ioctl(sock, SIOCGIFFLAGS, &ifreq) < 0) continue; if ((ifreq.ifr_flags & - (IFF_UP|IFF_BROADCAST|IFF_POINTOPOINT| - IFF_LOOPBACK|IFF_NOARP)) - != (IFF_UP|IFF_BROADCAST)) + (IFF_UP|IFF_BROADCAST|IFF_POINTOPOINT| + IFF_LOOPBACK|IFF_NOARP)) != (IFF_UP|IFF_BROADCAST)) continue; - /* - * Get its netmask and check that it's on - * the right subnet. - */ + /* Get its netmask and check that it's on the right subnet. */ if (ioctl(sock, SIOCGIFNETMASK, &ifreq) < 0) continue; mask = ((struct sockaddr_in *) From owner-svn-src-stable-10@freebsd.org Thu Feb 16 04:23:46 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6A9DCE1313; Thu, 16 Feb 2017 04:23:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C031E94; Thu, 16 Feb 2017 04:23:46 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1G4Njtv014071; Thu, 16 Feb 2017 04:23:45 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1G4Nj7W014069; Thu, 16 Feb 2017 04:23:45 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702160423.v1G4Nj7W014069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 16 Feb 2017 04:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313789 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 04:23:46 -0000 Author: ngie Date: Thu Feb 16 04:23:45 2017 New Revision: 313789 URL: https://svnweb.freebsd.org/changeset/base/313789 Log: MFC r288241: r288241 (by bdrewery): Remove 'set -e' that are no longer needed as it is already default. When bmake was initially imported at r241298 shell commands were no longer ran with 'set -e' as they were before. This was fixed in r254980 so they again always use 'set -e'. Modified: stable/10/share/mk/bsd.subdir.mk stable/10/share/mk/suite.test.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/bsd.subdir.mk ============================================================================== --- stable/10/share/mk/bsd.subdir.mk Thu Feb 16 04:21:24 2017 (r313788) +++ stable/10/share/mk/bsd.subdir.mk Thu Feb 16 04:23:45 2017 (r313789) @@ -45,7 +45,7 @@ distribute: .MAKE _SUBDIR: .USE .MAKE .if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR) - @${_+_}set -e; for entry in ${SUBDIR:N.WAIT}; do \ + @${_+_}for entry in ${SUBDIR:N.WAIT}; do \ if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \ edir=$${entry}.${MACHINE_ARCH}; \ @@ -86,8 +86,7 @@ __deps+= ${__target}_subdir_${__dep} .endfor ${__target}_subdir_${__dir}: .PHONY .MAKE ${__deps} .if !defined(NO_SUBDIR) - @${_+_}set -e; \ - if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \ + @${_+_}if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \ ${ECHODIR} "===> ${DIRPRFX}${__dir}.${MACHINE_ARCH} (${__target:realinstall=install})"; \ edir=${__dir}.${MACHINE_ARCH}; \ cd ${.CURDIR}/$${edir}; \ @@ -118,7 +117,7 @@ _sub.${__stage}${__target}: _SUBDIR .endfor .if !target(${__target}) ${__target}: .MAKE - ${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} + ${_+_}cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target} .endif .endfor Modified: stable/10/share/mk/suite.test.mk ============================================================================== --- stable/10/share/mk/suite.test.mk Thu Feb 16 04:21:24 2017 (r313788) +++ stable/10/share/mk/suite.test.mk Thu Feb 16 04:23:45 2017 (r313789) @@ -90,8 +90,7 @@ realtest: .PHONY @echo "*** installed in ${TESTSBASE}. This test run may raise false" @echo "*** positives and/or false negatives." @echo - @set -e; \ - ${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile; \ + @${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile; \ result=0; \ echo; \ echo "*** Once again, note that "make test" is unsupported."; \ From owner-svn-src-stable-10@freebsd.org Thu Feb 16 05:14:09 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 265E7CE1089; Thu, 16 Feb 2017 05:14:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D82C474E; Thu, 16 Feb 2017 05:14:08 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1G5E85M034328; Thu, 16 Feb 2017 05:14:08 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1G5E7ux034321; Thu, 16 Feb 2017 05:14:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702160514.v1G5E7ux034321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 16 Feb 2017 05:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313790 - in stable/10: . share/man/man7 share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 05:14:09 -0000 Author: ngie Date: Thu Feb 16 05:14:07 2017 New Revision: 313790 URL: https://svnweb.freebsd.org/changeset/base/313790 Log: MFC r285119,r292502,r295380: r285119 (by jmmv): Add support for TEST_METADATA Allow Makefiles to define generic metadata settings that apply to all test programs defined by a Makefile. The generic TEST_METADATA variable extends the per-test program settings already supported via TEST_METADATA.. This feature will be useful to easily apply some settings to all programs in a directory. In particular, Kyua 0.12 will support parallel execution of test programs and a bunch of them will need to be tagged as is_exclusive to indicate that they cannot be run in parallel with anything else due to their side-effects. It will be reasonable to set this setting on whole directories. r292502: Always expose LOCALBASE, not just when CROSS_TOOLCHAIN is defined Instead of using which(1) to look for doxygen, look for it in /bin . $PATH gets mangled by make buildenv, etc so it's better to just be explicit about the path if someone uses that for instance. r295380: Simplify running the FreeBSD test suite Replace `make regress` (legacy test make target) and `make test` (incomplete test make target added with the FreeBSD test suite) with make check as it's consistent with other open source projects. `make check` defaults to running tests from `.OBJDIR`, but can be overridden with the `CHECKDIR` variable. Add `make checkworld` target to simplify running the FreeBSD test suite from `TESTSBASE` (i.e. the top-level tests directory), similar to buildworld. Document `make check` and `make checkworld` in build(7). Other minor changes: - Rename intermediate file (`Kyuafile.auto`) to `Kyuafile` to simplify `make check`. - Remove terse warnings attached to `beforetest`/`aftertest`. - Add kyua binary check to check target in suite.test.mk; error out if it's not found The MFC is [partly] contingent on other build related changes being MFCed. X-MFC to: stable/10 Relnotes: yes Modified: stable/10/Makefile stable/10/Makefile.inc1 stable/10/share/man/man7/build.7 stable/10/share/mk/bsd.README stable/10/share/mk/bsd.subdir.mk stable/10/share/mk/bsd.sys.mk stable/10/share/mk/bsd.test.mk stable/10/share/mk/suite.test.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile ============================================================================== --- stable/10/Makefile Thu Feb 16 04:23:45 2017 (r313789) +++ stable/10/Makefile Thu Feb 16 05:14:07 2017 (r313790) @@ -21,6 +21,7 @@ # kernel-toolchains - Build kernel-toolchain for all universe targets. # doxygen - Build API documentation of the kernel, needs doxygen. # update - Convenient way to update your source tree(s). +# checkworld - Run test suite on installed world. # check-old - List obsolete directories/files/libraries. # check-old-dirs - List obsolete directories. # check-old-files - List obsolete files. @@ -99,8 +100,8 @@ # For more information, see the build(7) manual page. # TGTS= all all-man buildenv buildenvvars buildkernel buildworld \ - check-old check-old-dirs check-old-files check-old-libs \ - checkdpadd clean cleandepend cleandir \ + check check-old check-old-dirs check-old-files check-old-libs \ + checkdpadd checkworld clean cleandepend cleandir \ delete-old delete-old-dirs delete-old-files delete-old-libs \ depend distribute distributekernel distributekernel.debug \ distributeworld distrib-dirs distribution doxygen \ @@ -108,7 +109,7 @@ TGTS= all all-man buildenv buildenvvars installkernel.debug packagekernel packageworld \ reinstallkernel reinstallkernel.debug \ installworld kernel-toolchain libraries lint maninstall \ - obj objlink regress rerelease showconfig tags toolchain update \ + obj objlink rerelease showconfig tags toolchain update \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _cross-tools _includes _libraries _depend \ build32 builddtb distribute32 install32 xdev xdev-build xdev-install \ @@ -374,6 +375,10 @@ make bmake: .PHONY ${MMAKE} all; \ ${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR= +regress: .PHONY + @echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt + @false + tinderbox toolchains kernel-toolchains: upgrade_checks tinderbox: Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Thu Feb 16 04:23:45 2017 (r313789) +++ stable/10/Makefile.inc1 Thu Feb 16 05:14:07 2017 (r313790) @@ -35,6 +35,7 @@ # The intended user-driven targets are: # buildworld - rebuild *everything*, including glue to help do upgrades # installworld- install everything built by "buildworld" +# checkworld - run test suite on installed world # doxygen - build API documentation of the kernel # update - convenient way to update your source tree (eg: svn/svnup) # @@ -50,6 +51,8 @@ .include .include +LOCALBASE?= /usr/local + # We must do share/info early so that installation of info `dir' # entries works correctly. Do it first since it is less likely to # grow dependencies on include and lib than vice versa. @@ -1190,12 +1193,26 @@ packagekernel: .endif # +# +# checkworld +# +# Run test suite on installed world. +# +checkworld: .PHONY + @if [ ! -x ${LOCALBASE}/bin/kyua ]; then \ + echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \ + exit 1; \ + fi + ${_+_}${LOCALBASE}/bin/kyua test -k ${TESTSBASE}/Kyuafile + +# +# # doxygen # # Build the API documentation with doxygen # doxygen: .PHONY - @if [ ! -x `/usr/bin/which doxygen` ]; then \ + @if [ ! -x ${LOCALBASE}/bin/doxygen ]; then \ echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ exit 1; \ fi Modified: stable/10/share/man/man7/build.7 ============================================================================== --- stable/10/share/man/man7/build.7 Thu Feb 16 04:23:45 2017 (r313789) +++ stable/10/share/man/man7/build.7 Thu Feb 16 05:14:07 2017 (r313790) @@ -107,6 +107,16 @@ section below, and by the variables docu The following list provides the names and actions for the targets supported by the build system: .Bl -tag -width ".Cm cleandepend" +.It Cm check +Run tests for a given subdirectory. +The default directory used is +.Pa ${.OBJDIR} , +but the check directory can be changed with +.Pa ${CHECKDIR} . +.It Cm checkworld +Run the +.Fx +test suite on installed world. .It Cm clean Remove any files created during the build process. .It Cm cleandepend @@ -653,6 +663,7 @@ make TARGET=sparc64 DESTDIR=/clients/spa .Xr mergemaster 8 , .Xr portsnap 8 , .Xr reboot 8 , -.Xr shutdown 8 +.Xr shutdown 8 , +.Xr tests 7 .Sh AUTHORS .An Mike W. Meyer Aq mwm@mired.org . Modified: stable/10/share/mk/bsd.README ============================================================================== --- stable/10/share/mk/bsd.README Thu Feb 16 04:23:45 2017 (r313789) +++ stable/10/share/mk/bsd.README Thu Feb 16 05:14:07 2017 (r313790) @@ -492,6 +492,17 @@ It has seven targets: all: build the test programs. + check: + runs the test programs from CHECKDIR with kyua test. + + The beforecheck and aftercheck targets will be invoked, if + defined, to execute commands before and after the realcheck + target has been executed, respectively. + + The devel/kyua package must be installed before invoking this + target. + + See CHECKDIR for more details. clean: remove the test programs and any object files. cleandir: @@ -510,12 +521,6 @@ It has seven targets: run lint on the source files. tags: create a tags file for the source files. - test: - runs the test programs from the object directory; if the - Makefile does not itself define the target test, the - targets beforetest and aftertest may also be used to - cause actions immediately before and after the test - target is executed. It sets/uses the following variables, among many others: @@ -529,6 +534,10 @@ TESTSDIR Path to the installed tests. M ${TESTSBASE}/${RELDIR:H} , e.g. /usr/tests/bin/ls when included from bin/ls/tests . +CHECKDIR The directory that 'make check' executes tests from. + + The value of CHECKDIR defaults to .OBJDIR. + KYUAFILE If 'auto' (the default), generate a Kyuafile out of the test programs defined in the Makefile. If 'yes', then a manually-crafted Kyuafile must be supplied with the Modified: stable/10/share/mk/bsd.subdir.mk ============================================================================== --- stable/10/share/mk/bsd.subdir.mk Thu Feb 16 04:23:45 2017 (r313789) +++ stable/10/share/mk/bsd.subdir.mk Thu Feb 16 05:14:07 2017 (r313790) @@ -24,9 +24,9 @@ # This is a variant of install, which will # put the stuff into the right "distribution". # -# afterinstall, all, all-man, beforeinstall, checkdpadd, clean, +# afterinstall, all, all-man, beforeinstall, check, checkdpadd, clean, # cleandepend, cleandir, cleanilinks depend, install, lint, -# maninstall, manlint, obj, objlink, realinstall, regress, tags +# maninstall, manlint, obj, objlink, realinstall, tags # .if !target(____) @@ -70,9 +70,9 @@ ${SUBDIR:N.WAIT}: .PHONY .MAKE # Work around parsing of .if nested in .for by putting .WAIT string into a var. __wait= .WAIT -.for __target in all all-man checkdpadd clean cleandepend cleandir \ +.for __target in all all-man check checkdpadd clean cleandepend cleandir \ cleanilinks depend distribute lint maninstall manlint obj objlink \ - realinstall regress tags ${SUBDIR_TARGETS} + realinstall tags ${SUBDIR_TARGETS} .ifdef SUBDIR_PARALLEL __subdir_targets= .for __dir in ${SUBDIR} Modified: stable/10/share/mk/bsd.sys.mk ============================================================================== --- stable/10/share/mk/bsd.sys.mk Thu Feb 16 04:23:45 2017 (r313789) +++ stable/10/share/mk/bsd.sys.mk Thu Feb 16 05:14:07 2017 (r313790) @@ -158,11 +158,11 @@ CFLAGS+= ${CWARNFLAGS} ${CWARNFLAGS.${.I # or expect to ever be up-to-date. PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \ beforelinking build build-tools buildfiles buildincludes \ - checkdpadd clean cleandepend cleandir cleanobj configure \ + check checkdpadd clean cleandepend cleandir cleanobj configure \ depend dependall distclean distribute exe extract \ html includes install installfiles installincludes lint \ obj objlink objs objwarn realall realdepend \ - realinstall regress subdir-all subdir-depend subdir-install \ + realinstall subdir-all subdir-depend subdir-install \ tags whereobj .if defined(PORTNAME) Modified: stable/10/share/mk/bsd.test.mk ============================================================================== --- stable/10/share/mk/bsd.test.mk Thu Feb 16 04:23:45 2017 (r313789) +++ stable/10/share/mk/bsd.test.mk Thu Feb 16 05:14:07 2017 (r313790) @@ -68,11 +68,15 @@ _TESTS= .include .include +# kyua automatically descends directories; only run make check on the +# top-level directory +.if !make(check) .for ts in ${TESTS_SUBDIRS} .if empty(SUBDIR:M${ts}) SUBDIR+= ${ts} .endif .endfor +.endif # it is rare for test cases to have man pages .if !defined(MAN) @@ -83,18 +87,13 @@ MAN= .include .endif -.if !target(realtest) -realtest: .PHONY +.if !target(realcheck) +realcheck: .PHONY @echo "$@ not defined; skipping" .endif -test: .PHONY -.ORDER: beforetest realtest -test: beforetest realtest - -.if target(aftertest) -.ORDER: realtest aftertest -test: aftertest -.endif +beforecheck realcheck aftercheck check: .PHONY +.ORDER: beforecheck realcheck aftercheck +check: beforecheck realcheck aftercheck .include Modified: stable/10/share/mk/suite.test.mk ============================================================================== --- stable/10/share/mk/suite.test.mk Thu Feb 16 04:23:45 2017 (r313789) +++ stable/10/share/mk/suite.test.mk Thu Feb 16 05:14:07 2017 (r313790) @@ -30,12 +30,19 @@ KYUAFILE?= auto # Kyua as this is later encoded in the Kyuafile test program definitions. #TEST_INTERFACE.= interface-name +# Metadata properties applicable to all test programs. +# +# All the variables for a test program defined in the Makefile are appended +# to the test program's definition in the Kyuafile. This feature can be +# used to avoid having to explicitly supply a Kyuafile in the source +# directory, allowing the caller Makefile to rely on the KYUAFILE=auto +# behavior defined here. +#TEST_METADATA+= key="value" + # Per-test program metadata properties as a list of key/value pairs. # -# All the variables for a particular program are appended to the program's -# definition in the Kyuafile. This feature can be used to avoid having to -# explicitly supply a Kyuafile in the source directory, allowing the caller -# Makefile to rely on the KYUAFILE=auto behavior defined here. +# These per-test program settings _extend_ the values provided in the +# unqualified TEST_METADATA variable. #TEST_METADATA.+= key="value" .if ${KYUAFILE:tl} != "no" @@ -43,11 +50,12 @@ FILES+= Kyuafile FILESDIR_Kyuafile= ${TESTSDIR} .endif -.if ${KYUAFILE:tl} == "auto" -CLEANFILES+= Kyuafile Kyuafile.tmp -.endif +.for _T in ${_TESTS} +_TEST_METADATA.${_T}= ${TEST_METADATA} ${TEST_METADATA.${_T}} +.endfor .if ${KYUAFILE:tl} == "auto" +CLEANFILES+= Kyuafile Kyuafile.tmp Kyuafile: Makefile @{ \ echo '-- Automatically generated by bsd.test.mk.'; \ @@ -59,10 +67,10 @@ Kyuafile: Makefile } > ${.TARGET}.tmp .for _T in ${_TESTS} .if defined(.PARSEDIR) - @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \ + @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${_TEST_METADATA.${_T}:C/$/,/:tW:C/^/, /W:C/,$//W}}' \ >>${.TARGET}.tmp .else - @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${TEST_METADATA.${_T}:C/^/, /:Q:S/\\ ,/,/g:S,\\,,g}}' \ + @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${_TEST_METADATA.${_T}:C/^/, /:Q:S/\\ ,/,/g:S,\\,,g}}' \ >>Kyuafile.auto.tmp .endif .endfor @@ -72,9 +80,11 @@ Kyuafile: Makefile @mv ${.TARGET}.tmp ${.TARGET} .endif +CHECKDIR?= ${DESTDIR}${TESTSDIR} + KYUA= ${LOCALBASE}/bin/kyua -.if exists(${KYUA}) -# Definition of the "make test" target and supporting variables. + +# Definition of the "make check" target and supporting variables. # # This target, by necessity, can only work for native builds (i.e. a FreeBSD # host building a release for the same system). The target runs Kyua, which is @@ -83,35 +93,15 @@ KYUA= ${LOCALBASE}/bin/kyua # Due to the dependencies of the binaries built by the source tree and how they # are used by tests, it is highly possible for a execution of "make test" to # report bogus results unless the new binaries are put in place. -realtest: .PHONY - @echo "*** WARNING: make test is experimental" - @echo "***" - @echo "*** Using this test does not preclude you from running the tests" - @echo "*** installed in ${TESTSBASE}. This test run may raise false" - @echo "*** positives and/or false negatives." - @echo - @${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile; \ - result=0; \ - echo; \ - echo "*** Once again, note that "make test" is unsupported."; \ - test $${result} -eq 0 -.endif -beforetest: .PHONY -.if defined(TESTSDIR) -.if ${TESTSDIR} == ${TESTSBASE} -# Forbid running from ${TESTSBASE}. It can cause false positives/negatives and -# it does not cover all the tests (e.g. it misses testing software in external). - @echo "*** Sorry, you cannot use make test from src/tests. Install the" - @echo "*** tests into their final location and run them from ${TESTSBASE}" - @false -.else - @echo "*** Using this test does not preclude you from running the tests" - @echo "*** installed in ${TESTSBASE}. This test run may raise false" - @echo "*** positives and/or false negatives." -.endif -.else - @echo "*** No TESTSDIR defined; nothing to do." - @false -.endif - @echo +realcheck: .PHONY + @if [ ! -x ${KYUA} ]; then \ + echo; \ + echo "kyua binary not installed at expected location (${.TARGET})"; \ + echo; \ + echo "Please install via pkg install, or specify the path to the kyua"; \ + echo "package via the \$${LOCALBASE} variable, e.g. "; \ + echo "LOCALBASE=\"${LOCALBASE}\""; \ + false; \ + fi + @${KYUA} test -k ${CHECKDIR}/Kyuafile From owner-svn-src-stable-10@freebsd.org Thu Feb 16 05:17:41 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EBD61CE118A; Thu, 16 Feb 2017 05:17:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC80D8F6; Thu, 16 Feb 2017 05:17:41 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1G5HeKV034510; Thu, 16 Feb 2017 05:17:40 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1G5Helr034504; Thu, 16 Feb 2017 05:17:40 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702160517.v1G5Helr034504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 16 Feb 2017 05:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313791 - in stable/10: bin/sh/tests cddl/usr.sbin/dtrace/tests/common share/mk tests/sys tests/sys/pjdfstest/tests usr.bin/bmake/tests X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 05:17:42 -0000 Author: ngie Date: Thu Feb 16 05:17:40 2017 New Revision: 313791 URL: https://svnweb.freebsd.org/changeset/base/313791 Log: MFC r295643: r295643 (by bdrewery): Test directories can build in parallel fine. Added: stable/10/usr.bin/bmake/tests/Makefile.inc - copied unchanged from r295643, head/usr.bin/bmake/tests/Makefile.inc Modified: stable/10/bin/sh/tests/Makefile stable/10/cddl/usr.sbin/dtrace/tests/common/Makefile stable/10/share/mk/bsd.test.mk stable/10/tests/sys/Makefile stable/10/tests/sys/pjdfstest/tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/tests/Makefile ============================================================================== --- stable/10/bin/sh/tests/Makefile Thu Feb 16 05:14:07 2017 (r313790) +++ stable/10/bin/sh/tests/Makefile Thu Feb 16 05:17:40 2017 (r313791) @@ -10,6 +10,4 @@ TESTS_SUBDIRS+= parameters TESTS_SUBDIRS+= parser TESTS_SUBDIRS+= set-e -SUBDIR_PARALLEL= - .include Modified: stable/10/cddl/usr.sbin/dtrace/tests/common/Makefile ============================================================================== --- stable/10/cddl/usr.sbin/dtrace/tests/common/Makefile Thu Feb 16 05:14:07 2017 (r313790) +++ stable/10/cddl/usr.sbin/dtrace/tests/common/Makefile Thu Feb 16 05:17:40 2017 (r313791) @@ -86,6 +86,4 @@ TESTS_SUBDIRS+= aggs \ .PATH: ${.CURDIR:H:H:H:H:H}/tests KYUAFILE= YES -SUBDIR_PARALLEL= - .include Modified: stable/10/share/mk/bsd.test.mk ============================================================================== --- stable/10/share/mk/bsd.test.mk Thu Feb 16 05:14:07 2017 (r313790) +++ stable/10/share/mk/bsd.test.mk Thu Feb 16 05:17:40 2017 (r313791) @@ -76,6 +76,7 @@ _TESTS= SUBDIR+= ${ts} .endif .endfor +SUBDIR_PARALLEL= t .endif # it is rare for test cases to have man pages Modified: stable/10/tests/sys/Makefile ============================================================================== --- stable/10/tests/sys/Makefile Thu Feb 16 05:14:07 2017 (r313790) +++ stable/10/tests/sys/Makefile Thu Feb 16 05:17:40 2017 (r313791) @@ -22,6 +22,4 @@ TESTS_SUBDIRS+= vm # Items not integrated into kyua runs by default SUBDIR+= pjdfstest -SUBDIR_PARALLEL= - .include Modified: stable/10/tests/sys/pjdfstest/tests/Makefile ============================================================================== --- stable/10/tests/sys/pjdfstest/tests/Makefile Thu Feb 16 05:14:07 2017 (r313790) +++ stable/10/tests/sys/pjdfstest/tests/Makefile Thu Feb 16 05:17:40 2017 (r313791) @@ -36,6 +36,4 @@ TESTS_SUBDIRS+= symlink TESTS_SUBDIRS+= truncate TESTS_SUBDIRS+= unlink -SUBDIR_PARALLEL= - .include Copied: stable/10/usr.bin/bmake/tests/Makefile.inc (from r295643, head/usr.bin/bmake/tests/Makefile.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.bin/bmake/tests/Makefile.inc Thu Feb 16 05:17:40 2017 (r313791, copy of r295643, head/usr.bin/bmake/tests/Makefile.inc) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +SUBDIR_PARALLEL= t From owner-svn-src-stable-10@freebsd.org Thu Feb 16 05:22:10 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4006CCE13A2; Thu, 16 Feb 2017 05:22:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08E88D40; Thu, 16 Feb 2017 05:22:09 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1G5M9Y2038244; Thu, 16 Feb 2017 05:22:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1G5M9Xg038243; Thu, 16 Feb 2017 05:22:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201702160522.v1G5M9Xg038243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Thu, 16 Feb 2017 05:22:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313792 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 05:22:10 -0000 Author: ngie Date: Thu Feb 16 05:22:08 2017 New Revision: 313792 URL: https://svnweb.freebsd.org/changeset/base/313792 Log: Fix mismerge in r313790 Use ${.TARGET}, not Kyuafile.auto* for the fmake case This is a direct commit to ^/stable/10 Sponsored by: Dell EMC Isilon Modified: stable/10/share/mk/suite.test.mk Modified: stable/10/share/mk/suite.test.mk ============================================================================== --- stable/10/share/mk/suite.test.mk Thu Feb 16 05:17:40 2017 (r313791) +++ stable/10/share/mk/suite.test.mk Thu Feb 16 05:22:08 2017 (r313792) @@ -71,7 +71,7 @@ Kyuafile: Makefile >>${.TARGET}.tmp .else @echo '${TEST_INTERFACE.${_T}}_test_program{name="${_T}"${_TEST_METADATA.${_T}:C/^/, /:Q:S/\\ ,/,/g:S,\\,,g}}' \ - >>Kyuafile.auto.tmp + >>${.TARGET}.tmp .endif .endfor .for _T in ${TESTS_SUBDIRS:N.WAIT} From owner-svn-src-stable-10@freebsd.org Thu Feb 16 06:00:59 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B025CE1C50; Thu, 16 Feb 2017 06:00:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D03EB1AE1; Thu, 16 Feb 2017 06:00:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1G60vvN050864; Thu, 16 Feb 2017 06:00:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1G60vjo050863; Thu, 16 Feb 2017 06:00:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201702160600.v1G60vjo050863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 16 Feb 2017 06:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313794 - stable/10/sys/compat/freebsd32 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 06:00:59 -0000 Author: kib Date: Thu Feb 16 06:00:57 2017 New Revision: 313794 URL: https://svnweb.freebsd.org/changeset/base/313794 Log: MFC r313692: Style: wrap long line. Modified: stable/10/sys/compat/freebsd32/freebsd32_misc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/10/sys/compat/freebsd32/freebsd32_misc.c Thu Feb 16 05:57:58 2017 (r313793) +++ stable/10/sys/compat/freebsd32/freebsd32_misc.c Thu Feb 16 06:00:57 2017 (r313794) @@ -598,7 +598,8 @@ freebsd32_mmap(struct thread *td, struct #ifdef COMPAT_FREEBSD6 int -freebsd6_freebsd32_mmap(struct thread *td, struct freebsd6_freebsd32_mmap_args *uap) +freebsd6_freebsd32_mmap(struct thread *td, + struct freebsd6_freebsd32_mmap_args *uap) { struct freebsd32_mmap_args ap; From owner-svn-src-stable-10@freebsd.org Thu Feb 16 06:16:52 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AC51CE136F; Thu, 16 Feb 2017 06:16:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 330098A2; Thu, 16 Feb 2017 06:16:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1G6GpIk059008; Thu, 16 Feb 2017 06:16:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1G6GoTA059000; Thu, 16 Feb 2017 06:16:50 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201702160616.v1G6GoTA059000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 16 Feb 2017 06:16:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313796 - in stable/10: contrib/zlib contrib/zlib/contrib contrib/zlib/test lib/libz X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 06:16:52 -0000 Author: delphij Date: Thu Feb 16 06:16:50 2017 New Revision: 313796 URL: https://svnweb.freebsd.org/changeset/base/313796 Log: MFC r311285,312335: zlib 1.2.11. Modified: stable/10/contrib/zlib/ChangeLog stable/10/contrib/zlib/README stable/10/contrib/zlib/adler32.c stable/10/contrib/zlib/compress.c stable/10/contrib/zlib/contrib/README.contrib stable/10/contrib/zlib/crc32.c stable/10/contrib/zlib/deflate.c stable/10/contrib/zlib/deflate.h stable/10/contrib/zlib/gzguts.h stable/10/contrib/zlib/gzlib.c stable/10/contrib/zlib/gzread.c stable/10/contrib/zlib/gzwrite.c stable/10/contrib/zlib/infback.c stable/10/contrib/zlib/inffast.c stable/10/contrib/zlib/inflate.c stable/10/contrib/zlib/inflate.h stable/10/contrib/zlib/inftrees.c stable/10/contrib/zlib/test/example.c stable/10/contrib/zlib/test/infcover.c stable/10/contrib/zlib/test/minigzip.c stable/10/contrib/zlib/trees.c stable/10/contrib/zlib/uncompr.c stable/10/contrib/zlib/zconf.h stable/10/contrib/zlib/zconf.h.in stable/10/contrib/zlib/zlib.3 stable/10/contrib/zlib/zlib.h stable/10/contrib/zlib/zlib.map stable/10/contrib/zlib/zutil.c stable/10/contrib/zlib/zutil.h stable/10/lib/libz/Symbol.map stable/10/lib/libz/Versions.def stable/10/lib/libz/zlib.pc Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/zlib/ChangeLog ============================================================================== --- stable/10/contrib/zlib/ChangeLog Thu Feb 16 06:16:23 2017 (r313795) +++ stable/10/contrib/zlib/ChangeLog Thu Feb 16 06:16:50 2017 (r313796) @@ -1,10 +1,53 @@ ChangeLog file for zlib +Changes in 1.2.11 (15 Jan 2017) +- Fix deflate stored bug when pulling last block from window +- Permit immediate deflateParams changes before any deflate input + +Changes in 1.2.10 (2 Jan 2017) +- Avoid warnings on snprintf() return value +- Fix bug in deflate_stored() for zero-length input +- Fix bug in gzwrite.c that produced corrupt gzip files +- Remove files to be installed before copying them in Makefile.in +- Add warnings when compiling with assembler code + +Changes in 1.2.9 (31 Dec 2016) +- Fix contrib/minizip to permit unzipping with desktop API [Zouzou] +- Improve contrib/blast to return unused bytes +- Assure that gzoffset() is correct when appending +- Improve compress() and uncompress() to support large lengths +- Fix bug in test/example.c where error code not saved +- Remedy Coverity warning [Randers-Pehrson] +- Improve speed of gzprintf() in transparent mode +- Fix inflateInit2() bug when windowBits is 16 or 32 +- Change DEBUG macro to ZLIB_DEBUG +- Avoid uninitialized access by gzclose_w() +- Allow building zlib outside of the source directory +- Fix bug that accepted invalid zlib header when windowBits is zero +- Fix gzseek() problem on MinGW due to buggy _lseeki64 there +- Loop on write() calls in gzwrite.c in case of non-blocking I/O +- Add --warn (-w) option to ./configure for more compiler warnings +- Reject a window size of 256 bytes if not using the zlib wrapper +- Fix bug when level 0 used with Z_HUFFMAN or Z_RLE +- Add --debug (-d) option to ./configure to define ZLIB_DEBUG +- Fix bugs in creating a very large gzip header +- Add uncompress2() function, which returns the input size used +- Assure that deflateParams() will not switch functions mid-block +- Dramatically speed up deflation for level 0 (storing) +- Add gzfread(), duplicating the interface of fread() +- Add gzfwrite(), duplicating the interface of fwrite() +- Add deflateGetDictionary() function +- Use snprintf() for later versions of Microsoft C +- Fix *Init macros to use z_ prefix when requested +- Replace as400 with os400 for OS/400 support [Monnerat] +- Add crc32_z() and adler32_z() functions with size_t lengths +- Update Visual Studio project files [AraHaan] + Changes in 1.2.8 (28 Apr 2013) - Update contrib/minizip/iowin32.c for Windows RT [Vollant] - Do not force Z_CONST for C++ -- Clean up contrib/vstudio [Ro§] +- Clean up contrib/vstudio [Roß] - Correct spelling error in zlib.h - Fix mixed line endings in contrib/vstudio @@ -34,7 +77,7 @@ Changes in 1.2.7.1 (24 Mar 2013) - Clean up the usage of z_const and respect const usage within zlib - Clean up examples/gzlog.[ch] comparisons of different types - Avoid shift equal to bits in type (caused endless loop) -- Fix unintialized value bug in gzputc() introduced by const patches +- Fix uninitialized value bug in gzputc() introduced by const patches - Fix memory allocation error in examples/zran.c [Nor] - Fix bug where gzopen(), gzclose() would write an empty file - Fix bug in gzclose() when gzwrite() runs out of memory @@ -194,7 +237,7 @@ Changes in 1.2.5.2 (17 Dec 2011) - Add a transparent write mode to gzopen() when 'T' is in the mode - Update python link in zlib man page - Get inffixed.h and MAKEFIXED result to match -- Add a ./config --solo option to make zlib subset with no libary use +- Add a ./config --solo option to make zlib subset with no library use - Add undocumented inflateResetKeep() function for CAB file decoding - Add --cover option to ./configure for gcc coverage testing - Add #define ZLIB_CONST option to use const in the z_stream interface @@ -564,7 +607,7 @@ Changes in 1.2.3.1 (16 August 2006) - Update make_vms.com [Zinser] - Use -fPIC for shared build in configure [Teredesai, Nicholson] - Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen] -- Use fdopen() (not _fdopen()) for Interix in zutil.h [BŠck] +- Use fdopen() (not _fdopen()) for Interix in zutil.h [Bäck] - Add some FAQ entries about the contrib directory - Update the MVS question in the FAQ - Avoid extraneous reads after EOF in gzio.c [Brown] @@ -1178,7 +1221,7 @@ Changes in 1.0.6 (19 Jan 1998) 386 asm code replacing longest_match(). contrib/iostream/ by Kevin Ruland A C++ I/O streams interface to the zlib gz* functions - contrib/iostream2/ by Tyge Løvset + contrib/iostream2/ by Tyge Løvset Another C++ I/O streams interface contrib/untgz/ by "Pedro A. Aranda Guti\irrez" A very simple tar.gz file extractor using zlib @@ -1267,7 +1310,7 @@ Changes in 1.0.1 (20 May 96) [1.0 skippe - fix array overlay in deflate.c which sometimes caused bad compressed data - fix inflate bug with empty stored block - fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generated bad compressed data. +- fix deflateParams() which could generate bad compressed data. - Bytef is define'd instead of typedef'ed (work around Borland bug) - added an INDEX file - new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), Modified: stable/10/contrib/zlib/README ============================================================================== --- stable/10/contrib/zlib/README Thu Feb 16 06:16:23 2017 (r313795) +++ stable/10/contrib/zlib/README Thu Feb 16 06:16:50 2017 (r313796) @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.8 is a general purpose data compression library. All the code is +zlib 1.2.11 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an ar issue of Dr. Dobb's Journal; a copy of the article is available at http://marknelson.us/1997/01/01/zlib-engine/ . -The changes made in version 1.2.8 are documented in the file ChangeLog. +The changes made in version 1.2.11 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -84,7 +84,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2013 Jean-loup Gailly and Mark Adler + (C) 1995-2017 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages Modified: stable/10/contrib/zlib/adler32.c ============================================================================== --- stable/10/contrib/zlib/adler32.c Thu Feb 16 06:16:23 2017 (r313795) +++ stable/10/contrib/zlib/adler32.c Thu Feb 16 06:16:50 2017 (r313796) @@ -1,5 +1,5 @@ /* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2011 Mark Adler + * Copyright (C) 1995-2011, 2016 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -7,11 +7,9 @@ #include "zutil.h" -#define local static - local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); -#define BASE 65521 /* largest prime smaller than 65536 */ +#define BASE 65521U /* largest prime smaller than 65536 */ #define NMAX 5552 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ @@ -62,10 +60,10 @@ local uLong adler32_combine_ OF((uLong a #endif /* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) +uLong ZEXPORT adler32_z(adler, buf, len) uLong adler; const Bytef *buf; - uInt len; + z_size_t len; { unsigned long sum2; unsigned n; @@ -133,6 +131,15 @@ uLong ZEXPORT adler32(adler, buf, len) } /* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + return adler32_z(adler, buf, len); +} + +/* ========================================================================= */ local uLong adler32_combine_(adler1, adler2, len2) uLong adler1; uLong adler2; @@ -156,7 +163,7 @@ local uLong adler32_combine_(adler1, adl sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; if (sum1 >= BASE) sum1 -= BASE; if (sum1 >= BASE) sum1 -= BASE; - if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); + if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1); if (sum2 >= BASE) sum2 -= BASE; return sum1 | (sum2 << 16); } Modified: stable/10/contrib/zlib/compress.c ============================================================================== --- stable/10/contrib/zlib/compress.c Thu Feb 16 06:16:23 2017 (r313795) +++ stable/10/contrib/zlib/compress.c Thu Feb 16 06:16:50 2017 (r313796) @@ -1,5 +1,5 @@ /* compress.c -- compress a memory buffer - * Copyright (C) 1995-2005 Jean-loup Gailly. + * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -28,16 +28,11 @@ int ZEXPORT compress2 (dest, destLen, so { z_stream stream; int err; + const uInt max = (uInt)-1; + uLong left; - stream.next_in = (z_const Bytef *)source; - stream.avail_in = (uInt)sourceLen; -#ifdef MAXSEG_64K - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; -#endif - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + left = *destLen; + *destLen = 0; stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; @@ -46,15 +41,26 @@ int ZEXPORT compress2 (dest, destLen, so err = deflateInit(&stream, level); if (err != Z_OK) return err; - err = deflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - deflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; - } - *destLen = stream.total_out; + stream.next_out = dest; + stream.avail_out = 0; + stream.next_in = (z_const Bytef *)source; + stream.avail_in = 0; + + do { + if (stream.avail_out == 0) { + stream.avail_out = left > (uLong)max ? max : (uInt)left; + left -= stream.avail_out; + } + if (stream.avail_in == 0) { + stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen; + sourceLen -= stream.avail_in; + } + err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH); + } while (err == Z_OK); - err = deflateEnd(&stream); - return err; + *destLen = stream.total_out; + deflateEnd(&stream); + return err == Z_STREAM_END ? Z_OK : err; } /* =========================================================================== Modified: stable/10/contrib/zlib/contrib/README.contrib ============================================================================== --- stable/10/contrib/zlib/contrib/README.contrib Thu Feb 16 06:16:23 2017 (r313795) +++ stable/10/contrib/zlib/contrib/README.contrib Thu Feb 16 06:16:50 2017 (r313796) @@ -38,7 +38,7 @@ inflate86/ by Chris Anderson A C++ I/O streams interface to the zlib gz* functions -iostream2/ by Tyge Løvset +iostream2/ by Tyge Løvset Another C++ I/O streams interface iostream3/ by Ludwig Schwardt @@ -58,7 +58,7 @@ masmx86/ by Gilles Vollant Mini zip and unzip based on zlib Includes Zip64 support by Mathias Svensson - See http://www.winimage.com/zLibDll/unzip.html + See http://www.winimage.com/zLibDll/minizip.html pascal/ by Bob Dellaca et al. Support for Pascal Modified: stable/10/contrib/zlib/crc32.c ============================================================================== --- stable/10/contrib/zlib/crc32.c Thu Feb 16 06:16:23 2017 (r313795) +++ stable/10/contrib/zlib/crc32.c Thu Feb 16 06:16:50 2017 (r313796) @@ -1,5 +1,5 @@ /* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler + * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h * * Thanks to Rodney Brown for his contribution of faster @@ -30,17 +30,15 @@ #include "zutil.h" /* for STDC and FAR definitions */ -#define local static - /* Definitions for doing the crc four data bytes at a time. */ #if !defined(NOBYFOUR) && defined(Z_U4) # define BYFOUR #endif #ifdef BYFOUR local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, unsigned)); + const unsigned char FAR *, z_size_t)); local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, unsigned)); + const unsigned char FAR *, z_size_t)); # define TBLS 8 #else # define TBLS 1 @@ -201,10 +199,10 @@ const z_crc_t FAR * ZEXPORT get_crc_tabl #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 /* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) +unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; - uInt len; + z_size_t len; { if (buf == Z_NULL) return 0UL; @@ -235,8 +233,29 @@ unsigned long ZEXPORT crc32(crc, buf, le return crc ^ 0xffffffffUL; } +/* ========================================================================= */ +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + uInt len; +{ + return crc32_z(crc, buf, len); +} + #ifdef BYFOUR +/* + This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit + integer pointer type. This violates the strict aliasing rule, where a + compiler can assume, for optimization purposes, that two pointers to + fundamentally different types won't ever point to the same memory. This can + manifest as a problem only if one of the pointers is written to. This code + only reads from those pointers. So long as this code remains isolated in + this compilation unit, there won't be a problem. For this reason, this code + should not be copied and pasted into a compilation unit in which other code + writes to the buffer that is passed to these routines. + */ + /* ========================================================================= */ #define DOLIT4 c ^= *buf4++; \ c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ @@ -247,7 +266,7 @@ unsigned long ZEXPORT crc32(crc, buf, le local unsigned long crc32_little(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; - unsigned len; + z_size_t len; { register z_crc_t c; register const z_crc_t FAR *buf4; @@ -278,7 +297,7 @@ local unsigned long crc32_little(crc, bu } /* ========================================================================= */ -#define DOBIG4 c ^= *++buf4; \ +#define DOBIG4 c ^= *buf4++; \ c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 @@ -287,7 +306,7 @@ local unsigned long crc32_little(crc, bu local unsigned long crc32_big(crc, buf, len) unsigned long crc; const unsigned char FAR *buf; - unsigned len; + z_size_t len; { register z_crc_t c; register const z_crc_t FAR *buf4; @@ -300,7 +319,6 @@ local unsigned long crc32_big(crc, buf, } buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - buf4--; while (len >= 32) { DOBIG32; len -= 32; @@ -309,7 +327,6 @@ local unsigned long crc32_big(crc, buf, DOBIG4; len -= 4; } - buf4++; buf = (const unsigned char FAR *)buf4; if (len) do { Modified: stable/10/contrib/zlib/deflate.c ============================================================================== --- stable/10/contrib/zlib/deflate.c Thu Feb 16 06:16:23 2017 (r313795) +++ stable/10/contrib/zlib/deflate.c Thu Feb 16 06:16:50 2017 (r313796) @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler "; + " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -73,6 +73,8 @@ typedef enum { typedef block_state (*compress_func) OF((deflate_state *s, int flush)); /* Compression function. Returns the block state after the call. */ +local int deflateStateCheck OF((z_streamp strm)); +local void slide_hash OF((deflate_state *s)); local void fill_window OF((deflate_state *s)); local block_state deflate_stored OF((deflate_state *s, int flush)); local block_state deflate_fast OF((deflate_state *s, int flush)); @@ -84,15 +86,16 @@ local block_state deflate_huff OF((def local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); -local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); #ifdef ASMV +# pragma message("Assembler code may have bugs -- use at your own risk") void match_init OF((void)); /* asm code initialization */ uInt longest_match OF((deflate_state *s, IPos cur_match)); #else local uInt longest_match OF((deflate_state *s, IPos cur_match)); #endif -#ifdef DEBUG +#ifdef ZLIB_DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, int length)); #endif @@ -148,21 +151,14 @@ local const config configuration_table[1 * meaning. */ -#define EQUAL 0 -/* result of memcmp for equal strings */ - -#ifndef NO_DUMMY_DECL -struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ -#endif - /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ -#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0)) +#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0)) /* =========================================================================== * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. + * IN assertion: all calls to UPDATE_HASH are made with consecutive input + * characters, so that a running hash key can be computed from the previous + * key instead of complete recalculation each time. */ #define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) @@ -173,9 +169,9 @@ struct static_tree_desc_s {int dummy;}; * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). + * IN assertion: all calls to INSERT_STRING are made with consecutive input + * characters and the first MIN_MATCH bytes of str are valid (except for + * the last MIN_MATCH-1 bytes of the input file). */ #ifdef FASTEST #define INSERT_STRING(s, str, match_head) \ @@ -197,6 +193,37 @@ struct static_tree_desc_s {int dummy;}; s->head[s->hash_size-1] = NIL; \ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); +/* =========================================================================== + * Slide the hash table when sliding the window down (could be avoided with 32 + * bit values at the expense of memory usage). We slide even when level == 0 to + * keep the hash table consistent if we switch back to level > 0 later. + */ +local void slide_hash(s) + deflate_state *s; +{ + unsigned n, m; + Posf *p; + uInt wsize = s->w_size; + + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m - wsize : NIL); + } while (--n); + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m - wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif +} + /* ========================================================================= */ int ZEXPORT deflateInit_(strm, level, version, stream_size) z_streamp strm; @@ -270,7 +297,7 @@ int ZEXPORT deflateInit2_(strm, level, m #endif if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { + strategy < 0 || strategy > Z_FIXED || (windowBits == 8 && wrap != 1)) { return Z_STREAM_ERROR; } if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ @@ -278,14 +305,15 @@ int ZEXPORT deflateInit2_(strm, level, m if (s == Z_NULL) return Z_MEM_ERROR; strm->state = (struct internal_state FAR *)s; s->strm = strm; + s->status = INIT_STATE; /* to pass state test in deflateReset() */ s->wrap = wrap; s->gzhead = Z_NULL; - s->w_bits = windowBits; + s->w_bits = (uInt)windowBits; s->w_size = 1 << s->w_bits; s->w_mask = s->w_size - 1; - s->hash_bits = memLevel + 7; + s->hash_bits = (uInt)memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); @@ -319,6 +347,31 @@ int ZEXPORT deflateInit2_(strm, level, m return deflateReset(strm); } +/* ========================================================================= + * Check for a valid deflate stream state. Return 0 if ok, 1 if not. + */ +local int deflateStateCheck (strm) + z_streamp strm; +{ + deflate_state *s; + if (strm == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) + return 1; + s = strm->state; + if (s == Z_NULL || s->strm != strm || (s->status != INIT_STATE && +#ifdef GZIP + s->status != GZIP_STATE && +#endif + s->status != EXTRA_STATE && + s->status != NAME_STATE && + s->status != COMMENT_STATE && + s->status != HCRC_STATE && + s->status != BUSY_STATE && + s->status != FINISH_STATE)) + return 1; + return 0; +} + /* ========================================================================= */ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) z_streamp strm; @@ -331,7 +384,7 @@ int ZEXPORT deflateSetDictionary (strm, unsigned avail; z_const unsigned char *next; - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) + if (deflateStateCheck(strm) || dictionary == Z_NULL) return Z_STREAM_ERROR; s = strm->state; wrap = s->wrap; @@ -389,13 +442,34 @@ int ZEXPORT deflateSetDictionary (strm, } /* ========================================================================= */ +int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) + z_streamp strm; + Bytef *dictionary; + uInt *dictLength; +{ + deflate_state *s; + uInt len; + + if (deflateStateCheck(strm)) + return Z_STREAM_ERROR; + s = strm->state; + len = s->strstart + s->lookahead; + if (len > s->w_size) + len = s->w_size; + if (dictionary != Z_NULL && len) + zmemcpy(dictionary, s->window + s->strstart + s->lookahead - len, len); + if (dictLength != Z_NULL) + *dictLength = len; + return Z_OK; +} + +/* ========================================================================= */ int ZEXPORT deflateResetKeep (strm) z_streamp strm; { deflate_state *s; - if (strm == Z_NULL || strm->state == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + if (deflateStateCheck(strm)) { return Z_STREAM_ERROR; } @@ -410,7 +484,11 @@ int ZEXPORT deflateResetKeep (strm) if (s->wrap < 0) { s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ } - s->status = s->wrap ? INIT_STATE : BUSY_STATE; + s->status = +#ifdef GZIP + s->wrap == 2 ? GZIP_STATE : +#endif + s->wrap ? INIT_STATE : BUSY_STATE; strm->adler = #ifdef GZIP s->wrap == 2 ? crc32(0L, Z_NULL, 0) : @@ -440,8 +518,8 @@ int ZEXPORT deflateSetHeader (strm, head z_streamp strm; gz_headerp head; { - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - if (strm->state->wrap != 2) return Z_STREAM_ERROR; + if (deflateStateCheck(strm) || strm->state->wrap != 2) + return Z_STREAM_ERROR; strm->state->gzhead = head; return Z_OK; } @@ -452,7 +530,7 @@ int ZEXPORT deflatePending (strm, pendin int *bits; z_streamp strm; { - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; if (pending != Z_NULL) *pending = strm->state->pending; if (bits != Z_NULL) @@ -469,7 +547,7 @@ int ZEXPORT deflatePrime (strm, bits, va deflate_state *s; int put; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; @@ -494,9 +572,8 @@ int ZEXPORT deflateParams(strm, level, s { deflate_state *s; compress_func func; - int err = Z_OK; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; #ifdef FASTEST @@ -510,13 +587,22 @@ int ZEXPORT deflateParams(strm, level, s func = configuration_table[s->level].func; if ((strategy != s->strategy || func != configuration_table[level].func) && - strm->total_in != 0) { + s->high_water) { /* Flush the last buffer: */ - err = deflate(strm, Z_BLOCK); - if (err == Z_BUF_ERROR && s->pending == 0) - err = Z_OK; + int err = deflate(strm, Z_BLOCK); + if (err == Z_STREAM_ERROR) + return err; + if (strm->avail_out == 0) + return Z_BUF_ERROR; } if (s->level != level) { + if (s->level == 0 && s->matches != 0) { + if (s->matches == 1) + slide_hash(s); + else + CLEAR_HASH(s); + s->matches = 0; + } s->level = level; s->max_lazy_match = configuration_table[level].max_lazy; s->good_match = configuration_table[level].good_length; @@ -524,7 +610,7 @@ int ZEXPORT deflateParams(strm, level, s s->max_chain_length = configuration_table[level].max_chain; } s->strategy = strategy; - return err; + return Z_OK; } /* ========================================================================= */ @@ -537,12 +623,12 @@ int ZEXPORT deflateTune(strm, good_lengt { deflate_state *s; - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; - s->good_match = good_length; - s->max_lazy_match = max_lazy; + s->good_match = (uInt)good_length; + s->max_lazy_match = (uInt)max_lazy; s->nice_match = nice_length; - s->max_chain_length = max_chain; + s->max_chain_length = (uInt)max_chain; return Z_OK; } @@ -569,14 +655,13 @@ uLong ZEXPORT deflateBound(strm, sourceL { deflate_state *s; uLong complen, wraplen; - Bytef *str; /* conservative upper bound for compressed data */ complen = sourceLen + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; /* if can't get parameters, return conservative bound plus zlib wrapper */ - if (strm == Z_NULL || strm->state == Z_NULL) + if (deflateStateCheck(strm)) return complen + 6; /* compute wrapper length */ @@ -588,9 +673,11 @@ uLong ZEXPORT deflateBound(strm, sourceL case 1: /* zlib wrapper */ wraplen = 6 + (s->strstart ? 4 : 0); break; +#ifdef GZIP case 2: /* gzip wrapper */ wraplen = 18; if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ + Bytef *str; if (s->gzhead->extra != Z_NULL) wraplen += 2 + s->gzhead->extra_len; str = s->gzhead->name; @@ -607,6 +694,7 @@ uLong ZEXPORT deflateBound(strm, sourceL wraplen += 2; } break; +#endif default: /* for compiler happiness */ wraplen = 6; } @@ -634,10 +722,10 @@ local void putShortMSB (s, b) } /* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->next_out buffer and copying into it. - * (See also read_buf()). + * Flush as much pending output as possible. All deflate() output, except for + * some deflate_stored() output, goes through this function so some + * applications may wish to modify it to avoid allocating a large + * strm->next_out buffer and copying into it. (See also read_buf()). */ local void flush_pending(strm) z_streamp strm; @@ -654,13 +742,23 @@ local void flush_pending(strm) strm->next_out += len; s->pending_out += len; strm->total_out += len; - strm->avail_out -= len; - s->pending -= len; + strm->avail_out -= len; + s->pending -= len; if (s->pending == 0) { s->pending_out = s->pending_buf; } } +/* =========================================================================== + * Update the header CRC with the bytes s->pending_buf[beg..s->pending - 1]. + */ +#define HCRC_UPDATE(beg) \ + do { \ + if (s->gzhead->hcrc && s->pending > (beg)) \ + strm->adler = crc32(strm->adler, s->pending_buf + (beg), \ + s->pending - (beg)); \ + } while (0) + /* ========================================================================= */ int ZEXPORT deflate (strm, flush) z_streamp strm; @@ -669,230 +767,229 @@ int ZEXPORT deflate (strm, flush) int old_flush; /* value of flush param for previous deflate call */ deflate_state *s; - if (strm == Z_NULL || strm->state == Z_NULL || - flush > Z_BLOCK || flush < 0) { + if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) { return Z_STREAM_ERROR; } s = strm->state; if (strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0) || + (strm->avail_in != 0 && strm->next_in == Z_NULL) || (s->status == FINISH_STATE && flush != Z_FINISH)) { ERR_RETURN(strm, Z_STREAM_ERROR); } if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); - s->strm = strm; /* just in case */ old_flush = s->last_flush; s->last_flush = flush; + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + /* Write the header */ if (s->status == INIT_STATE) { -#ifdef GZIP - if (s->wrap == 2) { - strm->adler = crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (s->gzhead == Z_NULL) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s->status = BUSY_STATE; - } - else { - put_byte(s, (s->gzhead->text ? 1 : 0) + - (s->gzhead->hcrc ? 2 : 0) + - (s->gzhead->extra == Z_NULL ? 0 : 4) + - (s->gzhead->name == Z_NULL ? 0 : 8) + - (s->gzhead->comment == Z_NULL ? 0 : 16) - ); - put_byte(s, (Byte)(s->gzhead->time & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, s->gzhead->os & 0xff); - if (s->gzhead->extra != Z_NULL) { - put_byte(s, s->gzhead->extra_len & 0xff); - put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); - } - if (s->gzhead->hcrc) - strm->adler = crc32(strm->adler, s->pending_buf, - s->pending); - s->gzindex = 0; - s->status = EXTRA_STATE; - } - } + /* zlib header */ + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; else -#endif - { - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); + s->status = BUSY_STATE; + /* Compression must start with an empty pending buffer */ + flush_pending(strm); + if (s->pending != 0) { + s->last_flush = -1; + return Z_OK; + } + } +#ifdef GZIP + if (s->status == GZIP_STATE) { + /* gzip header */ + strm->adler = crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (s->gzhead == Z_NULL) { + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); s->status = BUSY_STATE; - putShortMSB(s, header); - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); + /* Compression must start with an empty pending buffer */ + flush_pending(strm); + if (s->pending != 0) { + s->last_flush = -1; + return Z_OK; } - strm->adler = adler32(0L, Z_NULL, 0); + } + else { + put_byte(s, (s->gzhead->text ? 1 : 0) + + (s->gzhead->hcrc ? 2 : 0) + + (s->gzhead->extra == Z_NULL ? 0 : 4) + + (s->gzhead->name == Z_NULL ? 0 : 8) + + (s->gzhead->comment == Z_NULL ? 0 : 16) + ); + put_byte(s, (Byte)(s->gzhead->time & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); + put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, s->gzhead->os & 0xff); + if (s->gzhead->extra != Z_NULL) { + put_byte(s, s->gzhead->extra_len & 0xff); + put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); + } + if (s->gzhead->hcrc) + strm->adler = crc32(strm->adler, s->pending_buf, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Thu Feb 16 09:19:31 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 021B2CE090B; Thu, 16 Feb 2017 09:19:31 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D33F21234; Thu, 16 Feb 2017 09:19:30 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1G9JUje031571; Thu, 16 Feb 2017 09:19:30 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1G9JUTe031570; Thu, 16 Feb 2017 09:19:30 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201702160919.v1G9JUTe031570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Thu, 16 Feb 2017 09:19:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313803 - stable/10/usr.sbin/arp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 09:19:31 -0000 Author: garga (ports committer) Date: Thu Feb 16 09:19:29 2017 New Revision: 313803 URL: https://svnweb.freebsd.org/changeset/base/313803 Log: MFC r313477: Cleanup on usr.sbin/arp/arp.c * 'blackhole' and 'reject' are mutually exclusive, replace printf() by errx() when both are selected. * 'trail' option is no longer supported since first import of arp from 4.4BSD. XXX message was added 13 years ago in r128192. I believe it's time to remove it. * Use warnx() to print some informative messages instead of printf() * Replace strncmp() by strcmp() when validating parameters and exit when invalid parameter is found Reviewed by: allanjude, vangyzen, cem Approved by: allanjude MFC after: 1 week Sponsored by: Rubicon Communications (Netgate) Differential Revision: https://reviews.freebsd.org/D9504 Modified: stable/10/usr.sbin/arp/arp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/arp/arp.c ============================================================================== --- stable/10/usr.sbin/arp/arp.c Thu Feb 16 09:12:36 2017 (r313802) +++ stable/10/usr.sbin/arp/arp.c Thu Feb 16 09:19:29 2017 (r313803) @@ -319,7 +319,7 @@ set(int argc, char **argv) return (1); doing_proxy = flags = expire_time = 0; while (argc-- > 0) { - if (strncmp(argv[0], "temp", 4) == 0) { + if (strcmp(argv[0], "temp") == 0) { struct timespec tp; int max_age; size_t len = sizeof(max_age); @@ -329,10 +329,10 @@ set(int argc, char **argv) &max_age, &len, NULL, 0) != 0) err(1, "sysctlbyname"); expire_time = tp.tv_sec + max_age; - } else if (strncmp(argv[0], "pub", 3) == 0) { + } else if (strcmp(argv[0], "pub") == 0) { flags |= RTF_ANNOUNCE; doing_proxy = 1; - if (argc && strncmp(argv[1], "only", 3) == 0) { + if (argc && strcmp(argv[1], "only") == 0) { /* * Compatibility: in pre FreeBSD 8 times * the "only" keyword used to mean that @@ -341,29 +341,28 @@ set(int argc, char **argv) */ argc--; argv++; } - } else if (strncmp(argv[0], "blackhole", 9) == 0) { + } else if (strcmp(argv[0], "blackhole") == 0) { if (flags & RTF_REJECT) { - printf("Choose one of blackhole or reject, " + errx(1, "Choose one of blackhole or reject, " "not both."); } flags |= RTF_BLACKHOLE; - } else if (strncmp(argv[0], "reject", 6) == 0) { + } else if (strcmp(argv[0], "reject") == 0) { if (flags & RTF_BLACKHOLE) { - printf("Choose one of blackhole or reject, " + errx(1, "Choose one of blackhole or reject, " "not both."); } flags |= RTF_REJECT; - } else if (strncmp(argv[0], "trail", 5) == 0) { - /* XXX deprecated and undocumented feature */ - printf("%s: Sending trailers is no longer supported\n", - host); + } else { + warnx("Invalid parameter '%s'", argv[0]); + usage(); } argv++; } ea = (struct ether_addr *)LLADDR(&sdl_m); if (doing_proxy && !strcmp(eaddr, "auto")) { if (!get_ether_addr(dst->sin_addr.s_addr, ea)) { - printf("no interface found for %s\n", + warnx("no interface found for %s", inet_ntoa(dst->sin_addr)); return (1); } @@ -399,7 +398,7 @@ set(int argc, char **argv) if ((sdl->sdl_family != AF_LINK) || (rtm->rtm_flags & RTF_GATEWAY) || !valid_type(sdl->sdl_type)) { - printf("cannot intuit interface index and type for %s\n", host); + warnx("cannot intuit interface index and type for %s", host); return (1); } sdl_m.sdl_type = sdl->sdl_type; @@ -487,7 +486,7 @@ delete(char *host) * is a proxy-arp entry to remove. */ if (flags & RTF_ANNOUNCE) { - fprintf(stderr, "delete: cannot locate %s\n", host); + warnx("delete: cannot locate %s", host); return (1); } @@ -870,9 +869,8 @@ get_ether_addr(in_addr_t ipaddr, struct */ dla = (struct sockaddr_dl *) &ifr->ifr_addr; memcpy(hwaddr, LLADDR(dla), dla->sdl_alen); - printf("using interface %s for proxy with address ", - ifp->ifr_name); - printf("%s\n", ether_ntoa(hwaddr)); + printf("using interface %s for proxy with address %s\n", ifp->ifr_name, + ether_ntoa(hwaddr)); retval = dla->sdl_alen; done: close(sock); From owner-svn-src-stable-10@freebsd.org Thu Feb 16 17:08:45 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EADFCE1628; Thu, 16 Feb 2017 17:08:45 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2CAF111D; Thu, 16 Feb 2017 17:08:44 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1GH8iDD024333; Thu, 16 Feb 2017 17:08:44 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1GH8isV024332; Thu, 16 Feb 2017 17:08:44 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201702161708.v1GH8isV024332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Thu, 16 Feb 2017 17:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313812 - stable/10/usr.sbin/bhyve X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Feb 2017 17:08:45 -0000 Author: grehan Date: Thu Feb 16 17:08:43 2017 New Revision: 313812 URL: https://svnweb.freebsd.org/changeset/base/313812 Log: MFC r311702 Use correct PCI device id for virtio-rng. This prevented the device from attaching with a Windows guest (most other guests use the device type for matching) PR: 212711 Modified: stable/10/usr.sbin/bhyve/virtio.h Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bhyve/virtio.h ============================================================================== --- stable/10/usr.sbin/bhyve/virtio.h Thu Feb 16 17:07:20 2017 (r313811) +++ stable/10/usr.sbin/bhyve/virtio.h Thu Feb 16 17:08:43 2017 (r313812) @@ -209,7 +209,7 @@ struct vring_used { #define VIRTIO_VENDOR 0x1AF4 #define VIRTIO_DEV_NET 0x1000 #define VIRTIO_DEV_BLOCK 0x1001 -#define VIRTIO_DEV_RANDOM 0x1002 +#define VIRTIO_DEV_RANDOM 0x1005 /* * PCI config space constants. From owner-svn-src-stable-10@freebsd.org Fri Feb 17 00:38:33 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82857CE18AB; Fri, 17 Feb 2017 00:38:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F53E1FA3; Fri, 17 Feb 2017 00:38:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1H0cW6p008396; Fri, 17 Feb 2017 00:38:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1H0cWul008395; Fri, 17 Feb 2017 00:38:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201702170038.v1H0cWul008395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 17 Feb 2017 00:38:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313844 - stable/10/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2017 00:38:33 -0000 Author: kib Date: Fri Feb 17 00:38:32 2017 New Revision: 313844 URL: https://svnweb.freebsd.org/changeset/base/313844 Log: MFC r313715: Order alphabetically. Modified: stable/10/sys/sys/syscallsubr.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/syscallsubr.h ============================================================================== --- stable/10/sys/sys/syscallsubr.h Fri Feb 17 00:36:12 2017 (r313843) +++ stable/10/sys/sys/syscallsubr.h Fri Feb 17 00:38:32 2017 (r313844) @@ -158,8 +158,8 @@ int kern_mknod(struct thread *td, char * int kern_mknodat(struct thread *td, int fd, char *path, enum uio_seg pathseg, int mode, int dev); int kern_msgctl(struct thread *, int, int, struct msqid_ds *); -int kern_msgsnd(struct thread *, int, const void *, size_t, int, long); int kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *); +int kern_msgsnd(struct thread *, int, const void *, size_t, int, long); int kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt); int kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap, From owner-svn-src-stable-10@freebsd.org Fri Feb 17 00:47:45 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ACF1CE1C23; Fri, 17 Feb 2017 00:47:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB9B61806; Fri, 17 Feb 2017 00:47:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1H0lhvP012630; Fri, 17 Feb 2017 00:47:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1H0lhgZ012629; Fri, 17 Feb 2017 00:47:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201702170047.v1H0lhgZ012629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 17 Feb 2017 00:47:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313847 - stable/10/usr.sbin/kldxref X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2017 00:47:45 -0000 Author: emaste Date: Fri Feb 17 00:47:43 2017 New Revision: 313847 URL: https://svnweb.freebsd.org/changeset/base/313847 Log: MFC r313562: kldxref: s/sections/segments/ in warning message The message refers to program header segments, not sections. PR: 216975 Modified: stable/10/usr.sbin/kldxref/ef.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/kldxref/ef.c ============================================================================== --- stable/10/usr.sbin/kldxref/ef.c Fri Feb 17 00:46:16 2017 (r313846) +++ stable/10/usr.sbin/kldxref/ef.c Fri Feb 17 00:47:43 2017 (r313847) @@ -600,7 +600,7 @@ ef_open(const char *filename, struct elf filename); break; } else if (nsegs > MAXSEGS) { - warnx("%s: too many sections", filename); + warnx("%s: too many segments", filename); break; } ef->ef_nsegs = nsegs; From owner-svn-src-stable-10@freebsd.org Fri Feb 17 00:49:02 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8F9ECE1CA6; Fri, 17 Feb 2017 00:49:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 783701960; Fri, 17 Feb 2017 00:49:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1H0n1x2012748; Fri, 17 Feb 2017 00:49:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1H0n1j8012747; Fri, 17 Feb 2017 00:49:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201702170049.v1H0n1j8012747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 17 Feb 2017 00:49:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313848 - stable/10/usr.sbin/kldxref X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2017 00:49:02 -0000 Author: emaste Date: Fri Feb 17 00:49:01 2017 New Revision: 313848 URL: https://svnweb.freebsd.org/changeset/base/313848 Log: MFC r313563: kldxref: bump MAXSEGS to 3 ld.bfd generates two PT_LOAD segments, but certain linkers or linker configurations generate three PT_LOAD segments (one additional for RELRO). PR: 216975 Modified: stable/10/usr.sbin/kldxref/ef.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/kldxref/ef.c ============================================================================== --- stable/10/usr.sbin/kldxref/ef.c Fri Feb 17 00:47:43 2017 (r313847) +++ stable/10/usr.sbin/kldxref/ef.c Fri Feb 17 00:49:01 2017 (r313848) @@ -47,7 +47,7 @@ #include "ef.h" -#define MAXSEGS 2 +#define MAXSEGS 3 struct ef_file { char* ef_name; struct elf_file *ef_efile; From owner-svn-src-stable-10@freebsd.org Sat Feb 18 14:44:15 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E67ECCE3C7D; Sat, 18 Feb 2017 14:44:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEB681E74; Sat, 18 Feb 2017 14:44:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1IEiEw7048640; Sat, 18 Feb 2017 14:44:14 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1IEiE03048639; Sat, 18 Feb 2017 14:44:14 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201702181444.v1IEiE03048639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 18 Feb 2017 14:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313916 - in stable: 10/contrib/libc++/include 9/contrib/libc++/include X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2017 14:44:16 -0000 Author: dim Date: Sat Feb 18 14:44:14 2017 New Revision: 313916 URL: https://svnweb.freebsd.org/changeset/base/313916 Log: Pull in r242377 from upstream libc++ trunk (by Marshall Clow): Make sure that __libcpp_compressed_pair_imp default-constructs its' members, rather than value-initializing them. Fixes PR#24137 This ensures std::make_shared<>'s default constructor properly initializes to zero. Direct commit to stable/9 and stable/10, since stable/11 and head already have a newer version of libc++, including this fix. Reported by: martin.beran@kernun.cz PR: 217200 Modified: stable/10/contrib/libc++/include/memory Changes in other areas also in this revision: Modified: stable/9/contrib/libc++/include/memory Modified: stable/10/contrib/libc++/include/memory ============================================================================== --- stable/10/contrib/libc++/include/memory Sat Feb 18 11:43:13 2017 (r313915) +++ stable/10/contrib/libc++/include/memory Sat Feb 18 14:44:14 2017 (r313916) @@ -1950,11 +1950,11 @@ public: typedef const typename remove_reference<_T1>::type& _T1_const_reference; typedef const typename remove_reference<_T2>::type& _T2_const_reference; - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {} + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {} _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) - : __first_(_VSTD::forward<_T1_param>(__t1)) {} + : __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {} _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) - : __second_(_VSTD::forward<_T2_param>(__t2)) {} + : __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {} _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) : __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {} @@ -2043,9 +2043,9 @@ public: typedef const _T1& _T1_const_reference; typedef const typename remove_reference<_T2>::type& _T2_const_reference; - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {} + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {} _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) - : _T1(_VSTD::forward<_T1_param>(__t1)) {} + : _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {} _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) : __second_(_VSTD::forward<_T2_param>(__t2)) {} _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) @@ -2133,11 +2133,11 @@ public: typedef const typename remove_reference<_T1>::type& _T1_const_reference; typedef const _T2& _T2_const_reference; - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {} + _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {} _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) : __first_(_VSTD::forward<_T1_param>(__t1)) {} _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) - : _T2(_VSTD::forward<_T2_param>(__t2)) {} + : _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {} _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value && is_nothrow_move_constructible<_T2>::value) From owner-svn-src-stable-10@freebsd.org Sat Feb 18 21:59:21 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D66F6CE4BCC; Sat, 18 Feb 2017 21:59:21 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E9EE1CB7; Sat, 18 Feb 2017 21:59:21 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1ILxKT5030091; Sat, 18 Feb 2017 21:59:20 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1ILxJls030080; Sat, 18 Feb 2017 21:59:19 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201702182159.v1ILxJls030080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Sat, 18 Feb 2017 21:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313927 - in stable/10/contrib/libarchive/libarchive: . test X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2017 21:59:22 -0000 Author: mm Date: Sat Feb 18 21:59:19 2017 New Revision: 313927 URL: https://svnweb.freebsd.org/changeset/base/313927 Log: MFC r313572,313782 Sync libarchive with vendor. MFC r313572: Vendor bugfixes: cpio reader sanity fix (OSS-Fuzz 504) WARC reader sanity fixes (OSS-Fuzz 511, 526, 532, 552) mtree reader time parsing fix (OSS-Fuzz 538) XAR reader memleak fix (OSS-Fuzz 551) MFC r313782: Vendor changes: Make SCHILY.acl.ace header more compact (NFSv4 ACLs) Vendor bugfixes: zip reader integer parsing fix (OSS-Fuzz 556) spelling fixes (issue #863) Modified: stable/10/contrib/libarchive/libarchive/archive_acl.c stable/10/contrib/libarchive/libarchive/archive_entry.h stable/10/contrib/libarchive/libarchive/archive_entry_acl.3 stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c stable/10/contrib/libarchive/libarchive/archive_write_disk_acl.c stable/10/contrib/libarchive/libarchive/archive_write_set_format_pax.c stable/10/contrib/libarchive/libarchive/test/test_acl_pax_nfs4.tar.uu stable/10/contrib/libarchive/libarchive/test/test_acl_platform_posix1e.c stable/10/contrib/libarchive/libarchive/test/test_acl_text.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_acl.c Sat Feb 18 21:58:56 2017 (r313926) +++ stable/10/contrib/libarchive/libarchive/archive_acl.c Sat Feb 18 21:59:19 2017 (r313927) @@ -83,6 +83,50 @@ static void append_entry(char **p, const int tag, int flags, const char *name, int perm, int id); static void append_id(char **p, int id); +static const struct { + const int perm; + const char c; + const wchar_t wc; +} nfsv4_acl_perm_map[] = { + { ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, 'r', + L'r' }, + { ARCHIVE_ENTRY_ACL_WRITE_DATA | ARCHIVE_ENTRY_ACL_ADD_FILE, 'w', + L'w' }, + { ARCHIVE_ENTRY_ACL_EXECUTE, 'x', L'x' }, + { ARCHIVE_ENTRY_ACL_APPEND_DATA | ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, + 'p', L'p' }, + { ARCHIVE_ENTRY_ACL_DELETE, 'd', L'd' }, + { ARCHIVE_ENTRY_ACL_DELETE_CHILD, 'D', L'D' }, + { ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, 'a', L'a' }, + { ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, 'A', L'A' }, + { ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, 'R', L'R' }, + { ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, 'W', L'W' }, + { ARCHIVE_ENTRY_ACL_READ_ACL, 'c', L'c' }, + { ARCHIVE_ENTRY_ACL_WRITE_ACL, 'C', L'C' }, + { ARCHIVE_ENTRY_ACL_WRITE_OWNER, 'o', L'o' }, + { ARCHIVE_ENTRY_ACL_SYNCHRONIZE, 's', L's' } +}; + +static const int nfsv4_acl_perm_map_size = (int)(sizeof(nfsv4_acl_perm_map) / + sizeof(nfsv4_acl_perm_map[0])); + +static const struct { + const int perm; + const char c; + const wchar_t wc; +} nfsv4_acl_flag_map[] = { + { ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, 'f', L'f' }, + { ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, 'd', L'd' }, + { ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, 'i', L'i' }, + { ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, 'n', L'n' }, + { ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, 'S', L'S' }, + { ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, 'F', L'F' }, + { ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, 'I', L'I' } +}; + +static const int nfsv4_acl_flag_map_size = (int)(sizeof(nfsv4_acl_flag_map) / + sizeof(nfsv4_acl_flag_map[0])); + void archive_acl_clear(struct archive_acl *acl) { @@ -741,6 +785,8 @@ static void append_entry_w(wchar_t **wp, const wchar_t *prefix, int type, int tag, int flags, const wchar_t *wname, int perm, int id) { + int i; + if (prefix != NULL) { wcscpy(*wp, prefix); *wp += wcslen(*wp); @@ -810,46 +856,20 @@ append_entry_w(wchar_t **wp, const wchar *(*wp)++ = (perm & 0222) ? L'w' : L'-'; *(*wp)++ = (perm & 0111) ? L'x' : L'-'; } else { - /* NFS4 ACL perms */ - *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_READ_DATA | - ARCHIVE_ENTRY_ACL_LIST_DIRECTORY)) ? L'r' : L'-'; - *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_WRITE_DATA | - ARCHIVE_ENTRY_ACL_ADD_FILE)) ? L'w' : L'-'; - *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_EXECUTE) ? L'x' : L'-'; - *(*wp)++ = (perm & (ARCHIVE_ENTRY_ACL_APPEND_DATA | - ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY)) ? L'p' : L'-'; - *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE) ? L'd' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_DELETE_CHILD) ? L'D' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES) ? L'a' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES) ? L'A' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS) ? L'R' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS) ? L'W' : L'-'; - *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_READ_ACL) ? L'c' : L'-'; - *(*wp)++ = (perm & ARCHIVE_ENTRY_ACL_WRITE_ACL) ? L'C' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_WRITE_OWNER) ? L'o' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_SYNCHRONIZE) ? L's' : L'-'; + /* NFSv4 ACL perms */ + for (i = 0; i < nfsv4_acl_perm_map_size; i++) { + if (perm & nfsv4_acl_perm_map[i].perm) + *(*wp)++ = nfsv4_acl_perm_map[i].wc; + else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0) + *(*wp)++ = L'-'; + } *(*wp)++ = L':'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT) ? L'f' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT) ? L'd' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY) ? L'i' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT) ? L'n' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS) ? L'S' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS) ? L'F' : L'-'; - *(*wp)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_INHERITED) ? L'I' : L'-'; + for (i = 0; i < nfsv4_acl_flag_map_size; i++) { + if (perm & nfsv4_acl_flag_map[i].perm) + *(*wp)++ = nfsv4_acl_flag_map[i].wc; + else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0) + *(*wp)++ = L'-'; + } *(*wp)++ = L':'; switch (type) { case ARCHIVE_ENTRY_ACL_TYPE_ALLOW: @@ -998,6 +1018,8 @@ static void append_entry(char **p, const char *prefix, int type, int tag, int flags, const char *name, int perm, int id) { + int i; + if (prefix != NULL) { strcpy(*p, prefix); *p += strlen(*p); @@ -1067,47 +1089,20 @@ append_entry(char **p, const char *prefi *(*p)++ = (perm & 0222) ? 'w' : '-'; *(*p)++ = (perm & 0111) ? 'x' : '-'; } else { - /* NFS4 ACL perms */ - *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_READ_DATA | - ARCHIVE_ENTRY_ACL_LIST_DIRECTORY)) ? 'r' : '-'; - *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_WRITE_DATA | - ARCHIVE_ENTRY_ACL_ADD_FILE)) ? 'w' : '-'; - *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_EXECUTE)) ? 'x' : '-'; - *(*p)++ = (perm & (ARCHIVE_ENTRY_ACL_APPEND_DATA | - ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY)) ? 'p' : '-'; - *(*p)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE) ? 'd' : '-'; - *(*p)++ = (perm & ARCHIVE_ENTRY_ACL_DELETE_CHILD) ? 'D' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES) ? 'a' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES) ? 'A' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS) ? 'R' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS) ? 'W' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_READ_ACL) ? 'c' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_WRITE_ACL) ? 'C' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_WRITE_OWNER) ? 'o' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_SYNCHRONIZE) ? 's' : '-'; + /* NFSv4 ACL perms */ + for (i = 0; i < nfsv4_acl_perm_map_size; i++) { + if (perm & nfsv4_acl_perm_map[i].perm) + *(*p)++ = nfsv4_acl_perm_map[i].c; + else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0) + *(*p)++ = '-'; + } *(*p)++ = ':'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT) ? 'f' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT) ? 'd' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY) ? 'i' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT) ? 'n' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS) ? 'S' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS) ? 'F' : '-'; - *(*p)++ = (perm & - ARCHIVE_ENTRY_ACL_ENTRY_INHERITED) ? 'I' : '-'; + for (i = 0; i < nfsv4_acl_flag_map_size; i++) { + if (perm & nfsv4_acl_flag_map[i].perm) + *(*p)++ = nfsv4_acl_flag_map[i].c; + else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0) + *(*p)++ = '-'; + } *(*p)++ = ':'; switch (type) { case ARCHIVE_ENTRY_ACL_TYPE_ALLOW: @@ -1467,11 +1462,8 @@ ismode_w(const wchar_t *start, const wch static int is_nfs4_perms_w(const wchar_t *start, const wchar_t *end, int *permset) { - const wchar_t *p; + const wchar_t *p = start; - if (start >= end) - return (0); - p = start; while (p < end) { switch (*p++) { case L'r': @@ -1533,11 +1525,8 @@ is_nfs4_perms_w(const wchar_t *start, co static int is_nfs4_flags_w(const wchar_t *start, const wchar_t *end, int *permset) { - const wchar_t *p; + const wchar_t *p = start; - if (start >= end) - return (0); - p = start; while (p < end) { switch(*p++) { case L'f': @@ -1945,11 +1934,8 @@ ismode(const char *start, const char *en static int is_nfs4_perms(const char *start, const char *end, int *permset) { - const char *p; + const char *p = start; - if (start >= end) - return (0); - p = start; while (p < end) { switch (*p++) { case 'r': @@ -2011,11 +1997,8 @@ is_nfs4_perms(const char *start, const c static int is_nfs4_flags(const char *start, const char *end, int *permset) { - const char *p; + const char *p = start; - if (start >= end) - return (0); - p = start; while (p < end) { switch(*p++) { case 'f': Modified: stable/10/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_entry.h Sat Feb 18 21:58:56 2017 (r313926) +++ stable/10/contrib/libarchive/libarchive/archive_entry.h Sat Feb 18 21:59:19 2017 (r313927) @@ -509,6 +509,10 @@ __LA_DECL int archive_entry_acl_next_w( * ARCHIVE_ENTRY_ACL_STYLE_SOLARIS - Output only one colon after "other" and * "mask" entries. * + * Flags only for archive entries with NFSv4 ACL: + * ARCHIVE_ENTRY_ACL_STYLE_COMPACT - Do not output the minus character for + * unset permissions and flags in NFSv4 ACL permission and flag fields + * * Flags for for archive entries with POSIX.1e ACL or NFSv4 ACL: * ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in * each ACL entry. @@ -519,6 +523,7 @@ __LA_DECL int archive_entry_acl_next_w( #define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 0x00000002 #define ARCHIVE_ENTRY_ACL_STYLE_SOLARIS 0x00000004 #define ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA 0x00000008 +#define ARCHIVE_ENTRY_ACL_STYLE_COMPACT 0x00000010 __LA_DECL wchar_t *archive_entry_acl_to_text_w(struct archive_entry *, ssize_t * /* len */, int /* flags */); Modified: stable/10/contrib/libarchive/libarchive/archive_entry_acl.3 ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_entry_acl.3 Sat Feb 18 21:58:56 2017 (r313926) +++ stable/10/contrib/libarchive/libarchive/archive_entry_acl.3 Sat Feb 18 21:59:19 2017 (r313927) @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd December 27, 2016 +.Dd February 15, 2017 .Dt ARCHIVE_ENTRY_ACL 3 .Os .Sh NAME @@ -390,6 +390,13 @@ Prefix each default ACL entry with the w The mask and other ACLs don not contain a double colon. .El .Pp +The following flags are effecive only on NFSv4 ACL: +.Bl -tag -offset indent -compact -width ARCHIV +.It Dv ARCHIVE_ENTRY_ACL_STYLE_COMPACT +Do not output minus characters for unset permissions and flags in NFSv4 ACL +permission and flag fields. +.El +.Pp The following flags are effective on both POSIX.1e and NFSv4 ACL: .Bl -tag -offset indent -compact -width ARCHIV .It Dv ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID Modified: stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Sat Feb 18 21:58:56 2017 (r313926) +++ stable/10/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Sat Feb 18 21:59:19 2017 (r313927) @@ -618,9 +618,9 @@ setup_acls(struct archive_read_disk *a, /* * Translate system ACL permissions into libarchive internal structure */ -static struct { - int archive_perm; - int platform_perm; +static const struct { + const int archive_perm; + const int platform_perm; } acl_perm_map[] = { #if HAVE_SUN_ACL /* Solaris NFSv4 ACL permissions */ {ARCHIVE_ENTRY_ACL_EXECUTE, ACE_EXECUTE}, @@ -687,9 +687,9 @@ static struct { /* * Translate system NFSv4 inheritance flags into libarchive internal structure */ -static struct { - int archive_inherit; - int platform_inherit; +static const struct { + const int archive_inherit; + const int platform_inherit; } acl_inherit_map[] = { #if HAVE_SUN_ACL /* Solaris ACL inheritance flags */ {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACE_FILE_INHERIT_ACE}, @@ -882,7 +882,7 @@ sun_acl_is_trivial(acl_t *acl, mode_t mo /* * POSIX.1e ACLs marked with ACL_IS_TRIVIAL are compatible with * FreeBSD acl_is_trivial_np(). On Solaris they have 4 entries, - * incuding mask. + * including mask. */ if (acl->acl_type == ACLENT_T) { if (acl->acl_cnt == 4) Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c Sat Feb 18 21:58:56 2017 (r313926) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c Sat Feb 18 21:59:19 2017 (r313927) @@ -452,26 +452,38 @@ process_extra(struct archive_read *a, co /* Zip64 extended information extra field. */ zip_entry->flags |= LA_USED_ZIP64; if (zip_entry->uncompressed_size == 0xffffffff) { - if (datasize < 8) - break; - zip_entry->uncompressed_size = - archive_le64dec(p + offset); + uint64_t t = 0; + if (datasize < 8 + || (t = archive_le64dec(p + offset)) > INT64_MAX) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Malformed 64-bit uncompressed size"); + return ARCHIVE_FAILED; + } + zip_entry->uncompressed_size = t; offset += 8; datasize -= 8; } if (zip_entry->compressed_size == 0xffffffff) { - if (datasize < 8) - break; - zip_entry->compressed_size = - archive_le64dec(p + offset); + uint64_t t = 0; + if (datasize < 8 + || (t = archive_le64dec(p + offset)) > INT64_MAX) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Malformed 64-bit compressed size"); + return ARCHIVE_FAILED; + } + zip_entry->compressed_size = t; offset += 8; datasize -= 8; } if (zip_entry->local_header_offset == 0xffffffff) { - if (datasize < 8) - break; - zip_entry->local_header_offset = - archive_le64dec(p + offset); + uint64_t t = 0; + if (datasize < 8 + || (t = archive_le64dec(p + offset)) > INT64_MAX) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Malformed 64-bit local header offset"); + return ARCHIVE_FAILED; + } + zip_entry->local_header_offset = t; offset += 8; datasize -= 8; } @@ -1156,11 +1168,18 @@ zip_read_data_none(struct archive_read * || (zip->hctx_valid && zip->entry->aes_extra.vendor == AES_VENDOR_AE_2))) { if (zip->entry->flags & LA_USED_ZIP64) { + uint64_t compressed, uncompressed; zip->entry->crc32 = archive_le32dec(p + 4); - zip->entry->compressed_size = - archive_le64dec(p + 8); - zip->entry->uncompressed_size = - archive_le64dec(p + 16); + compressed = archive_le64dec(p + 8); + uncompressed = archive_le64dec(p + 16); + if (compressed > INT64_MAX || uncompressed > INT64_MAX) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Overflow of 64-bit file sizes"); + return ARCHIVE_FAILED; + } + zip->entry->compressed_size = compressed; + zip->entry->uncompressed_size = uncompressed; zip->unconsumed = 24; } else { zip->entry->crc32 = archive_le32dec(p + 4); @@ -1437,9 +1456,18 @@ zip_read_data_deflate(struct archive_rea zip->unconsumed = 4; } if (zip->entry->flags & LA_USED_ZIP64) { + uint64_t compressed, uncompressed; zip->entry->crc32 = archive_le32dec(p); - zip->entry->compressed_size = archive_le64dec(p + 4); - zip->entry->uncompressed_size = archive_le64dec(p + 12); + compressed = archive_le64dec(p + 4); + uncompressed = archive_le64dec(p + 12); + if (compressed > INT64_MAX || uncompressed > INT64_MAX) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Overflow of 64-bit file sizes"); + return ARCHIVE_FAILED; + } + zip->entry->compressed_size = compressed; + zip->entry->uncompressed_size = uncompressed; zip->unconsumed += 20; } else { zip->entry->crc32 = archive_le32dec(p); Modified: stable/10/contrib/libarchive/libarchive/archive_write_disk_acl.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_write_disk_acl.c Sat Feb 18 21:58:56 2017 (r313926) +++ stable/10/contrib/libarchive/libarchive/archive_write_disk_acl.c Sat Feb 18 21:59:19 2017 (r313927) @@ -101,7 +101,7 @@ archive_write_disk_set_acls(struct archi ACL_TYPE_DEFAULT, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default"); #endif /* !HAVE_SUN_ACL */ - /* Simultaeous POSIX.1e and NFSv4 is not supported */ + /* Simultaneous POSIX.1e and NFSv4 is not supported */ return (ret); } #endif /* !HAVE_DARWIN_ACL */ @@ -119,9 +119,9 @@ archive_write_disk_set_acls(struct archi /* * Translate system ACL permissions into libarchive internal structure */ -static struct { - int archive_perm; - int platform_perm; +static const struct { + const int archive_perm; + const int platform_perm; } acl_perm_map[] = { #if HAVE_SUN_ACL /* Solaris NFSv4 ACL permissions */ {ARCHIVE_ENTRY_ACL_EXECUTE, ACE_EXECUTE}, @@ -188,9 +188,9 @@ static struct { /* * Translate system NFSv4 inheritance flags into libarchive internal structure */ -static struct { - int archive_inherit; - int platform_inherit; +static const struct { + const int archive_inherit; + const int platform_inherit; } acl_inherit_map[] = { #if HAVE_SUN_ACL /* Solaris NFSv4 inheritance flags */ {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACE_FILE_INHERIT_ACE}, Modified: stable/10/contrib/libarchive/libarchive/archive_write_set_format_pax.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_write_set_format_pax.c Sat Feb 18 21:58:56 2017 (r313926) +++ stable/10/contrib/libarchive/libarchive/archive_write_set_format_pax.c Sat Feb 18 21:59:19 2017 (r313927) @@ -1166,7 +1166,8 @@ archive_write_pax_header(struct archive_ if ((acl_types & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { ret = add_pax_acl(a, entry_original, pax, ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID | - ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA); + ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA | + ARCHIVE_ENTRY_ACL_STYLE_COMPACT); if (ret == ARCHIVE_FATAL) return (ARCHIVE_FATAL); } Modified: stable/10/contrib/libarchive/libarchive/test/test_acl_pax_nfs4.tar.uu ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_acl_pax_nfs4.tar.uu Sat Feb 18 21:58:56 2017 (r313926) +++ stable/10/contrib/libarchive/libarchive/test/test_acl_pax_nfs4.tar.uu Sat Feb 18 21:59:19 2017 (r313927) @@ -1,8 +1,8 @@ begin 644 test_acl_pax_nfs4.tar M4&%X2&5A9&5R+V9I;&4````````````````````````````````````````` M```````````````````````````````````````````````````````````` -M`````````````#`P,#``````````````````````````````` +M`````````````#`P,#``````````````````````````````` M```````````````````````````````````````````````````````````` M``````````````````````````````````````````!U'`M+6%!4E=C0V]S.BTM+2TM+2TZ86QL;W``````````````````````` +M,#`P,C4V(#`P,#`P,#`P,#`P(#`Q,C`Q,@`@>``````````````````````` M```````````````````````````````````````````````````````````` M``````````````````````````````````````````````````!U#HZ9&5N>3HW."QG``````````````` +M`#`P,#`P,#`P,C8R(#`P,#`P,#`P,#`P(#`Q,C`P-P`@>``````````````` M```````````````````````````````````````````````````````````` M``````````````````````````````````````````````````````````!U M'`M+6%!4E=C0V]S.BTM+2TM+2TZ86QL;W6]N94`Z'!A05)78T-O Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30C0DCE5167; Sat, 18 Feb 2017 22:13:30 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6293CFC; Sat, 18 Feb 2017 22:13:29 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1IMDS7A038416; Sat, 18 Feb 2017 22:13:28 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1IMDSh2038412; Sat, 18 Feb 2017 22:13:28 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201702182213.v1IMDSh2038412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Sat, 18 Feb 2017 22:13:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r313929 - stable/10/contrib/libarchive/libarchive X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2017 22:13:30 -0000 Author: mm Date: Sat Feb 18 22:13:28 2017 New Revision: 313929 URL: https://svnweb.freebsd.org/changeset/base/313929 Log: Fix incomplete merge in r313927: MFC r313572: Vendor bugfixes: cpio reader sanity fix (OSS-Fuzz 504) WARC reader sanity fixes (OSS-Fuzz 511, 526, 532, 552) mtree reader time parsing fix (OSS-Fuzz 538) XAR reader memleak fix (OSS-Fuzz 551) Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_cpio.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_mtree.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_warc.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_xar.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_cpio.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Sat Feb 18 22:06:03 2017 (r313928) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Sat Feb 18 22:13:28 2017 (r313929) @@ -356,7 +356,7 @@ archive_read_format_cpio_read_header(str struct archive_entry *entry) { struct cpio *cpio; - const void *h; + const void *h, *hl; struct archive_string_conv *sconv; size_t namelength; size_t name_pad; @@ -406,11 +406,11 @@ archive_read_format_cpio_read_header(str "Rejecting malformed cpio archive: symlink contents exceed 1 megabyte"); return (ARCHIVE_FATAL); } - h = __archive_read_ahead(a, + hl = __archive_read_ahead(a, (size_t)cpio->entry_bytes_remaining, NULL); - if (h == NULL) + if (hl == NULL) return (ARCHIVE_FATAL); - if (archive_entry_copy_symlink_l(entry, (const char *)h, + if (archive_entry_copy_symlink_l(entry, (const char *)hl, (size_t)cpio->entry_bytes_remaining, sconv) != 0) { if (errno == ENOMEM) { archive_set_error(&a->archive, ENOMEM, @@ -434,7 +434,7 @@ archive_read_format_cpio_read_header(str * header. XXX */ /* Compare name to "TRAILER!!!" to test for end-of-archive. */ - if (namelength == 11 && memcmp((const char *)h, "TRAILER!!!", + if (namelength == 11 && strncmp((const char *)h, "TRAILER!!!", 11) == 0) { /* TODO: Store file location of start of block. */ archive_clear_error(&a->archive); Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Sat Feb 18 22:06:03 2017 (r313928) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Sat Feb 18 22:13:28 2017 (r313929) @@ -1608,8 +1608,11 @@ parse_keyword(struct archive_read *a, st if (*val == '.') { ++val; ns = (long)mtree_atol10(&val); - } else - ns = 0; + if (ns < 0) + ns = 0; + else if (ns > 999999999) + ns = 999999999; + } if (m > my_time_t_max) m = my_time_t_max; else if (m < my_time_t_min) Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_warc.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_warc.c Sat Feb 18 22:06:03 2017 (r313928) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_warc.c Sat Feb 18 22:13:28 2017 (r313929) @@ -134,8 +134,8 @@ static ssize_t _warc_rdlen(const char *b static time_t _warc_rdrtm(const char *buf, size_t bsz); static time_t _warc_rdmtm(const char *buf, size_t bsz); static const char *_warc_find_eoh(const char *buf, size_t bsz); +static const char *_warc_find_eol(const char *buf, size_t bsz); - int archive_read_support_format_warc(struct archive *_a) { @@ -198,8 +198,8 @@ _warc_bid(struct archive_read *a, int be /* otherwise snarf the record's version number */ ver = _warc_rdver(hdr, nrd); - if (ver == 0U || ver > 10000U) { - /* oh oh oh, best not to wager ... */ + if (ver < 1200U || ver > 10000U) { + /* we only support WARC 0.12 to 1.0 */ return -1; } @@ -254,23 +254,32 @@ start_over: &a->archive, ARCHIVE_ERRNO_MISC, "Bad record header"); return (ARCHIVE_FATAL); - } else if ((ver = _warc_rdver(buf, eoh - buf)) > 10000U) { - /* nawww, I wish they promised backward compatibility - * anyhoo, in their infinite wisdom the 28500 guys might - * come up with something we can't possibly handle so - * best end things here */ + } + ver = _warc_rdver(buf, eoh - buf); + /* we currently support WARC 0.12 to 1.0 */ + if (ver == 0U) { archive_set_error( &a->archive, ARCHIVE_ERRNO_MISC, - "Unsupported record version"); + "Invalid record version"); return (ARCHIVE_FATAL); - } else if ((cntlen = _warc_rdlen(buf, eoh - buf)) < 0) { + } else if (ver < 1200U || ver > 10000U) { + archive_set_error( + &a->archive, ARCHIVE_ERRNO_MISC, + "Unsupported record version: %u.%u", + ver / 10000, (ver % 10000) / 100); + return (ARCHIVE_FATAL); + } + cntlen = _warc_rdlen(buf, eoh - buf); + if (cntlen < 0) { /* nightmare! the specs say content-length is mandatory * so I don't feel overly bad stopping the reader here */ archive_set_error( &a->archive, EINVAL, "Bad content length"); return (ARCHIVE_FATAL); - } else if ((rtime = _warc_rdrtm(buf, eoh - buf)) == (time_t)-1) { + } + rtime = _warc_rdrtm(buf, eoh - buf); + if (rtime == (time_t)-1) { /* record time is mandatory as per WARC/1.0, * so just barf here, fast and loud */ archive_set_error( @@ -284,7 +293,7 @@ start_over: if (ver != w->pver) { /* stringify this entry's version */ archive_string_sprintf(&w->sver, - "WARC/%u.%u", ver / 10000, ver % 10000); + "WARC/%u.%u", ver / 10000, (ver % 10000) / 100); /* remember the version */ w->pver = ver; } @@ -577,51 +586,41 @@ out: } static unsigned int -_warc_rdver(const char buf[10], size_t bsz) +_warc_rdver(const char *buf, size_t bsz) { static const char magic[] = "WARC/"; - unsigned int ver; - - (void)bsz; /* UNUSED */ + unsigned int ver = 0U; + unsigned int end = 0U; - if (memcmp(buf, magic, sizeof(magic) - 1U) != 0) { - /* nope */ - return 99999U; + if (bsz < 12 || memcmp(buf, magic, sizeof(magic) - 1U) != 0) { + /* buffer too small or invalid magic */ + return ver; } /* looks good so far, read the version number for a laugh */ buf += sizeof(magic) - 1U; - /* most common case gets a quick-check here */ - if (memcmp(buf, "1.0\r\n", 5U) == 0) { - ver = 10000U; - } else { - switch (*buf) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - if (buf[1U] == '.') { - char *on; - - /* set up major version */ - ver = (buf[0U] - '0') * 10000U; - /* minor version, anyone? */ - ver += (strtol(buf + 2U, &on, 10)) * 100U; - /* don't parse anything else */ - if (on > buf + 2U) { - break; - } - } - /* FALLTHROUGH */ - case '9': - default: - /* just make the version ridiculously high */ - ver = 999999U; - break; + + if (isdigit(buf[0U]) && (buf[1U] == '.') && isdigit(buf[2U])) { + /* we support a maximum of 2 digits in the minor version */ + if (isdigit(buf[3U])) + end = 1U; + /* set up major version */ + ver = (buf[0U] - '0') * 10000U; + /* set up minor version */ + if (end == 1U) { + ver += (buf[2U] - '0') * 1000U; + ver += (buf[3U] - '0') * 100U; + } else + ver += (buf[2U] - '0') * 100U; + /* + * WARC below version 0.12 has a space-separated header + * WARC 0.12 and above terminates the version with a CRLF + */ + if (ver >= 1200U) { + if (memcmp(buf + 3U + end, "\r\n", 2U) != 0) + ver = 0U; + } else if (ver < 1200U) { + if (!isblank(*(buf + 3U + end))) + ver = 0U; } } return ver; @@ -631,34 +630,27 @@ static unsigned int _warc_rdtyp(const char *buf, size_t bsz) { static const char _key[] = "\r\nWARC-Type:"; - const char *const eob = buf + bsz; - const char *val; + const char *val, *eol; if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) { /* no bother */ return WT_NONE; } - /* overread whitespace */ val += sizeof(_key) - 1U; - while (val < eob && isspace((unsigned char)*val)) + if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL) { + /* no end of line */ + return WT_NONE; + } + + /* overread whitespace */ + while (val < eol && isblank((unsigned char)*val)) ++val; - if (val + 8U > eob) { - ; - } else if (memcmp(val, "resource", 8U) == 0) { - return WT_RSRC; - } else if (memcmp(val, "warcinfo", 8U) == 0) { - return WT_INFO; - } else if (memcmp(val, "metadata", 8U) == 0) { - return WT_META; - } else if (memcmp(val, "request", 7U) == 0) { - return WT_REQ; - } else if (memcmp(val, "response", 8U) == 0) { - return WT_RSP; - } else if (memcmp(val, "conversi", 8U) == 0) { - return WT_CONV; - } else if (memcmp(val, "continua", 8U) == 0) { - return WT_CONT; + if (val + 8U == eol) { + if (memcmp(val, "resource", 8U) == 0) + return WT_RSRC; + else if (memcmp(val, "response", 8U) == 0) + return WT_RSP; } return WT_NONE; } @@ -667,10 +659,7 @@ static warc_string_t _warc_rduri(const char *buf, size_t bsz) { static const char _key[] = "\r\nWARC-Target-URI:"; - const char *const eob = buf + bsz; - const char *val; - const char *uri; - const char *eol; + const char *val, *uri, *eol, *p; warc_string_t res = {0U, NULL}; if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) { @@ -679,25 +668,32 @@ _warc_rduri(const char *buf, size_t bsz) } /* overread whitespace */ val += sizeof(_key) - 1U; - while (val < eob && isspace((unsigned char)*val)) + if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL) { + /* no end of line */ + return res; + } + + while (val < eol && isblank((unsigned char)*val)) ++val; /* overread URL designators */ - if ((uri = xmemmem(val, eob - val, "://", 3U)) == NULL) { + if ((uri = xmemmem(val, eol - val, "://", 3U)) == NULL) { /* not touching that! */ return res; - } else if ((eol = memchr(uri, '\n', eob - uri)) == NULL) { - /* no end of line? :O */ - return res; } - /* massage uri to point to after :// */ + /* spaces inside uri are not allowed, CRLF should follow */ + for (p = val; p < eol; p++) { + if (isspace(*p)) + return res; + } + + /* there must be at least space for ftp */ + if (uri < (val + 3U)) + return res; + + /* move uri to point to after :// */ uri += 3U; - /* also massage eol to point to the first whitespace - * after the last non-whitespace character before - * the end of the line */ - while (eol > uri && isspace((unsigned char)eol[-1])) - --eol; /* now then, inspect the URI */ if (memcmp(val, "file", 4U) == 0) { @@ -720,7 +716,7 @@ static ssize_t _warc_rdlen(const char *buf, size_t bsz) { static const char _key[] = "\r\nContent-Length:"; - const char *val; + const char *val, *eol; char *on = NULL; long int len; @@ -728,14 +724,24 @@ _warc_rdlen(const char *buf, size_t bsz) /* no bother */ return -1; } - - /* strtol kindly overreads whitespace for us, so use that */ val += sizeof(_key) - 1U; + if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL) { + /* no end of line */ + return -1; + } + + /* skip leading whitespace */ + while (val < eol && isblank(*val)) + val++; + /* there must be at least one digit */ + if (!isdigit(*val)) + return -1; len = strtol(val, &on, 10); - if (on == NULL || !isspace((unsigned char)*on)) { - /* hm, can we trust that number? Best not. */ + if (on != eol) { + /* line must end here */ return -1; } + return (size_t)len; } @@ -743,7 +749,7 @@ static time_t _warc_rdrtm(const char *buf, size_t bsz) { static const char _key[] = "\r\nWARC-Date:"; - const char *val; + const char *val, *eol; char *on = NULL; time_t res; @@ -751,13 +757,17 @@ _warc_rdrtm(const char *buf, size_t bsz) /* no bother */ return (time_t)-1; } + val += sizeof(_key) - 1U; + if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL ) { + /* no end of line */ + return -1; + } /* xstrpisotime() kindly overreads whitespace for us, so use that */ - val += sizeof(_key) - 1U; res = xstrpisotime(val, &on); - if (on == NULL || !isspace((unsigned char)*on)) { - /* hm, can we trust that number? Best not. */ - return (time_t)-1; + if (on != eol) { + /* line must end here */ + return -1; } return res; } @@ -766,7 +776,7 @@ static time_t _warc_rdmtm(const char *buf, size_t bsz) { static const char _key[] = "\r\nLast-Modified:"; - const char *val; + const char *val, *eol; char *on = NULL; time_t res; @@ -774,13 +784,17 @@ _warc_rdmtm(const char *buf, size_t bsz) /* no bother */ return (time_t)-1; } + val += sizeof(_key) - 1U; + if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL ) { + /* no end of line */ + return -1; + } /* xstrpisotime() kindly overreads whitespace for us, so use that */ - val += sizeof(_key) - 1U; res = xstrpisotime(val, &on); - if (on == NULL || !isspace((unsigned char)*on)) { - /* hm, can we trust that number? Best not. */ - return (time_t)-1; + if (on != eol) { + /* line must end here */ + return -1; } return res; } @@ -797,4 +811,12 @@ _warc_find_eoh(const char *buf, size_t b return hit; } +static const char* +_warc_find_eol(const char *buf, size_t bsz) +{ + static const char _marker[] = "\r\n"; + const char *hit = xmemmem(buf, bsz, _marker, sizeof(_marker) - 1U); + + return hit; +} /* archive_read_support_format_warc.c ends here */ Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_xar.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_xar.c Sat Feb 18 22:06:03 2017 (r313928) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_xar.c Sat Feb 18 22:13:28 2017 (r313929) @@ -394,6 +394,7 @@ static void checksum_update(struct archi size_t, const void *, size_t); static int checksum_final(struct archive_read *, const void *, size_t, const void *, size_t); +static void checksum_cleanup(struct archive_read *); static int decompression_init(struct archive_read *, enum enctype); static int decompress(struct archive_read *, const void **, size_t *, const void *, size_t *); @@ -923,6 +924,7 @@ xar_cleanup(struct archive_read *a) int r; xar = (struct xar *)(a->format->data); + checksum_cleanup(a); r = decompression_cleanup(a); hdlink = xar->hdlink_list; while (hdlink != NULL) { @@ -1720,6 +1722,16 @@ decompression_cleanup(struct archive_rea } static void +checksum_cleanup(struct archive_read *a) { + struct xar *xar; + + xar = (struct xar *)(a->format->data); + + _checksum_final(&(xar->a_sumwrk), NULL, 0); + _checksum_final(&(xar->e_sumwrk), NULL, 0); +} + +static void xmlattr_cleanup(struct xmlattr_list *list) { struct xmlattr *attr, *next;