From owner-svn-src-head@freebsd.org Mon Aug 20 10:39:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E812C108BDBC; Mon, 20 Aug 2018 10:39:38 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8FF42862B4; Mon, 20 Aug 2018 10:39:38 +0000 (UTC) (envelope-from arichardson@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B6F61422D; Mon, 20 Aug 2018 10:39:38 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7KAdc8x079397; Mon, 20 Aug 2018 10:39:38 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7KAdchX079396; Mon, 20 Aug 2018 10:39:38 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <201808201039.w7KAdchX079396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Mon, 20 Aug 2018 10:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338095 - head/lib/libsysdecode X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/lib/libsysdecode X-SVN-Commit-Revision: 338095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Aug 2018 10:39:39 -0000 Author: arichardson Date: Mon Aug 20 10:39:37 2018 New Revision: 338095 URL: https://svnweb.freebsd.org/changeset/base/338095 Log: Make mkioctls script work on Linux and MacOS Using find -s will not work with the Linux or MacOS find command. We pipe to sort instead since the only real requirement here is that the order stays the same. While I am touching this file I also fixed a `==` construct which is not supported by POSIX sh but appears to work on FreeBSD. Reviewed By: imp Approved By: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D14246 Modified: head/lib/libsysdecode/mkioctls Modified: head/lib/libsysdecode/mkioctls ============================================================================== --- head/lib/libsysdecode/mkioctls Mon Aug 20 09:29:21 2018 (r338094) +++ head/lib/libsysdecode/mkioctls Mon Aug 20 10:39:37 2018 (r338095) @@ -17,18 +17,29 @@ LC_ALL=C; export LC_ALL # XXX should we use an ANSI cpp? ioctl_includes=$( cd $includedir + set -e + # if /bin/sh is bash this will avoid further errors due to missing commands + if set -o | grep -q pipefail; then + set -o pipefail + fi filter='tee' - if [ "${MK_PF}" == "no" ]; then + if [ "${MK_PF}" = "no" ]; then filter='egrep -v (net/pfvar|net/if_pfsync)\.h' fi - - find -H -s * -name '*.h' | \ + # find -s would avoid the need to invoke sort but it is non-portable + find -L ./* -type f -name '*.h' | \ + LC_ALL=C sort | \ $filter | \ xargs egrep -l \ '^#[ ]*define[ ]+[A-Za-z_][A-Za-z0-9_]*[ ]+_IO[^a-z0-9_]' | awk '{printf("#include <%s>\\n", $1)}' ) + +if [ -z "$ioctl_includes" ]; then + echo "Failed to build list of ioctl headers" + exit 1 +fi awk -v x="$ioctl_includes" 'BEGIN {print x}' | $CPP -nostdinc -I$includedir -dM -DCOMPAT_43TTY - |