From patchwork Fri May 9 19:44:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 4144991 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4E7509F1E1 for ; Fri, 9 May 2014 19:44:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F02482035C for ; Fri, 9 May 2014 19:44:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22D3620357 for ; Fri, 9 May 2014 19:44:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757082AbaEIToh (ORCPT ); Fri, 9 May 2014 15:44:37 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:1599 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756400AbaEITog (ORCPT ); Fri, 9 May 2014 15:44:36 -0400 Received: from pps.filterd (m0044012 [127.0.0.1]) by mx0a-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id s49JgX34027940; Fri, 9 May 2014 12:44:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=TRBsymxAh0sghHa4B6o16GBLysIFqc3T9P/T5hcSukE=; b=ofgLJUSqi7VtliRgZTN3RNPgxBPQxQyDzbYjHpIHlcNIksAIfFjvJBTXgIyq9rWZJowe JGNh+5IUrnFcwsX5adU+zX8VqdlYbWo6th9bojjOWvLTDtqosKZcOE7ZYbXrbj7bLMB9 sdjOFLm3v3S9dhpysqcCpcNunUX85RLED8Q= Received: from mail.thefacebook.com (mailwest.thefacebook.com [173.252.71.148]) by mx0a-00082601.pphosted.com with ESMTP id 1krmeqm6p7-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK); Fri, 09 May 2014 12:44:31 -0700 Received: from localhost (192.168.57.29) by mail.thefacebook.com (192.168.16.23) with Microsoft SMTP Server (TLS) id 14.3.174.1; Fri, 9 May 2014 12:44:30 -0700 From: Josef Bacik To: , Subject: [PATCH] xfstests: filter out selinux xattrs for generic/062 Date: Fri, 9 May 2014 15:44:28 -0400 Message-ID: <1399664668-719-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [192.168.57.29] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.11.96, 1.0.14, 0.0.0000 definitions=2014-05-09_08:2014-05-09, 2014-05-09, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=2.26376695167119e-11 kscore.compositescore=0 circleOfTrustscore=190.748640802497 compositescore=0.999739589658025 urlsuspect_oldscore=0.999739589658025 suspectscore=0 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=62764 rbsscore=0.999739589658025 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1405090253 X-FB-Internal: deliver Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If you have selinux enabled getfattr will show the selinux xattrs, which screws with the golden output of generic/062. To make matters worse you can't just greap it out because we'll still get the preamble and newline from getfattr when the selinux attr is the only attr. So this is the voodoo I came up with after way more time than I'm comfortable admitting to make this test pass if you have selinux enabled. Thanks, Signed-off-by: Josef Bacik --- common/filter | 6 ++++++ tests/generic/062 | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/filter b/common/filter index 05dbae6..16a01ed 100644 --- a/common/filter +++ b/common/filter @@ -323,5 +323,11 @@ _filter_ro_mount() { -e "s/mount: cannot mount block device/mount: cannot mount/g" } +# Filter out selinux xattrs from getfattr, and if selinux is the only xattr in +# the file simply pretend like there were no xattrs +_filter_selinux_xattr() { + grep -v selinux | sed -e "N; s/^\# file: .*\n$//; /^$/d" +} + # make sure this script returns success /bin/true diff --git a/tests/generic/062 b/tests/generic/062 index 047c930..32f0bca 100755 --- a/tests/generic/062 +++ b/tests/generic/062 @@ -47,7 +47,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 getfattr() { - $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch + $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch | \ + _filter_selinux_xattr } setfattr()