From patchwork Wed Aug 8 09:38:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Aur=C3=A9lien_Aptel?= X-Patchwork-Id: 10559697 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 E02B813B4 for ; Wed, 8 Aug 2018 09:38:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF8512A9E8 for ; Wed, 8 Aug 2018 09:38:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3A222AA05; Wed, 8 Aug 2018 09:38:25 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 4C38B2A9E8 for ; Wed, 8 Aug 2018 09:38:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726793AbeHHL5R (ORCPT ); Wed, 8 Aug 2018 07:57:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:46632 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726726AbeHHL5R (ORCPT ); Wed, 8 Aug 2018 07:57:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 63036ADB0; Wed, 8 Aug 2018 09:38:23 +0000 (UTC) From: Aurelien Aptel To: linux-cifs@vger.kernel.org Cc: piastryyy@gmail.com, Aurelien Aptel Subject: [cifs-utils PATCH v1 1/2] checkopts: report duplicated options in man page Date: Wed, 8 Aug 2018 11:38:15 +0200 Message-Id: <20180808093816.22773-2-aaptel@suse.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20180808093816.22773-1-aaptel@suse.com> References: <20180808093816.22773-1-aaptel@suse.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Aurelien Aptel --- checkopts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/checkopts b/checkopts index 26ca271..88e70b1 100755 --- a/checkopts +++ b/checkopts @@ -98,9 +98,12 @@ def extract_man_opts(fn): state = STATE_BASE rx = RX() opts = {} + ln = 0 with open(fn) as f: for s in f.readlines(): + ln += 1 + if state == STATE_EXIT: break @@ -113,7 +116,9 @@ def extract_man_opts(fn): s = chomp(s) names = extract_canonical_opts(s) for name in names: - opts[name] = s + if name not in opts: + opts[name] = [] + opts[name].append({'ln':ln, 'fmt':s}) elif rx.search(r'^[A-Z]+', s): state = STATE_EXIT return opts @@ -174,6 +179,14 @@ def main(): def opt_is_doc(o): return o in manopts + print('DUPLICATED DOC OPTIONS') + print('======================') + + for opt in sortedset(man_opts_set): + if len(manopts[opt]) > 1: + lines = ", ".join([str(x['ln']) for x in manopts[opt]]) + print("OPTION %-20.20s (lines %s)"%(opt, lines)) + print() print('UNDOCUMENTED OPTIONS') print('====================') @@ -208,8 +221,8 @@ def main(): unex_opts = man_opts_set - kernel_opts_set # group opts and their negations together for opt in sortedset(unex_opts): - fmt = manopts[opt] - print('OPTION %s ("%s")' % (opt, fmt)) + man = manopts[opt][0] + print('OPTION %s ("%s") line %d' % (opt, man['fmt'], man['ln'])) print('')