From patchwork Mon Oct 1 17:05:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10622449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C45813BB for ; Mon, 1 Oct 2018 17:05:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0629F21C9A for ; Mon, 1 Oct 2018 17:05:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC61F21EEB; Mon, 1 Oct 2018 17:05:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A8AB212D8 for ; Mon, 1 Oct 2018 17:05:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726138AbeJAXoH (ORCPT ); Mon, 1 Oct 2018 19:44:07 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:43424 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725740AbeJAXoH (ORCPT ); Mon, 1 Oct 2018 19:44:07 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w91H3vR1189798; Mon, 1 Oct 2018 17:05:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=ZRa+/vUhM6GIp1TXX0i4T4JbUJ1m330dXVHl4nc88XY=; b=FQcWKfrq+1Tx8KjdVsOeEiL+fbq2J5/0FpU4BnrJfpUIf7yuMVAc2h27MlXOWAbHppXv kBmZg+E3LtaJQypAnthpB+w/kyGOqRsjSXU3JWDQmCYv7hkVuuQzaA6KpNxQsXPZbOqU cIn6aeQtet658rNSw7yiEyXKFOSgCffMs7HeNJGHZey9MBwAsmYTtZ8uZN7ZlMHCZnRz TQeP1qoe3CCIhrJlZLYVW7kXFS0A98Ch8yHMB74hcCeVolUR9lQiyPIpUGApJqizmN5T V2Ap+ztaVQGlrF+Gi19mgS7XZkp2FBXjPwH+zvSXJtzHT1iJFRBTMbcTTYsGk8Nx4olM eQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2mt0ttgqda-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 Oct 2018 17:05:14 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w91H5DMv015788 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 1 Oct 2018 17:05:13 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w91H5C42026049; Mon, 1 Oct 2018 17:05:13 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 01 Oct 2018 10:05:12 -0700 Subject: [PATCH 8/8] xfs_scrub_all: fix systemd escaping again From: "Darrick J. Wong" To: sandeen@redhat.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, Matthias Bodenbinder Date: Mon, 01 Oct 2018 10:05:11 -0700 Message-ID: <153841351155.27952.8070566787187802754.stgit@magnolia> In-Reply-To: <153841345236.27952.5050172703525712660.stgit@magnolia> References: <153841345236.27952.5050172703525712660.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9033 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=943 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810010163 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Apparently newer versions of systemd than the one on this author's laptop now complain about lack of (path) escaping in unit instance variable contents: # xfs_scrub_all Scrubbing /home... Invalid unit name "xfs_scrub@/home" was escaped as "xfs_scrub@-home" (maybe you should use systemd-escape?) Starting Online XFS Metadata Check for /home... So change the systemd_escape() function to escape paths unconditionally to make the warning go away. Reported-by: Matthias Bodenbinder Signed-off-by: Darrick J. Wong --- scrub/xfs_scrub_all.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scrub/xfs_scrub_all.in b/scrub/xfs_scrub_all.in index f7d9e6c7..c4e9899d 100644 --- a/scrub/xfs_scrub_all.in +++ b/scrub/xfs_scrub_all.in @@ -82,11 +82,16 @@ def run_killable(cmd, stdout, killfuncs, kill_fn): # actually /can/ escape the dashes correctly if it is told that this is a path # (and not a unit name), but it didn't do this prior to January 2017, so fix # this for them. +# +# systemd path escaping also drops the initial slash so we add that back in so +# that log messages from the service units preserve the full path and users can +# look up log messages using full paths. However, for "/" the escaping rules +# do /not/ drop the initial slash, so we have to special-case that here. def systemd_escape(path): '''Escape a path to avoid mangled systemd mangling.''' - if '-' not in path: - return path + if path == '/': + return '-' cmd = ['systemd-escape', '--path', path] try: proc = subprocess.Popen(cmd, stdout = subprocess.PIPE)