From owner-freebsd-arch@FreeBSD.ORG Tue Apr 23 16:39:09 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E89785D7; Tue, 23 Apr 2013 16:39:09 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx1.freebsd.org (Postfix) with ESMTP id BF9331FDD; Tue, 23 Apr 2013 16:39:09 +0000 (UTC) Received: by mail-pa0-f49.google.com with SMTP id kp14so606793pab.36 for ; Tue, 23 Apr 2013 09:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:x-mailer:from:subject:date :to; bh=R7LoHx2D1x2qwhZ7P84bXgBVcp/A6S41glS8KEketLI=; b=hvaRr3VjhZSNgnbVySqENWh8ga6NZm+CzAXgF2tsFkbuXMERud6PhJRNBZ0U14uMWe Dc4bEgKt4VyaVpOzUVMZy3mW+8GHzg+jsZbpWcP6WD7mJOJdIKSWW4jZVJJz89oyviev 2JWOZAoZM9UTkNPsGelONzAdY88QkTuSjsopNp1epdIh4k6B60oxRySNCSeE5fWJ3C9N zWRYWrRs8M/Zl7n9JztiFgGJFZ1YieCdrtA7TLLDyqc99Z05dwuvnmwUQaosymn230WA DOuFQzuRrNfNiqZSYpMqFZHzsuN6lNN4mj9uOP6Cys31zsa3qNXO03ULWQisF/iRdvGS AKWQ== X-Received: by 10.66.232.230 with SMTP id tr6mr31698083pac.83.1366735149147; Tue, 23 Apr 2013 09:39:09 -0700 (PDT) Received: from [10.43.238.124] (mobile-166-147-080-091.mycingular.net. [166.147.80.91]) by mx.google.com with ESMTPS id ak1sm30188765pbc.10.2013.04.23.09.39.06 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Apr 2013 09:39:08 -0700 (PDT) References: Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: X-Mailer: iPhone Mail (10B329) From: Garrett Cooper Subject: Re: [RFC] [Optionally] build tests with buildworld Date: Tue, 23 Apr 2013 09:39:03 -0700 To: "arch@FreeBSD.org" , "toolchain@FreeBSD.org" Cc: "Simon J. Gerraty" , Marcel Moolenaar X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Apr 2013 16:39:10 -0000 On Apr 19, 2013, at 11:17 PM, Garrett Cooper wrote: > Hi arch@ and toolchain@, > One of the items that I'm proposing be added to Makefile.inc1 in > order to make building and installing tests on CURRENT (ATF and > otherwise) is a build knob called TESTS_WITH_WORLD (the name can be > modified), which allows me to build and install various tests on my > git branch like the example ATF tests I produced, pjdfstest, some of > the prove tests from tools/regression, etc (there are other > outstanding changes, but this was the key one that I need feedback on > just to be safe). > The effective change is attached (Gmail will no doubt mangle it, > so please let me know if you want another copy). I made the change to > Makefile.inc1 in order to ensure that the change was self-contained > and because it was the simplest, cleanest way to do things without > introducing a lot of unwanted complexity. > I'm asking for feedback on the following items: > 1. Does the change make functional sense? If not, why? > 2. Do the semantics (variable names, whether or not they're > defined) need to be modified to match MK_* semantics or be made more > consistent in any particular way? If so, why? > 3. Will anyone have serious heartburn (already have a similar > change implemented, think it's done in a backwards manner) if this > change is implemented? If so, why? > Thanks! > -Garrett >=20 > PS Please CC me on all replies as I'm not subscribed to the list. > Ping? If no one replies in a week I'll consider it implicit agreement :)= .. Thanks, -Garrett= From owner-freebsd-arch@FreeBSD.ORG Tue Apr 23 16:59:54 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DF052183; Tue, 23 Apr 2013 16:59:54 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id 21DAA10F0; Tue, 23 Apr 2013 16:59:53 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.5/8.14.5) with ESMTP id r3NGxwtP091665; Tue, 23 Apr 2013 11:59:58 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.5/8.14.5/Submit) id r3NGxwpG091664; Tue, 23 Apr 2013 11:59:58 -0500 (CDT) (envelope-from brooks) Date: Tue, 23 Apr 2013 11:59:58 -0500 From: Brooks Davis To: Garrett Cooper Subject: Re: [RFC] [Optionally] build tests with buildworld Message-ID: <20130423165958.GA91607@lor.one-eyed-alien.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YZ5djTAD1cGYuMQK" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: arch@freebsd.org, "Simon J. Gerraty" , toolchain@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Apr 2013 16:59:54 -0000 --YZ5djTAD1cGYuMQK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Apr 19, 2013 at 11:17:50PM -0700, Garrett Cooper wrote: > Hi arch@ and toolchain@, > One of the items that I'm proposing be added to Makefile.inc1 in > order to make building and installing tests on CURRENT (ATF and > otherwise) is a build knob called TESTS_WITH_WORLD (the name can be > modified), which allows me to build and install various tests on my > git branch like the example ATF tests I produced, pjdfstest, some of > the prove tests from tools/regression, etc (there are other > outstanding changes, but this was the key one that I need feedback on > just to be safe). I don't understand way you don't use WITH_TESTS processed through bsd.own.mk. You'd presumably have to add it to the list of supported NO_* options for the bootstrap case, but that's trivial. Then you use could use normal MK_* variables. That would also let you use WITH(OUT)_TESTS in individual directories and they would always work. At a glance using WITHOUT_TESTS and NO_TEST internally would simplify some of the special cases in your patch. On a side note, I like the HMAKE change independent of the rest of the patch. -- Brooks --YZ5djTAD1cGYuMQK Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFRdr4NXY6L6fI4GtQRAoJcAKCDe1KqUkRo/Jwss2TBwL8LEXWt4ACgyRqL FZmO4CxJZE5hRtxoE00tYH0= =gPvz -----END PGP SIGNATURE----- --YZ5djTAD1cGYuMQK-- From owner-freebsd-arch@FreeBSD.ORG Tue Apr 23 17:28:47 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5CAA1F76; Tue, 23 Apr 2013 17:28:47 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by mx1.freebsd.org (Postfix) with ESMTP id 28CDD1285; Tue, 23 Apr 2013 17:28:47 +0000 (UTC) Received: by mail-pa0-f53.google.com with SMTP id bh4so631469pad.12 for ; Tue, 23 Apr 2013 10:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:mime-version:content-type:from:in-reply-to:date :cc:content-transfer-encoding:message-id:references:to:x-mailer; bh=MVDWPTHNYYS4fVs5dRvhlABR0qks+Z5qkwT5ge6b4KI=; b=bGFzWIA/khdEiJ1u6TDkTU7sgP8X04EntXp/KSh8LOy6+IxcXKdlvvJlQ0Qkv/oUvw EYN7P39TTVKhSunq8SrbJTtrZ+I6SPFxEMY5ZotwqWitDMTKqjIA86DF7ViH6uQTIJ1r cFOjNLKom/0OusBaM5CWXOanPCsABcE4GwL7TFEFwQ2GPcPjNCqiZoMwQtMoqeU92oy7 AlYU+YaALPHBlvx68cMV8o6r9d9cVRkpZehB8ykzRl8sdwKPaZ/nANWE32Bz9PfrSX1p bjk4GgRegt4ioLNHkaBofuF8MSSsQG/pIJag7q+RZjhCYiIlGPDIDmRv0pTANDnqYiZV xIOA== X-Received: by 10.67.1.69 with SMTP id be5mr14689822pad.154.1366738126791; Tue, 23 Apr 2013 10:28:46 -0700 (PDT) Received: from fuji-wireless.local (c-98-203-241-95.hsd1.wa.comcast.net. [98.203.241.95]) by mx.google.com with ESMTPS id qh4sm32636986pac.8.2013.04.23.10.28.45 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Apr 2013 10:28:46 -0700 (PDT) Subject: Re: [RFC] [Optionally] build tests with buildworld Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Garrett Cooper In-Reply-To: <20130423165958.GA91607@lor.one-eyed-alien.net> Date: Tue, 23 Apr 2013 10:28:44 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <1D2E12CF-08F2-4151-AB33-84C4270CFBC6@gmail.com> References: <20130423165958.GA91607@lor.one-eyed-alien.net> To: Brooks Davis X-Mailer: Apple Mail (2.1283) Cc: arch@freebsd.org, "Simon J. Gerraty" , benno@FreeBSD.org, toolchain@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Apr 2013 17:28:47 -0000 Hi Brooks! On Apr 23, 2013, at 9:59 AM, Brooks Davis wrote: > On Fri, Apr 19, 2013 at 11:17:50PM -0700, Garrett Cooper wrote: >> Hi arch@ and toolchain@, >> One of the items that I'm proposing be added to Makefile.inc1 in >> order to make building and installing tests on CURRENT (ATF and >> otherwise) is a build knob called TESTS_WITH_WORLD (the name can be >> modified), which allows me to build and install various tests on my >> git branch like the example ATF tests I produced, pjdfstest, some of >> the prove tests from tools/regression, etc (there are other >> outstanding changes, but this was the key one that I need feedback on >> just to be safe). >=20 > I don't understand way you don't use WITH_TESTS processed > through bsd.own.mk. You'd presumably have to add it to the list of > supported NO_* options for the bootstrap case, but that's trivial. = Then > you use could use normal MK_* variables. That would also let you use > WITH(OUT)_TESTS in individual directories and they would always work. >=20 > At a glance using WITHOUT_TESTS and NO_TEST internally would simplify > some of the special cases in your patch. This is something that I considered, but I wasn't sure that it was the = best route to go about things because I thought we were doing away/had = done away with most of the NO_* knobs (and unfortunately one cannot mix = and match WITH_* and WITHOUT_* because they're considered contradictory = according to bsd.own.mk -- something that Simon has debated against = having in the past). I'm all for doing that though because that would simplify things greatly = from an end-user perspective. > On a side note, I like the HMAKE change independent of the rest of the > patch. Cool! I'll polish up the patch with that piece and send it over to = benno@ :). Thanks! -Garrett= From owner-freebsd-arch@FreeBSD.ORG Wed Apr 24 16:15:33 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F1FA4661; Wed, 24 Apr 2013 16:15:32 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pb0-x236.google.com (mail-pb0-x236.google.com [IPv6:2607:f8b0:400e:c01::236]) by mx1.freebsd.org (Postfix) with ESMTP id B8EBB1E34; Wed, 24 Apr 2013 16:15:32 +0000 (UTC) Received: by mail-pb0-f54.google.com with SMTP id jt11so502995pbb.13 for ; Wed, 24 Apr 2013 09:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:mime-version:content-type:from:in-reply-to:date :cc:message-id:references:to:x-mailer; bh=trBYWrygjfr4Y9aWKUQnGBvNpF70HuP6/KZryXOS6Wg=; b=sHJC94k78hkUDTTqWUBZ0eOF1T6oHoxykFMhASReVVzaiaOlfVCrH65rKBm3mMZEc5 Ns7YzEHohviNd1wBAvTnzHnOCuxXJsmsJCFZbDhMP3nfBNX9yLEkQl/pF+HJWJAyJFJR a3tvkqpvb5hR292yhD62KaaNUOvXVLzqbgKScitklyW5iwzRbzgb/U1QgsdPNR3VoV0N quCuPJqkPRLY1vlFRP5tLWmdwOEb9GIBp01hbPz52crjySnpIXhAPv6yLsqz3Zs0J3ob 89Z9eu/8HeXDYh/iO4139tpNcg27vhS1dXDpiUgLNTE9ttzvmjY6fqgHSrZvbHM1+FII 30gA== X-Received: by 10.68.11.73 with SMTP id o9mr17793307pbb.18.1366820132509; Wed, 24 Apr 2013 09:15:32 -0700 (PDT) Received: from fuji-wireless.local (c-98-203-241-95.hsd1.wa.comcast.net. [98.203.241.95]) by mx.google.com with ESMTPSA id t1sm4209257pab.12.2013.04.24.09.15.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Apr 2013 09:15:31 -0700 (PDT) Subject: Re: [RFC] [Optionally] build tests with buildworld Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: multipart/mixed; boundary="Apple-Mail=_8DBC637E-2732-44C7-A30E-A2898AE64D0E" From: Garrett Cooper In-Reply-To: <1D2E12CF-08F2-4151-AB33-84C4270CFBC6@gmail.com> Date: Wed, 24 Apr 2013 09:15:30 -0700 Message-Id: References: <20130423165958.GA91607@lor.one-eyed-alien.net> <1D2E12CF-08F2-4151-AB33-84C4270CFBC6@gmail.com> To: Brooks Davis X-Mailer: Apple Mail (2.1283) Cc: arch@freebsd.org, "Simon J. Gerraty" , benno@FreeBSD.org, toolchain@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2013 16:15:33 -0000 --Apple-Mail=_8DBC637E-2732-44C7-A30E-A2898AE64D0E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Apr 23, 2013, at 10:28 AM, Garrett Cooper wrote: > On Apr 23, 2013, at 9:59 AM, Brooks Davis wrote: >=20 >> On Fri, Apr 19, 2013 at 11:17:50PM -0700, Garrett Cooper wrote: >>> Hi arch@ and toolchain@, >>> One of the items that I'm proposing be added to Makefile.inc1 in >>> order to make building and installing tests on CURRENT (ATF and >>> otherwise) is a build knob called TESTS_WITH_WORLD (the name can be >>> modified), which allows me to build and install various tests on my >>> git branch like the example ATF tests I produced, pjdfstest, some of >>> the prove tests from tools/regression, etc (there are other >>> outstanding changes, but this was the key one that I need feedback = on >>> just to be safe). >>=20 >> I don't understand way you don't use WITH_TESTS processed >> through bsd.own.mk. You'd presumably have to add it to the list of >> supported NO_* options for the bootstrap case, but that's trivial. = Then >> you use could use normal MK_* variables. That would also let you use >> WITH(OUT)_TESTS in individual directories and they would always work. >>=20 >> At a glance using WITHOUT_TESTS and NO_TEST internally would simplify >> some of the special cases in your patch. >=20 > This is something that I considered, but I wasn't sure that it was the = best route to go about things because I thought we were doing away/had = done away with most of the NO_* knobs (and unfortunately one cannot mix = and match WITH_* and WITHOUT_* because they're considered contradictory = according to bsd.own.mk -- something that Simon has debated against = having in the past). >=20 > I'm all for doing that though because that would simplify things = greatly from an end-user perspective. Hi Brooks! Does this look ok? Most of the MK_TESTS logic has been shoved = into bsd.own.mk and NO_TESTS is sprinkled around Makefile.inc1 as = recommended. Thanks! -Garrett --Apple-Mail=_8DBC637E-2732-44C7-A30E-A2898AE64D0E Content-Disposition: attachment; filename=build-tests-with-world.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="build-tests-with-world.patch" Content-Transfer-Encoding: 7bit Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 249833) +++ Makefile.inc1 (working copy) @@ -91,6 +91,9 @@ .if ${MK_OFED} != "no" SUBDIR+=contrib/ofed .endif +.if ${MK_TESTS} != "no" +SUBDIR+=tests +.endif # # We must do etc/ last for install/distribute to work. # @@ -253,7 +256,8 @@ SSP_CFLAGS= \ -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ -DNO_PIC -DNO_PROFILE -DNO_SHARED \ - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD \ + -DNO_TESTS \ # build-tools stage TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ @@ -263,12 +267,14 @@ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ -DNO_LINT \ - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD \ + -DNO_TESTS \ # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - -DWITHOUT_GDB + -DWITHOUT_GDB \ + -DNO_TESTS \ # world stage WMAKEENV= ${CROSSENV} \ @@ -343,7 +349,8 @@ -DLIBRARIES_ONLY \ -DNO_CPU_CFLAGS \ -DNO_CTF \ - -DNO_LINT + -DNO_LINT \ + -DNO_TESTS \ LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML @@ -489,7 +496,7 @@ @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; \ ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ - -DWITHOUT_MAN -DNO_PROFILE libraries + -DWITHOUT_MAN -DNO_PROFILE -DNO_TESTS libraries _depend: @echo @echo "--------------------------------------------------------------" @@ -1734,6 +1741,7 @@ NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \ -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ + -DNO_TESTS \ TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ CPUTYPE=${XDEV_CPUTYPE} Index: share/mk/bsd.own.mk =================================================================== --- share/mk/bsd.own.mk (revision 249833) +++ share/mk/bsd.own.mk (working copy) @@ -376,8 +376,16 @@ NAND \ OFED \ OPENSSH_NONE_CIPHER \ - SHARED_TOOLCHAIN + SHARED_TOOLCHAIN \ +# bsd.test.mk doesn't work with !bmake. Also don't build tests if NO_TESTS is +# defined; this is for buildworld and elsewhere (ports potentially). +.if defined(.PARSEDIR) && !defined(NO_TESTS) +__DEFAULT_NO_OPTIONS+=TESTS +.else +MK_TESTS:= no +.endif + # # Default behaviour of some options depends on the architecture. Unfortunately # this means that we have to test TARGET_ARCH (the buildworld case) as well --Apple-Mail=_8DBC637E-2732-44C7-A30E-A2898AE64D0E-- From owner-freebsd-arch@FreeBSD.ORG Wed Apr 24 16:23:09 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B4F13D09; Wed, 24 Apr 2013 16:23:09 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id 810A21EA6; Wed, 24 Apr 2013 16:23:08 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.5/8.14.5) with ESMTP id r3OGN8Qe016839; Wed, 24 Apr 2013 11:23:08 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.5/8.14.5/Submit) id r3OGN8fn016838; Wed, 24 Apr 2013 11:23:08 -0500 (CDT) (envelope-from brooks) Date: Wed, 24 Apr 2013 11:23:08 -0500 From: Brooks Davis To: Garrett Cooper Subject: Re: [RFC] [Optionally] build tests with buildworld Message-ID: <20130424162307.GA16731@lor.one-eyed-alien.net> References: <20130423165958.GA91607@lor.one-eyed-alien.net> <1D2E12CF-08F2-4151-AB33-84C4270CFBC6@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="qlTNgmc+xy1dBmNv" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: arch@freebsd.org, "Simon J. Gerraty" , benno@freebsd.org, toolchain@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2013 16:23:09 -0000 --qlTNgmc+xy1dBmNv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 24, 2013 at 09:15:30AM -0700, Garrett Cooper wrote: >=20 > On Apr 23, 2013, at 10:28 AM, Garrett Cooper wrote: >=20 > > On Apr 23, 2013, at 9:59 AM, Brooks Davis wrote: > >=20 > >> On Fri, Apr 19, 2013 at 11:17:50PM -0700, Garrett Cooper wrote: > >>> Hi arch@ and toolchain@, > >>> One of the items that I'm proposing be added to Makefile.inc1 in > >>> order to make building and installing tests on CURRENT (ATF and > >>> otherwise) is a build knob called TESTS_WITH_WORLD (the name can be > >>> modified), which allows me to build and install various tests on my > >>> git branch like the example ATF tests I produced, pjdfstest, some of > >>> the prove tests from tools/regression, etc (there are other > >>> outstanding changes, but this was the key one that I need feedback on > >>> just to be safe). > >>=20 > >> I don't understand way you don't use WITH_TESTS processed > >> through bsd.own.mk. You'd presumably have to add it to the list of > >> supported NO_* options for the bootstrap case, but that's trivial. Th= en > >> you use could use normal MK_* variables. That would also let you use > >> WITH(OUT)_TESTS in individual directories and they would always work. > >>=20 > >> At a glance using WITHOUT_TESTS and NO_TEST internally would simplify > >> some of the special cases in your patch. > >=20 > > This is something that I considered, but I wasn't sure that it was the = best route to go about things because I thought we were doing away/had done= away with most of the NO_* knobs (and unfortunately one cannot mix and mat= ch WITH_* and WITHOUT_* because they're considered contradictory according = to bsd.own.mk -- something that Simon has debated against having in the pas= t). > >=20 > > I'm all for doing that though because that would simplify things greatl= y from an end-user perspective. >=20 > Hi Brooks! > Does this look ok? Most of the MK_TESTS logic has been shoved into bsd.o= wn.mk and NO_TESTS is sprinkled around Makefile.inc1 as recommended. > Thanks! > -Garrett The functional parts seem fine. Some comments below. -- Brooks > Index: Makefile.inc1 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- Makefile.inc1 (revision 249833) > +++ Makefile.inc1 (working copy) > @@ -91,6 +91,9 @@ > .if ${MK_OFED} !=3D "no" > SUBDIR+=3Dcontrib/ofed > .endif > +.if ${MK_TESTS} !=3D "no" > +SUBDIR+=3Dtests > +.endif > # > # We must do etc/ last for install/distribute to work. > # > @@ -253,7 +256,8 @@ > SSP_CFLAGS=3D \ > -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ > -DNO_PIC -DNO_PROFILE -DNO_SHARED \ > - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD > + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD \ > + -DNO_TESTS \ The trailing backslash may be a good idea, but is inconsistant with all the Makefiles in the system. If you want to make that change is should discussed seperately. > =20 > # build-tools stage > TMAKE=3D MAKEOBJDIRPREFIX=3D${OBJTREE} \ > @@ -263,12 +267,14 @@ > BOOTSTRAPPING=3D${OSRELDATE} \ > SSP_CFLAGS=3D \ > -DNO_LINT \ > - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD > + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD \ > + -DNO_TESTS \ > =20 > # cross-tools stage > XMAKE=3D TOOLS_PREFIX=3D${WORLDTMP} ${BMAKE} \ > TARGET=3D${TARGET} TARGET_ARCH=3D${TARGET_ARCH} \ > - -DWITHOUT_GDB > + -DWITHOUT_GDB \ > + -DNO_TESTS \ > =20 > # world stage > WMAKEENV=3D ${CROSSENV} \ > @@ -343,7 +349,8 @@ > -DLIBRARIES_ONLY \ > -DNO_CPU_CFLAGS \ > -DNO_CTF \ > - -DNO_LINT > + -DNO_LINT \ > + -DNO_TESTS \ > =20 > LIB32WMAKE=3D ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ > -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML > @@ -489,7 +496,7 @@ > @echo "--------------------------------------------------------------" > ${_+_}cd ${.CURDIR}; \ > ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ > - -DWITHOUT_MAN -DNO_PROFILE libraries > + -DWITHOUT_MAN -DNO_PROFILE -DNO_TESTS libraries > _depend: > @echo > @echo "--------------------------------------------------------------" > @@ -1734,6 +1741,7 @@ > NOFUN=3D-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ > -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \ > -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ > + -DNO_TESTS \ This could be on the previous line. > TARGET=3D${XDEV} TARGET_ARCH=3D${XDEV_ARCH} \ > CPUTYPE=3D${XDEV_CPUTYPE} > =20 > Index: share/mk/bsd.own.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- share/mk/bsd.own.mk (revision 249833) > +++ share/mk/bsd.own.mk (working copy) > @@ -376,8 +376,16 @@ > NAND \ > OFED \ > OPENSSH_NONE_CIPHER \ > - SHARED_TOOLCHAIN > + SHARED_TOOLCHAIN \ > =20 > +# bsd.test.mk doesn't work with !bmake. Also don't build tests if NO_TES= TS is > +# defined; this is for buildworld and elsewhere (ports potentially). > +.if defined(.PARSEDIR) && !defined(NO_TESTS) > +__DEFAULT_NO_OPTIONS+=3DTESTS > +.else > +MK_TESTS:=3D no > +.endif > + > # > # Default behaviour of some options depends on the architecture. Unfort= unately > # this means that we have to test TARGET_ARCH (the buildworld case) as w= ell --qlTNgmc+xy1dBmNv Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFReAbrXY6L6fI4GtQRAtQLAKCJlwevJyNpfBkiUqSIS8T23KW/JwCfYyM1 1VrPW+NyFlhJ9UJw8cow4m4= =FV/q -----END PGP SIGNATURE----- --qlTNgmc+xy1dBmNv-- From owner-freebsd-arch@FreeBSD.ORG Wed Apr 24 16:32:15 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5F190FE; Wed, 24 Apr 2013 16:32:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by mx1.freebsd.org (Postfix) with ESMTP id 26DC61F30; Wed, 24 Apr 2013 16:32:15 +0000 (UTC) Received: by mail-pd0-f179.google.com with SMTP id x11so1231787pdj.24 for ; Wed, 24 Apr 2013 09:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:subject:mime-version:content-type:from:in-reply-to:date :cc:message-id:references:to:x-mailer; bh=d06dSJ3rib12iSCgorSeccWKqtgcHaX8v5dYiDSO6DE=; b=m+9HflqR9IOawIOIBAqWv9APpf7M3UzL2f/sisuHodqrkX9t/Uw0LJ5FuHZOBUDu+6 B6F7GxSnKT1/vjHo2MGYobOAeFfYJKxp6cmSOj7OlRxFRSE8lxMtH6QJFm4uVPmrDk8G B6b86Z0Y/Gdi/Yx9C3JBOWAiRAPjUZ3TUWOaw+wWhvJ2SqGas618tasRokzBJEFWUNWo nLZL4R26ODiX0UNtFjmufs+cKjxcYYIUtWCRKtTaEV8+H4y2520ofJtqfkN8bjubusHC fnDgLaKNXb6WBLiGfEBzOIgGO5lwwPOtVty11QrdWB+HxaNoBkFHGilJT7AJvnOfSOYK Sh8g== X-Received: by 10.66.100.231 with SMTP id fb7mr19959620pab.162.1366821129633; Wed, 24 Apr 2013 09:32:09 -0700 (PDT) Received: from fuji-wireless.local (c-98-203-241-95.hsd1.wa.comcast.net. [98.203.241.95]) by mx.google.com with ESMTPSA id br2sm3598772pbc.46.2013.04.24.09.32.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Apr 2013 09:32:08 -0700 (PDT) Subject: Re: [RFC] [Optionally] build tests with buildworld Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: multipart/mixed; boundary="Apple-Mail=_608A1616-6ED2-41C3-8E4C-09215CEE962B" From: Garrett Cooper In-Reply-To: <20130424162307.GA16731@lor.one-eyed-alien.net> Date: Wed, 24 Apr 2013 09:32:07 -0700 Message-Id: References: <20130423165958.GA91607@lor.one-eyed-alien.net> <1D2E12CF-08F2-4151-AB33-84C4270CFBC6@gmail.com> <20130424162307.GA16731@lor.one-eyed-alien.net> To: Brooks Davis X-Mailer: Apple Mail (2.1283) Cc: arch@freebsd.org, "Simon J. Gerraty" , benno@freebsd.org, toolchain@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Apr 2013 16:32:15 -0000 --Apple-Mail=_608A1616-6ED2-41C3-8E4C-09215CEE962B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Apr 24, 2013, at 9:23 AM, Brooks Davis wrote: >> =85 >> Hi Brooks! >> Does this look ok? Most of the MK_TESTS logic has been shoved = into bsd.own.mk and NO_TESTS is sprinkled around Makefile.inc1 as = recommended. >> Thanks! >> -Garrett >=20 > The functional parts seem fine. Some comments below. Here's an updated version of the patch with your comments = applied. Thanks! -Garrett --Apple-Mail=_608A1616-6ED2-41C3-8E4C-09215CEE962B Content-Disposition: attachment; filename=build-tests-with-world.patch Content-Type: application/octet-stream; name="build-tests-with-world.patch" Content-Transfer-Encoding: 7bit Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 249833) +++ Makefile.inc1 (working copy) @@ -91,6 +91,9 @@ .if ${MK_OFED} != "no" SUBDIR+=contrib/ofed .endif +.if ${MK_TESTS} != "no" +SUBDIR+=tests +.endif # # We must do etc/ last for install/distribute to work. # @@ -253,7 +256,7 @@ SSP_CFLAGS= \ -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ -DNO_PIC -DNO_PROFILE -DNO_SHARED \ - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD -DNO_TESTS # build-tools stage TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ @@ -263,12 +266,12 @@ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ -DNO_LINT \ - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD -DNO_TESTS # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - -DWITHOUT_GDB + -DWITHOUT_GDB -DNO_TESTS # world stage WMAKEENV= ${CROSSENV} \ @@ -343,7 +346,8 @@ -DLIBRARIES_ONLY \ -DNO_CPU_CFLAGS \ -DNO_CTF \ - -DNO_LINT + -DNO_LINT \ + -DNO_TESTS LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML @@ -489,7 +493,7 @@ @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; \ ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ - -DWITHOUT_MAN -DNO_PROFILE libraries + -DWITHOUT_MAN -DNO_PROFILE -DNO_TESTS libraries _depend: @echo @echo "--------------------------------------------------------------" @@ -1733,7 +1737,7 @@ NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \ - -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ + -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_TESTS -DNO_WARNS \ TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ CPUTYPE=${XDEV_CPUTYPE} Index: share/mk/bsd.own.mk =================================================================== --- share/mk/bsd.own.mk (revision 249833) +++ share/mk/bsd.own.mk (working copy) @@ -378,6 +378,14 @@ OPENSSH_NONE_CIPHER \ SHARED_TOOLCHAIN +# bsd.test.mk doesn't work with !bmake. Also don't build tests if NO_TESTS is +# defined; this is for buildworld and elsewhere (ports potentially). +.if defined(.PARSEDIR) && !defined(NO_TESTS) +__DEFAULT_NO_OPTIONS+=TESTS +.else +MK_TESTS:= no +.endif + # # Default behaviour of some options depends on the architecture. Unfortunately # this means that we have to test TARGET_ARCH (the buildworld case) as well --Apple-Mail=_608A1616-6ED2-41C3-8E4C-09215CEE962B-- From owner-freebsd-arch@FreeBSD.ORG Fri Apr 26 22:10:26 2013 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B5BD8BE8; Fri, 26 Apr 2013 22:10:26 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id E785F10EC; Fri, 26 Apr 2013 22:10:25 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id r3QMANCJ087741; Fri, 26 Apr 2013 16:10:23 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id r3QMANeU087740; Fri, 26 Apr 2013 16:10:23 -0600 (MDT) (envelope-from ken) Date: Fri, 26 Apr 2013 16:10:23 -0600 From: "Kenneth D. Merry" To: Bruce Evans Subject: Re: patches to add new stat(2) file flags Message-ID: <20130426221023.GA86767@nargothrond.kdm.org> References: <20130307000533.GA38950@nargothrond.kdm.org> <20130307222553.P981@besplex.bde.org> <20130308232155.GA47062@nargothrond.kdm.org> <20130310181127.D2309@besplex.bde.org> <20130409190838.GA60733@nargothrond.kdm.org> <20130418184951.GA18777@nargothrond.kdm.org> <20130419215624.L1262@besplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <20130419215624.L1262@besplex.bde.org> User-Agent: Mutt/1.4.2i Cc: arch@FreeBSD.org, fs@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Apr 2013 22:10:26 -0000 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Apr 19, 2013 at 22:53:50 +1000, Bruce Evans wrote: > On Thu, 18 Apr 2013, Kenneth D. Merry wrote: > > >On Tue, Apr 09, 2013 at 13:08:38 -0600, Kenneth D. Merry wrote: > >>... > >>Okay, I think these issues should now be fixed. We now refuse to change > >>attributes only on the root directory. And I updatd deupdat() to do the > >>same. > >> > >>When a directory is created or a file is added, the archive bit is not > >>changed on the directory. Not sure if we need to do that or not. (Simply > >>changing msdosfs_mkdir() to set ATTR_ARCHIVE was not enough to get the > >>archive bit set on directory creation.) > > > >Bruce, any comment on this? > > I didn't get around to looking at it closely. Just had a quick look at > the msdosfs parts. > > Apparently we are already doing the same as WinXP for ATTR_ARCHIVE on > directories. Not the right thing, but: > - don't set it on directory creation > - don't set it on directory modification > - allow setting and clearing it (with your changes). > > @ *** src/lib/libc/sys/chflags.2.orig > @ --- src/lib/libc/sys/chflags.2 > @ *************** > @ *** 112,137 **** > @ ... > @ --- 112,170 ---- > @ ... > @ + .It Dv UF_IMMUTABLE > @ + The file may not be changed. > @ + Filesystems may use this flag to maintain compatibility with the DOS, > Windows > @ + and CIFS FILE_ATTRIBUTE_READONLY attribute. > > msdosfs doesn't use this yet. It uses ATTR_READONLY, and doesn't map this > to or from UF_IMMUTABLE. I think I want ATTR_READONLY to be a flag and > not affect the file permissions (just like immutable flags normally don't > affect the file permissions. Okay, done. The permissions are now always 755, and writeability is controlled by ATTR_READONLY. > Does CIFS FILE_ATTRIBUTE_READONLY have exactly the same semantics as > IMMUTABLE? That is, does it prevent all operations on the file and the > file's metadata except read()? For IMMUTABLE, the other operations that > it disallows include setattr(), rename() and unlink(). > > Well it doesn't in WinXP using Cygwin. I made a directory with attributes > +R, and this didn't prevent creating files in the directory or rmdir of > the directory. Even attributes +R +H +S didn't prevent these operations. > Maybe +R isn't really used for directories, like +A. Then for a file with > +R +H +S: > - rm asked before deleting it (+R changed its fake permissions from > rw-r--r-- to r--r--r--). > - touching it succeeded > - attrib on it succeeded > - writing it failed. > So it seems that in WinXP, ATTR_READONLY is ignored for directories, and > more like the !writeable permission than the immutable flag. Okay. I added a new flag, UF_READONLY that maps to ATTR_READONLY directly instead of using an immutable flag. > @ *** src/sys/fs/msdosfs/msdosfs_denode.c.orig > @ --- src/sys/fs/msdosfs/msdosfs_denode.c > @ *************** > @ *** 300,307 **** > @ if ((dep->de_flag & DE_MODIFIED) == 0) > @ return (0); > @ dep->de_flag &= ~DE_MODIFIED; > @ ! if (dep->de_Attributes & ATTR_DIRECTORY) > @ ! return (0); > @ if (dep->de_refcnt <= 0) > @ return (0); > @ error = readde(dep, &bp, &dirp); > @ --- 300,309 ---- > @ if ((dep->de_flag & DE_MODIFIED) == 0) > @ return (0); > @ dep->de_flag &= ~DE_MODIFIED; > @ ! /* Was: silently ignore attribute changes for all dirs. */ > @ ! if (DETOV(dep)->v_vflag & VV_ROOT) > @ ! return (EINVAL); > @ ! /* Otherwise valid. */ > > Clean up the comments a bit. Say nothing, or that all attributes apply > to all directories except the root directory. Okay, I took them out. > Perhaps the VV_ROOT case is unreachable because callers filter out this > case. I have a debugger trap for it. Maybe. I left it in there just in case. > @ if (dep->de_refcnt <= 0) > @ return (0); > @ error = readde(dep, &bp, &dirp); > @ *** src/sys/fs/msdosfs/msdosfs_vnops.c.orig > @ --- src/sys/fs/msdosfs/msdosfs_vnops.c > @ *************** > @ *** 398,403 **** > @ --- 402,418 ---- > @ if (vap->va_flags != VNOVAL) { > @ if (vp->v_mount->mnt_flag & MNT_RDONLY) > @ return (EROFS); > @ + /* > @ + * We don't allow setting attributes on the root directory, > @ + * because according to Bruce Evans: "The special case for > @ + * the root directory is because before FAT32, the root > @ + * directory didn't have an entry for itself (and was > @ + * otherwise special). With FAT32, the root directory is > @ + * not so special, but still doesn't have an entry for > itself." > @ + */ > @ + if (vp->v_vflag & VV_ROOT) > @ + return (EINVAL); > @ + > @ if (cred->cr_uid != pmp->pm_uid) { > @ error = priv_check_cred(cred, PRIV_VFS_ADMIN, 0); > @ if (error) > > No need to give the source. Fixed. > I prefer the do this check after the permissions check, but if it is done > early then it is best done as a single check for all attributes in > msdosfs_settattr() and not just for flags. Currently there is: > - no check for ownerships. We only allow null changes to ownerships. With > no check like the above, we allow them even for the root directory, while > the above disallows null changes to flags for the root directory. > - for truncate(), the error is EISDIR for all directories. > - for file times, we silently ignore changes for all directories, after > doing > permissions checks. Only the root directory should be special. > - for file permissions, we handle directories as for file times. Now the > only possible non-null change is of ATTR_READONLY, and since this > apparently has no effect in WinXP, ignorig changing it for directories > is best. I think these should all be fixed with the attached patch. Take a look and let me know. The other outstanding issue is the suggestion by Gordon Ross on the Illumos developers list to make ZFS not enforce the readonly bit. It looks like it has not yet gone into Illumos. We may not want to make the change in FreeBSD since it hasn't gone in upstream yet. Ken -- Kenneth Merry ken@FreeBSD.ORG --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="file_flags_head.20130426.1.txt" *** src/bin/chflags/chflags.1.orig --- src/bin/chflags/chflags.1 *************** *** 32,38 **** .\" @(#)chflags.1 8.4 (Berkeley) 5/2/95 .\" $FreeBSD: head/bin/chflags/chflags.1 213573 2010-10-08 12:40:16Z uqs $ .\" ! .Dd March 3, 2006 .Dt CHFLAGS 1 .Os .Sh NAME --- 32,38 ---- .\" @(#)chflags.1 8.4 (Berkeley) 5/2/95 .\" $FreeBSD: head/bin/chflags/chflags.1 213573 2010-10-08 12:40:16Z uqs $ .\" ! .Dd April 8, 2013 .Dt CHFLAGS 1 .Os .Sh NAME *************** *** 101,120 **** .Bl -tag -offset indent -width ".Cm opaque" .It Cm arch , archived set the archived flag (super-user only) .It Cm opaque set the opaque flag (owner or super-user only) - .It Cm nodump - set the nodump flag (owner or super-user only) .It Cm sappnd , sappend set the system append-only flag (super-user only) .It Cm schg , schange , simmutable set the system immutable flag (super-user only) .It Cm sunlnk , sunlink set the system undeletable flag (super-user only) .It Cm uappnd , uappend set the user append-only flag (owner or super-user only) .It Cm uchg , uchange , uimmutable set the user immutable flag (owner or super-user only) .It Cm uunlnk , uunlink set the user undeletable flag (owner or super-user only) .El --- 101,136 ---- .Bl -tag -offset indent -width ".Cm opaque" .It Cm arch , archived set the archived flag (super-user only) + .It Cm nodump + set the nodump flag (owner or super-user only) .It Cm opaque set the opaque flag (owner or super-user only) .It Cm sappnd , sappend set the system append-only flag (super-user only) .It Cm schg , schange , simmutable set the system immutable flag (super-user only) + .It Cm snapshot + set the snapshot flag (filesystems do not allow changing this flag) .It Cm sunlnk , sunlink set the system undeletable flag (super-user only) .It Cm uappnd , uappend set the user append-only flag (owner or super-user only) + .It Cm uarch , uarchive + set the archive flag (owner or super-user only) .It Cm uchg , uchange , uimmutable set the user immutable flag (owner or super-user only) + .It Cm uhidden , hidden + set the hidden file attribute (owner or super-user only) + .It Cm uoffline , offline + set the offline file attribute (owner or super-user only) + .It Cm urdonly , rdonly , readonly + set the DOS, Windows and CIFS readonly flag (owner or super-user only) + .It Cm usparse , sparse + set the sparse file attribute (owner or super-user only) + .It Cm usystem , system + set the DOS, Windows and CIFS system flag (owner or super-user only) + .It Cm ureparse , reparse + set the Windows reparse point file attribute (owner or super-user only) .It Cm uunlnk , uunlink set the user undeletable flag (owner or super-user only) .El *** src/bin/ls/ls.1.orig --- src/bin/ls/ls.1 *************** *** 232,237 **** --- 232,240 ---- Include the file flags in a long .Pq Fl l output. + See + .Xr chflags 1 + for a list of file flags and their meanings. .It Fl p Write a slash .Pq Ql / *** src/lib/libc/gen/strtofflags.c.orig --- src/lib/libc/gen/strtofflags.c *************** *** 62,74 **** #endif { "nouappnd", 0, UF_APPEND }, { "nouappend", 0, UF_APPEND }, { "nouchg", 0, UF_IMMUTABLE }, { "nouchange", 0, UF_IMMUTABLE }, { "nouimmutable", 0, UF_IMMUTABLE }, { "nodump", 1, UF_NODUMP }, { "noopaque", 0, UF_OPAQUE }, ! { "nouunlnk", 0, UF_NOUNLINK }, ! { "nouunlink", 0, UF_NOUNLINK } }; #define nmappings (sizeof(mapping) / sizeof(mapping[0])) --- 62,90 ---- #endif { "nouappnd", 0, UF_APPEND }, { "nouappend", 0, UF_APPEND }, + { "nouarch", 0, UF_ARCHIVE }, + { "nouarchive", 0, UF_ARCHIVE }, + { "nohidden", 0, UF_HIDDEN }, + { "nouhidden", 0, UF_HIDDEN }, { "nouchg", 0, UF_IMMUTABLE }, { "nouchange", 0, UF_IMMUTABLE }, { "nouimmutable", 0, UF_IMMUTABLE }, { "nodump", 1, UF_NODUMP }, + { "nouunlnk", 0, UF_NOUNLINK }, + { "nouunlink", 0, UF_NOUNLINK }, + { "nooffline", 0, UF_OFFLINE }, + { "nouoffline", 0, UF_OFFLINE }, { "noopaque", 0, UF_OPAQUE }, ! { "nordonly", 0, UF_READONLY }, ! { "nourdonly", 0, UF_READONLY }, ! { "noreadonly", 0, UF_READONLY }, ! { "noureadonly", 0, UF_READONLY }, ! { "noreparse", 0, UF_REPARSE }, ! { "noureparse", 0, UF_REPARSE }, ! { "nosparse", 0, UF_SPARSE }, ! { "nousparse", 0, UF_SPARSE }, ! { "nosystem", 0, UF_SYSTEM }, ! { "nousystem", 0, UF_SYSTEM } }; #define nmappings (sizeof(mapping) / sizeof(mapping[0])) *** src/lib/libc/sys/chflags.2.orig --- src/lib/libc/sys/chflags.2 *************** *** 112,137 **** the following values .Pp .Bl -tag -width ".Dv SF_IMMUTABLE" -compact -offset indent ! .It Dv UF_NODUMP ! Do not dump the file. ! .It Dv UF_IMMUTABLE ! The file may not be changed. ! .It Dv UF_APPEND The file may only be appended to. - .It Dv UF_NOUNLINK - The file may not be renamed or deleted. - .It Dv UF_OPAQUE - The directory is opaque when viewed through a union stack. .It Dv SF_ARCHIVED ! The file may be archived. .It Dv SF_IMMUTABLE The file may not be changed. - .It Dv SF_APPEND - The file may only be appended to. .It Dv SF_NOUNLINK The file may not be renamed or deleted. .It Dv SF_SNAPSHOT The file is a snapshot file. .El .Pp If one of --- 112,172 ---- the following values .Pp .Bl -tag -width ".Dv SF_IMMUTABLE" -compact -offset indent ! .It Dv SF_APPEND The file may only be appended to. .It Dv SF_ARCHIVED ! The file has been archived. ! This flag means the opposite of the DOS, Windows and CIFS ! FILE_ATTRIBUTE_ARCHIVE attribute. ! This flag has been deprecated, and may be removed in a future release. .It Dv SF_IMMUTABLE The file may not be changed. .It Dv SF_NOUNLINK The file may not be renamed or deleted. .It Dv SF_SNAPSHOT The file is a snapshot file. + .It Dv UF_APPEND + The file may only be appended to. + .It Dv UF_ARCHIVE + The file needs to be archived. + This flag has the same meaning as the DOS, Windows and CIFS + FILE_ATTRIBUTE_ARCHIVE attribute. + Filesystems in FreeBSD may or may not have special handling for this flag. + For instance, ZFS tracks changes to files and will set this bit when a + file is updated. + UFS only stores the flag, and relies on the application to change it when + needed. + .It Dv UF_HIDDEN + The file may be hidden from directory listings at the application's + discretion. + The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_HIDDEN attribute. + .It Dv UF_IMMUTABLE + The file may not be changed. + .It Dv UF_NODUMP + Do not dump the file. + .It Dv UF_NOUNLINK + The file may not be renamed or deleted. + .It Dv UF_OFFLINE + The file is offline, or has the Windows and CIFS FILE_ATTRIBUTE_OFFLINE + attribute. + Filesystems in FreeBSD store and display this flag, but do not provide any + special handling when it is set. + .It Dv UF_OPAQUE + The directory is opaque when viewed through a union stack. + .It Dv UF_READONLY + The file is read only, and may not be written or appended. + Filesystems may use this flag to maintain compatibility with the DOS, Windows + and CIFS FILE_ATTRIBUTE_READONLY attribute. + .It Dv UF_REPARSE + The file contains a Windows reparse point and has the Windows and CIFS + FILE_ATTRIBUTE_REPARSE_POINT attribute. + .It Dv UF_SPARSE + The file has the Windows FILE_ATTRIBUTE_SPARSE_FILE attribute. + This may also be used by a filesystem to indicate a sparse file. + .It Dv UF_SYSTEM + The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_SYSTEM attribute. + Filesystems in FreeBSD may store and display this flag, but do not provide + any special handling when it is set. .El .Pp If one of *************** *** 162,167 **** --- 197,209 ---- .Xr init 8 for details.) .Pp + The implementation of all flags is filesystem-dependent. + See the description of the + .Dv UF_ARCHIVE + flag above for one example of the differences in behavior. + Care should be exercised when writing applications to account for + support or lack of support of these flags in various filesystems. + .Pp The .Dv SF_SNAPSHOT flag is maintained by the system and cannot be toggled. *** src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c.orig --- src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c *************** *** 6067,6072 **** --- 6067,6080 ---- XVA_SET_REQ(&xvap, XAT_APPENDONLY); XVA_SET_REQ(&xvap, XAT_NOUNLINK); XVA_SET_REQ(&xvap, XAT_NODUMP); + XVA_SET_REQ(&xvap, XAT_READONLY); + XVA_SET_REQ(&xvap, XAT_ARCHIVE); + XVA_SET_REQ(&xvap, XAT_SYSTEM); + XVA_SET_REQ(&xvap, XAT_HIDDEN); + XVA_SET_REQ(&xvap, XAT_REPARSE); + XVA_SET_REQ(&xvap, XAT_OFFLINE); + XVA_SET_REQ(&xvap, XAT_SPARSE); + error = zfs_getattr(ap->a_vp, (vattr_t *)&xvap, 0, ap->a_cred, NULL); if (error != 0) return (error); *************** *** 6082,6089 **** --- 6090,6112 ---- xvap.xva_xoptattrs.xoa_appendonly); FLAG_CHECK(SF_NOUNLINK, XAT_NOUNLINK, xvap.xva_xoptattrs.xoa_nounlink); + FLAG_CHECK(UF_ARCHIVE, XAT_ARCHIVE, + xvap.xva_xoptattrs.xoa_archive); FLAG_CHECK(UF_NODUMP, XAT_NODUMP, xvap.xva_xoptattrs.xoa_nodump); + FLAG_CHECK(UF_READONLY, XAT_READONLY, + xvap.xva_xoptattrs.xoa_readonly); + FLAG_CHECK(UF_SYSTEM, XAT_SYSTEM, + xvap.xva_xoptattrs.xoa_system); + FLAG_CHECK(UF_HIDDEN, XAT_HIDDEN, + xvap.xva_xoptattrs.xoa_hidden); + FLAG_CHECK(UF_REPARSE, XAT_REPARSE, + xvap.xva_xoptattrs.xoa_reparse); + FLAG_CHECK(UF_OFFLINE, XAT_OFFLINE, + xvap.xva_xoptattrs.xoa_offline); + FLAG_CHECK(UF_SPARSE, XAT_SPARSE, + xvap.xva_xoptattrs.xoa_sparse); + #undef FLAG_CHECK *vap = xvap.xva_vattr; vap->va_flags = fflags; *************** *** 6121,6127 **** return (EOPNOTSUPP); fflags = vap->va_flags; ! if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_NODUMP)) != 0) return (EOPNOTSUPP); /* * Unprivileged processes are not permitted to unset system --- 6144,6159 ---- return (EOPNOTSUPP); fflags = vap->va_flags; ! /* ! * XXX KDM ! * We need to figure out whether it makes sense to allow ! * UF_REPARSE through, since we don't really have other ! * facilities to handle reparse points and zfs_setattr() ! * doesn't currently allow setting that attribute anyway. ! */ ! if ((fflags & ~(SF_IMMUTABLE|SF_APPEND|SF_NOUNLINK|UF_ARCHIVE| ! UF_NODUMP|UF_SYSTEM|UF_HIDDEN|UF_READONLY|UF_REPARSE| ! UF_OFFLINE|UF_SPARSE)) != 0) return (EOPNOTSUPP); /* * Unprivileged processes are not permitted to unset system *************** *** 6173,6180 **** --- 6205,6226 ---- xvap.xva_xoptattrs.xoa_appendonly); FLAG_CHANGE(SF_NOUNLINK, ZFS_NOUNLINK, XAT_NOUNLINK, xvap.xva_xoptattrs.xoa_nounlink); + FLAG_CHANGE(UF_ARCHIVE, ZFS_ARCHIVE, XAT_ARCHIVE, + xvap.xva_xoptattrs.xoa_archive); FLAG_CHANGE(UF_NODUMP, ZFS_NODUMP, XAT_NODUMP, xvap.xva_xoptattrs.xoa_nodump); + FLAG_CHANGE(UF_READONLY, ZFS_READONLY, XAT_READONLY, + xvap.xva_xoptattrs.xoa_readonly); + FLAG_CHANGE(UF_SYSTEM, ZFS_SYSTEM, XAT_SYSTEM, + xvap.xva_xoptattrs.xoa_system); + FLAG_CHANGE(UF_HIDDEN, ZFS_HIDDEN, XAT_HIDDEN, + xvap.xva_xoptattrs.xoa_hidden); + FLAG_CHANGE(UF_REPARSE, ZFS_REPARSE, XAT_REPARSE, + xvap.xva_xoptattrs.xoa_hidden); + FLAG_CHANGE(UF_OFFLINE, ZFS_OFFLINE, XAT_OFFLINE, + xvap.xva_xoptattrs.xoa_offline); + FLAG_CHANGE(UF_SPARSE, ZFS_SPARSE, XAT_SPARSE, + xvap.xva_xoptattrs.xoa_sparse); #undef FLAG_CHANGE } return (zfs_setattr(vp, (vattr_t *)&xvap, 0, cred, NULL)); *** src/sys/fs/msdosfs/msdosfs_denode.c.orig --- src/sys/fs/msdosfs/msdosfs_denode.c *************** *** 300,307 **** if ((dep->de_flag & DE_MODIFIED) == 0) return (0); dep->de_flag &= ~DE_MODIFIED; ! if (dep->de_Attributes & ATTR_DIRECTORY) ! return (0); if (dep->de_refcnt <= 0) return (0); error = readde(dep, &bp, &dirp); --- 300,307 ---- if ((dep->de_flag & DE_MODIFIED) == 0) return (0); dep->de_flag &= ~DE_MODIFIED; ! if (DETOV(dep)->v_vflag & VV_ROOT) ! return (EINVAL); if (dep->de_refcnt <= 0) return (0); error = readde(dep, &bp, &dirp); *** src/sys/fs/msdosfs/msdosfs_vnops.c.orig --- src/sys/fs/msdosfs/msdosfs_vnops.c *************** *** 172,179 **** if (error) goto bad; ! ndirent.de_Attributes = (ap->a_vap->va_mode & VWRITE) ? ! ATTR_ARCHIVE : ATTR_ARCHIVE | ATTR_READONLY; ndirent.de_LowerCase = 0; ndirent.de_StartCluster = 0; ndirent.de_FileSize = 0; --- 172,178 ---- if (error) goto bad; ! ndirent.de_Attributes = ATTR_ARCHIVE; ndirent.de_LowerCase = 0; ndirent.de_StartCluster = 0; ndirent.de_FileSize = 0; *************** *** 256,273 **** mode_t file_mode; accmode_t accmode = ap->a_accmode; ! file_mode = (S_IXUSR|S_IXGRP|S_IXOTH) | (S_IRUSR|S_IRGRP|S_IROTH) | ! ((dep->de_Attributes & ATTR_READONLY) ? 0 : (S_IWUSR|S_IWGRP|S_IWOTH)); file_mode &= (vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask); /* * Disallow writing to directories and regular files if the ! * filesystem is read-only. */ if (accmode & VWRITE) { switch (vp->v_type) { case VDIR: - case VREG: if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); break; --- 255,274 ---- mode_t file_mode; accmode_t accmode = ap->a_accmode; ! file_mode = S_IRWXU|S_IRWXG|S_IRWXO; file_mode &= (vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask); /* * Disallow writing to directories and regular files if the ! * filesystem is read-only. Check the readonly attribute for ! * regular files and refuse to allow writing. */ if (accmode & VWRITE) { switch (vp->v_type) { + case VREG: + if (dep->de_Attributes & ATTR_READONLY) + return (EACCES); case VDIR: if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); break; *************** *** 322,331 **** else vap->va_fileid = (long)fileid; ! if ((dep->de_Attributes & ATTR_READONLY) == 0) ! mode = S_IRWXU|S_IRWXG|S_IRWXO; ! else ! mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; vap->va_mode = mode & (ap->a_vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask); vap->va_uid = pmp->pm_uid; --- 323,329 ---- else vap->va_fileid = (long)fileid; ! mode = S_IRWXU|S_IRWXG|S_IRWXO; vap->va_mode = mode & (ap->a_vp->v_type == VDIR ? pmp->pm_dirmask : pmp->pm_mask); vap->va_uid = pmp->pm_uid; *************** *** 345,352 **** vap->va_birthtime.tv_nsec = 0; } vap->va_flags = 0; ! if ((dep->de_Attributes & ATTR_ARCHIVE) == 0) ! vap->va_flags |= SF_ARCHIVED; vap->va_gen = 0; vap->va_blocksize = pmp->pm_bpcluster; vap->va_bytes = --- 343,356 ---- vap->va_birthtime.tv_nsec = 0; } vap->va_flags = 0; ! if (dep->de_Attributes & ATTR_ARCHIVE) ! vap->va_flags |= UF_ARCHIVE; ! if (dep->de_Attributes & ATTR_HIDDEN) ! vap->va_flags |= UF_HIDDEN; ! if (dep->de_Attributes & ATTR_READONLY) ! vap->va_flags |= UF_READONLY; ! if (dep->de_Attributes & ATTR_SYSTEM) ! vap->va_flags |= UF_SYSTEM; vap->va_gen = 0; vap->va_blocksize = pmp->pm_bpcluster; vap->va_bytes = *************** *** 395,400 **** --- 399,416 ---- #endif return (EINVAL); } + + /* + * We don't allow setting attributes on the root directory. + * The special case for the root directory is because before + * FAT32, the root directory didn't have an entry for itself + * (and was otherwise special). With FAT32, the root + * directory is not so special, but still doesn't have an + * entry for itself. + */ + if (vp->v_vflag & VV_ROOT) + return (EINVAL); + if (vap->va_flags != VNOVAL) { if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); *************** *** 408,431 **** * attributes. We ignored the access time and the * read and execute bits. We were strict for the other * attributes. - * - * Here we are strict, stricter than ufs in not allowing - * users to attempt to set SF_SETTABLE bits or anyone to - * set unsupported bits. However, we ignore attempts to - * set ATTR_ARCHIVE for directories `cp -pr' from a more - * sensible filesystem attempts it a lot. */ ! if (vap->va_flags & SF_SETTABLE) { ! error = priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0); ! if (error) ! return (error); ! } ! if (vap->va_flags & ~SF_ARCHIVED) return EOPNOTSUPP; ! if (vap->va_flags & SF_ARCHIVED) dep->de_Attributes &= ~ATTR_ARCHIVE; ! else if (!(dep->de_Attributes & ATTR_DIRECTORY)) ! dep->de_Attributes |= ATTR_ARCHIVE; dep->de_flag |= DE_MODIFIED; } --- 424,452 ---- * attributes. We ignored the access time and the * read and execute bits. We were strict for the other * attributes. */ ! if (vap->va_flags & ~(UF_ARCHIVE | UF_HIDDEN | UF_READONLY | ! UF_SYSTEM)) return EOPNOTSUPP; ! if (vap->va_flags & UF_ARCHIVE) ! dep->de_Attributes |= ATTR_ARCHIVE; ! else dep->de_Attributes &= ~ATTR_ARCHIVE; ! if (vap->va_flags & UF_HIDDEN) ! dep->de_Attributes |= ATTR_HIDDEN; ! else ! dep->de_Attributes &= ~ATTR_HIDDEN; ! /* We don't allow changing the readonly bit on directories. */ ! if (vp->v_type != VDIR) { ! if (vap->va_flags & UF_READONLY) ! dep->de_Attributes |= ATTR_READONLY; ! else ! dep->de_Attributes &= ~ATTR_READONLY; ! } ! if (vap->va_flags & UF_SYSTEM) ! dep->de_Attributes |= ATTR_SYSTEM; ! else ! dep->de_Attributes &= ~ATTR_SYSTEM; dep->de_flag |= DE_MODIFIED; } *************** *** 489,509 **** error = VOP_ACCESS(vp, VWRITE, cred, td); } else error = VOP_ACCESS(vp, VADMIN, cred, td); ! if (vp->v_type != VDIR) { ! if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 && ! vap->va_atime.tv_sec != VNOVAL) { ! dep->de_flag &= ~DE_ACCESS; ! timespec2fattime(&vap->va_atime, 0, ! &dep->de_ADate, NULL, NULL); ! } ! if (vap->va_mtime.tv_sec != VNOVAL) { ! dep->de_flag &= ~DE_UPDATE; ! timespec2fattime(&vap->va_mtime, 0, ! &dep->de_MDate, &dep->de_MTime, NULL); ! } ! dep->de_Attributes |= ATTR_ARCHIVE; ! dep->de_flag |= DE_MODIFIED; } } /* * DOS files only have the ability to have their writability --- 510,528 ---- error = VOP_ACCESS(vp, VWRITE, cred, td); } else error = VOP_ACCESS(vp, VADMIN, cred, td); ! if ((pmp->pm_flags & MSDOSFSMNT_NOWIN95) == 0 && ! vap->va_atime.tv_sec != VNOVAL) { ! dep->de_flag &= ~DE_ACCESS; ! timespec2fattime(&vap->va_atime, 0, ! &dep->de_ADate, NULL, NULL); ! } ! if (vap->va_mtime.tv_sec != VNOVAL) { ! dep->de_flag &= ~DE_UPDATE; ! timespec2fattime(&vap->va_mtime, 0, ! &dep->de_MDate, &dep->de_MTime, NULL); } + dep->de_Attributes |= ATTR_ARCHIVE; + dep->de_flag |= DE_MODIFIED; } /* * DOS files only have the ability to have their writability *** src/sys/fs/smbfs/smbfs_node.c.orig --- src/sys/fs/smbfs/smbfs_node.c *************** *** 370,379 **** if (diff > 2) /* XXX should be configurable */ return ENOENT; va->va_type = vp->v_type; /* vnode type (for create) */ if (vp->v_type == VREG) { va->va_mode = smp->sm_file_mode; /* files access mode and type */ ! if (np->n_dosattr & SMB_FA_RDONLY) va->va_mode &= ~(S_IWUSR|S_IWGRP|S_IWOTH); } else if (vp->v_type == VDIR) { va->va_mode = smp->sm_dir_mode; /* files access mode and type */ } else --- 370,382 ---- if (diff > 2) /* XXX should be configurable */ return ENOENT; va->va_type = vp->v_type; /* vnode type (for create) */ + va->va_flags = 0; /* flags defined for file */ if (vp->v_type == VREG) { va->va_mode = smp->sm_file_mode; /* files access mode and type */ ! if (np->n_dosattr & SMB_FA_RDONLY) { va->va_mode &= ~(S_IWUSR|S_IWGRP|S_IWOTH); + va->va_flags |= UF_READONLY; + } } else if (vp->v_type == VDIR) { va->va_mode = smp->sm_dir_mode; /* files access mode and type */ } else *************** *** 390,396 **** va->va_mtime = np->n_mtime; va->va_atime = va->va_ctime = va->va_mtime; /* time file changed */ va->va_gen = VNOVAL; /* generation number of file */ ! va->va_flags = 0; /* flags defined for file */ va->va_rdev = NODEV; /* device the special file represents */ va->va_bytes = va->va_size; /* bytes of disk space held by file */ va->va_filerev = 0; /* file modification number */ --- 393,407 ---- va->va_mtime = np->n_mtime; va->va_atime = va->va_ctime = va->va_mtime; /* time file changed */ va->va_gen = VNOVAL; /* generation number of file */ ! if (np->n_dosattr & SMB_FA_HIDDEN) ! va->va_flags |= UF_HIDDEN; ! if (np->n_dosattr & SMB_FA_SYSTEM) ! va->va_flags |= UF_SYSTEM; ! /* ! * We don't set the archive bit for directories. ! */ ! if ((vp->v_type != VDIR) && (np->n_dosattr & SMB_FA_ARCHIVE)) ! va->va_flags |= UF_ARCHIVE; va->va_rdev = NODEV; /* device the special file represents */ va->va_bytes = va->va_size; /* bytes of disk space held by file */ va->va_filerev = 0; /* file modification number */ *** src/sys/fs/smbfs/smbfs_vnops.c.orig --- src/sys/fs/smbfs/smbfs_vnops.c *************** *** 305,320 **** int old_n_dosattr; SMBVDEBUG("\n"); - if (vap->va_flags != VNOVAL) - return EOPNOTSUPP; isreadonly = (vp->v_mount->mnt_flag & MNT_RDONLY); /* * Disallow write attempts if the filesystem is mounted read-only. */ if ((vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL || ! vap->va_mode != (mode_t)VNOVAL) && isreadonly) return EROFS; scred = smbfs_malloc_scred(); smb_makescred(scred, td, ap->a_cred); if (vap->va_size != VNOVAL) { --- 305,334 ---- int old_n_dosattr; SMBVDEBUG("\n"); isreadonly = (vp->v_mount->mnt_flag & MNT_RDONLY); /* * Disallow write attempts if the filesystem is mounted read-only. */ if ((vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL || ! vap->va_mode != (mode_t)VNOVAL || vap->va_flags != VNOVAL) && ! isreadonly) return EROFS; + + /* + * We only support setting four flags. Don't allow setting others. + * + * We map UF_READONLY to SMB_FA_RDONLY, unlike the MacOS X version + * of this code, which maps both UF_IMMUTABLE AND SF_IMMUTABLE to + * SMB_FA_RDONLY. The immutable flags have different semantics + * than readonly, which is the reason for the difference. + */ + if (vap->va_flags != VNOVAL) { + if (vap->va_flags & ~(UF_HIDDEN|UF_SYSTEM|UF_ARCHIVE| + UF_READONLY)) + return EINVAL; + } + scred = smbfs_malloc_scred(); smb_makescred(scred, td, ap->a_cred); if (vap->va_size != VNOVAL) { *************** *** 353,364 **** goto out; } } ! if (vap->va_mode != (mode_t)VNOVAL) { old_n_dosattr = np->n_dosattr; ! if (vap->va_mode & S_IWUSR) ! np->n_dosattr &= ~SMB_FA_RDONLY; ! else ! np->n_dosattr |= SMB_FA_RDONLY; if (np->n_dosattr != old_n_dosattr) { error = smbfs_smb_setpattr(np, np->n_dosattr, NULL, scred); if (error) --- 367,413 ---- goto out; } } ! if ((vap->va_flags != VNOVAL) || (vap->va_mode != (mode_t)VNOVAL)) { old_n_dosattr = np->n_dosattr; ! ! if (vap->va_mode != (mode_t)VNOVAL) { ! if (vap->va_mode & S_IWUSR) ! np->n_dosattr &= ~SMB_FA_RDONLY; ! else ! np->n_dosattr |= SMB_FA_RDONLY; ! } ! ! if (vap->va_flags != VNOVAL) { ! if (vap->va_flags & UF_HIDDEN) ! np->n_dosattr |= SMB_FA_HIDDEN; ! else ! np->n_dosattr &= ~SMB_FA_HIDDEN; ! ! if (vap->va_flags & UF_SYSTEM) ! np->n_dosattr |= SMB_FA_SYSTEM; ! else ! np->n_dosattr &= ~SMB_FA_SYSTEM; ! ! if (vap->va_flags & UF_ARCHIVE) ! np->n_dosattr |= SMB_FA_ARCHIVE; ! else ! np->n_dosattr &= ~SMB_FA_ARCHIVE; ! ! /* ! * We only support setting the immutable / readonly ! * bit for regular files. According to comments in ! * the MacOS X version of this code, supporting the ! * readonly bit on directories doesn't do the same ! * thing in Windows as in Unix. ! */ ! if (vp->v_type == VREG) { ! if (vap->va_flags & UF_READONLY) ! np->n_dosattr |= SMB_FA_RDONLY; ! else ! np->n_dosattr &= ~SMB_FA_RDONLY; ! } ! } ! if (np->n_dosattr != old_n_dosattr) { error = smbfs_smb_setpattr(np, np->n_dosattr, NULL, scred); if (error) *** src/sys/sys/stat.h.orig --- src/sys/sys/stat.h *************** *** 265,272 **** #define UF_NODUMP 0x00000001 /* do not dump file */ #define UF_IMMUTABLE 0x00000002 /* file may not be changed */ #define UF_APPEND 0x00000004 /* writes to file may only append */ ! #define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ ! #define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */ /* * Super-user changeable flags. */ --- 265,290 ---- #define UF_NODUMP 0x00000001 /* do not dump file */ #define UF_IMMUTABLE 0x00000002 /* file may not be changed */ #define UF_APPEND 0x00000004 /* writes to file may only append */ ! #define UF_OPAQUE 0x00000008 /* directory is opaque wrt. union */ ! #define UF_NOUNLINK 0x00000010 /* file may not be removed or renamed */ ! /* ! * These two bits are defined in MacOS X. They are not currently used in ! * FreeBSD. ! */ ! #if 0 ! #define UF_COMPRESSED 0x00000020 /* file is compressed */ ! #define UF_TRACKED 0x00000040 /* renames and deletes are tracked */ ! #endif ! ! #define UF_SYSTEM 0x00000080 /* Windows system file bit */ ! #define UF_SPARSE 0x00000100 /* sparse file */ ! #define UF_OFFLINE 0x00000200 /* file is offline */ ! #define UF_REPARSE 0x00000400 /* Windows reparse point file bit */ ! #define UF_ARCHIVE 0x00000800 /* file needs to be archived */ ! #define UF_READONLY 0x00001000 /* Windows readonly file bit */ ! /* This is the same as the MacOS X definition of UF_HIDDEN. */ ! #define UF_HIDDEN 0x00008000 /* file is hidden */ ! /* * Super-user changeable flags. */ *** src/sys/ufs/ufs/ufs_vnops.c.orig --- src/sys/ufs/ufs/ufs_vnops.c *************** *** 528,536 **** return (EINVAL); } if (vap->va_flags != VNOVAL) { ! if ((vap->va_flags & ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | ! UF_OPAQUE | UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | ! SF_APPEND | SF_NOUNLINK | SF_SNAPSHOT)) != 0) return (EOPNOTSUPP); if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); --- 528,538 ---- return (EINVAL); } if (vap->va_flags != VNOVAL) { ! if ((vap->va_flags & ~(SF_APPEND | SF_ARCHIVED | SF_IMMUTABLE | ! SF_NOUNLINK | SF_SNAPSHOT | UF_APPEND | UF_ARCHIVE | ! UF_HIDDEN | UF_IMMUTABLE | UF_NODUMP | UF_NOUNLINK | ! UF_OFFLINE | UF_OPAQUE | UF_READONLY | UF_REPARSE | ! UF_SPARSE | UF_SYSTEM)) != 0) return (EOPNOTSUPP); if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); --oyUTqETQ0mS9luUI-- From owner-freebsd-arch@FreeBSD.ORG Sat Apr 27 06:35:17 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5F81BE5B for ; Sat, 27 Apr 2013 06:35:17 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 2984E1042 for ; Sat, 27 Apr 2013 06:35:16 +0000 (UTC) Received: from lstewart1.loshell.room52.net (ppp59-167-184-191.static.internode.on.net [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id 991EF7E88D for ; Sat, 27 Apr 2013 16:35:15 +1000 (EST) Message-ID: <517B71A3.30805@freebsd.org> Date: Sat, 27 Apr 2013 16:35:15 +1000 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:13.0) Gecko/20120613 Thunderbird/13.0 MIME-Version: 1.0 To: freebsd-arch@freebsd.org Subject: Adding a FOREACH_CONTINUE() variant to queue(3) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Apr 2013 06:35:17 -0000 Hi all, I've had use for these a few times now when wanting to restart a loop at a previously found element, and wonder if there are any thoughts about sticking them (and equivalents for other list types) in ? Cheers, Lawrence #define TAILQ_FOREACH_CONTINUE(var, head, field) \ for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ (var); \ (var) = TAILQ_NEXT((var), field)) #define SLIST_FOREACH_CONTINUE(var, head, field) \ for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ (var); \ (var) = SLIST_NEXT((var), field))