From patchwork Thu Jul 13 09:40:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ernesto_A=2E_Fern=C3=A1ndez?= X-Patchwork-Id: 787635 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3x7W5D259fz9s0g for ; Thu, 13 Jul 2017 19:40:16 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fU67Jtba"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751046AbdGMJkM (ORCPT ); Thu, 13 Jul 2017 05:40:12 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:36651 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbdGMJkK (ORCPT ); Thu, 13 Jul 2017 05:40:10 -0400 Received: by mail-qk0-f195.google.com with SMTP id v17so5077992qka.3; Thu, 13 Jul 2017 02:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=KV6QRXan6KKFAbYa6vBSlfCKU7nghjmM52xNxQ9oG9s=; b=fU67Jtba67MTTorD8G3Os/wyQlmj9CD1VWCGNcLN+YlCmrnfTSFPEh9+8FfS9WO2u6 1SLfvGW5IUooNko0B6ESEsG6c0+gNvohcaXjI9YNZiac/+OeqJ/qWn9GiBSdZWC500xr t2qzDLSUILyyx8EGq+OkOi8njiEfRLy0JjQDqEUZRVIKrD9Km1/V2DK5S7jBpiSE1X5R oM8iO5mHLYV8dIaN1onPa4yUH27BDvncYo0LUhG1LO9cC0PnUlHBFhTr4DPqW7sbMfIX YJBaRWQY56/wylAdgSu/FDOfUSsQ8y6QYddNFgRj2F3nNGiUCOkeESkO+fUYPlTMzjlW 3CQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=KV6QRXan6KKFAbYa6vBSlfCKU7nghjmM52xNxQ9oG9s=; b=qL6qVa8+hFm6BFTw8ves7Uw8axTj025qulU4hmgLxN3uhJY5wmUzX34p3U5JE7cLo+ JRe+5PL7yvbbS/bSnkvqaOQRkGHhWeobzZaiCMQqTGDpS0ayDl5SatsApFCaNMwaqK/M Hd69/hHyW22T29tsfZjKB3hgZAaSbkbiEEZ5z8hs9JagIgY8oOAO98npRC0X7YUc0xHe D51FPk0oUh6zYCI2aPiWlbfxHl+Oa5epDS8fds3Kpo/d18t4GZjPRtfFbZi7dtqts5fv zuvv/Uo7k23mYyG7qxE8FKd7d2PZ1cZx5sqHX8Z8iXzMgwL1RINzGBr5GENzJ4+SdTuK 88zw== X-Gm-Message-State: AIVw1105Hv8xRc9+xlA2CWVN2UiHPOBOtK4gFP4/UwYyjtZ9ayCO/GdK w7viuL7gAJpGSg== X-Received: by 10.55.151.195 with SMTP id z186mr3581137qkd.100.1499938809294; Thu, 13 Jul 2017 02:40:09 -0700 (PDT) Received: from debian.home ([186.18.119.100]) by smtp.gmail.com with ESMTPSA id f29sm4089476qtc.13.2017.07.13.02.40.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 02:40:09 -0700 (PDT) Date: Thu, 13 Jul 2017 06:40:04 -0300 From: Ernesto =?utf-8?Q?A=2E_Fern=C3=A1ndez?= To: Christoph Hellwig Cc: Jan Kara , Theodore Ts'o , Andreas Dilger , Dave Kleikamp , linux-ext4@vger.kernel.org, jfs-discussion@lists.sourceforge.net, reiserfs-devel@vger.kernel.org, fstests@vger.kernel.org Subject: [xfstests PATCH] generic: add test of file mode when setfacl fails Message-ID: <20170713094003.GA4959@debian.home> References: <20170712114719.GA14398@infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170712114719.GA14398@infradead.org> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Check that the group permission bits of a file are not altered when setfacl fails. At the time of this patch the test fails for at least ext2, ext4 and jfs. It is not run against reiserfs, since xfstests claims that "attrs are not supported by this filesystem type". The failure to set acls is induced by filling the device, so to save time this should probably be run with a small TEST_DEV. Note that this test is not meaningful for all filesystems, because some will still succeed in setting the acls. This does not mean they don't have a bug in how they would handle an error. Signed-off-by: Ernesto A. Fernández --- tests/generic/447 | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/447.out | 2 ++ tests/generic/group | 1 + 3 files changed, 91 insertions(+) create mode 100755 tests/generic/447 create mode 100644 tests/generic/447.out diff --git a/tests/generic/447 b/tests/generic/447 new file mode 100755 index 0000000..b5fabd3 --- /dev/null +++ b/tests/generic/447 @@ -0,0 +1,88 @@ +#! /bin/bash +# FS QA Test 447 +# +# Fill the device and set as many extended attributes to a file as +# possible. Then call setfacl on it and, if this fails for lack of +# space, test that the permissions remain the same. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Ernesto A. Fernandez. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd $TEST_DIR + rm -f $TFILE + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_test +_require_acls +_require_attrs + +cd $TEST_DIR +TFILE=testfile.$seq + +# Create the test file and choose its permissions +rm -f $TFILE +touch $TFILE +chmod u+rwx $TFILE +chmod go-rwx $TFILE + +# Try to run out of space so setfacl will fail +yes xxxxxxxxxx &> $TFILE +i=1 +while setfattr -n user.$i $TFILE &> /dev/null; do + ((++i)) +done + +if setfacl -m m:r $TFILE &> /dev/null; then + # setfacl succeeded, so the test was meaningless + # The filesystem might still have an issue + status=0 + echo "-rwx------" + exit +fi + +# Since setfacl failed, the permissions should not have changed +stat -c %A $TFILE + +status=0 +exit diff --git a/tests/generic/447.out b/tests/generic/447.out new file mode 100644 index 0000000..adec877 --- /dev/null +++ b/tests/generic/447.out @@ -0,0 +1,2 @@ +QA output created by 447 +-rwx------ diff --git a/tests/generic/group b/tests/generic/group index 8c1e21a..f11d798 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -449,3 +449,4 @@ 444 auto quick acl 445 auto quick rw 446 auto quick rw dangerous +447 acl