Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2181271ybi; Thu, 20 Jun 2019 10:24:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmJ9qCwBDxdFg87xBVMwqcdFOL2SJmO8cQYJg3DGIizmqDW1mF+kuaxoVNzb6h2w1z/1ze X-Received: by 2002:a63:ec13:: with SMTP id j19mr13436228pgh.174.1561051444072; Thu, 20 Jun 2019 10:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561051444; cv=none; d=google.com; s=arc-20160816; b=B4wT8b4iCOk5n8GoBvoKgj3GO0pShVqgkKnRPTDuQNTyPGiOM+xEyr7Sj8G/mTIHiw xDZG7oaBFU2B7rIE78yoFyXjPmBr/9rhGN/+DVI4lha93NowQ4SLgqnKPBOkfdzEafL0 GEuZRK7zZfh+MgKrnpF5sfgywR5B+zdRghq1GDrdLr75YuMGONULmno4fPog5CK59Ch8 Uju7g6rJlOEu6yF045ZzigWoXnWEhQSaXwAYtH+w5SZk/NcmYky2KTt80QJe5g6NdBaO D33mYxrkFfwtZ4SVM3Y/6WiSkkWYOWKmQjIHI5TSDqRbIqk8QMiBd5eI5rbuEgRkBnsl 5Y5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=f7XUa/lQlxySmEWEcJcuTSMuU+ZsEK8Uqolu3z7EFDA=; b=D9E7BeE3SRyzQG/INm8vND0rn/7+ha4JbDOmlmmRwTDv1pX6Xx7CTStVREkR4YAbm8 63V9IhV228qrMLI+qr40iG128QjP9aRYATmChEbJmxP3ZMcC+vMmY+76zHqo2Q2OJoef zLMlpIWvGgDiNGuIJluC/ZOsEkrlXD4JqOFt9fAxC8ZKAzC72dKvyNEG4T/2JXcr9kX1 mVPZ4SSqPNHvTmRY9trPUaODo8DzLNXuHEd1BwbuVl76JbCI4iADlrCQdfOOKREICqVN PWvAe5AFQz6Gs/hFbmNPh4DijKVywMdXNgG+pMU4ilXFF0TeRE6OIofYiQsC1G55G8pV bbog== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=gPLTIfM4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7si73135pgs.560.2019.06.20.10.23.48; Thu, 20 Jun 2019 10:24:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=gPLTIfM4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732261AbfFTRXb (ORCPT + 99 others); Thu, 20 Jun 2019 13:23:31 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52560 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732139AbfFTRXT (ORCPT ); Thu, 20 Jun 2019 13:23:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=f7XUa/lQlxySmEWEcJcuTSMuU+ZsEK8Uqolu3z7EFDA=; b=gPLTIfM4lTx7UaT2ACxhgU/ngY R8VEmJDveFeVdJ1NSGlHeE+wnhF5tIcV9S23NSu6mn955GEM+1crbTdxUt0u0NsNBuIgsWBOMgpRu wh9vN1AgKyIbtOHjbbTJ3tC+oJFpbYCwx4IKvbyx9fObew456Uu7+CXXIav2QbvW419Tzh6C9M1Zj /J113+FbfmVAk+H6f5eSOm9qh/3MMoW812r4qiWAH/0cwAs2vj1ROgKNopIbj5N/n9Zswd1S6EE/z 4WxPKdxMpr6ZJ5ojojEM8mSDNEGlbRx8iyrpjNjTjQ0YG9A41tQNEPJbKF4L5byehzgoKB1VCm9LU SJ4+n5Pw==; Received: from [177.97.20.138] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1he0mM-0008S2-AX; Thu, 20 Jun 2019 17:23:18 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1he0mJ-0000DG-PY; Thu, 20 Jun 2019 14:23:15 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet Subject: [PATCH v2 10/22] scripts/get_abi.pl: avoid creating duplicate names Date: Thu, 20 Jun 2019 14:23:02 -0300 Message-Id: <23c67f22ebdf43b3cf17798e451311871841a0df.1561050806.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The file the Documentation/ABI/testing/sysfs-class-power has voltage_min, voltage_max and voltage_now symbols duplicated. They are defined first for "General Properties" and then for "USB Properties". This cause those warnings: get_abi.pl rest --dir $srctree/Documentation/ABI/testing:26933: WARNING: Duplicate explicit target name: "abi_sys_class_power_supply_supply_name_voltage_max". get_abi.pl rest --dir $srctree/Documentation/ABI/testing:26968: WARNING: Duplicate explicit target name: "abi_sys_class_power_supply_supply_name_voltage_min". get_abi.pl rest --dir $srctree/Documentation/ABI/testing:27008: WARNING: Duplicate explicit target name: "abi_sys_class_power_supply_supply_name_voltage_now". And, as the references are not valid, it will also generate warnings about links to undefined references. Fix it by storing labels into a hash table and, when a duplicated one is found, appending random characters at the end. Signed-off-by: Mauro Carvalho Chehab --- scripts/get_abi.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl index 116f0c33c16d..329ace635ac2 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -194,6 +194,8 @@ sub parse_abi { # Outputs the book on ReST format # +my %labels; + sub output_rest { foreach my $what (sort { ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") || @@ -217,6 +219,13 @@ sub output_rest { $label =~ s,_+,_,g; $label =~ s,_$,,; + # Avoid duplicated labels + while (defined($labels{$label})) { + my @chars = ("A".."Z", "a".."z"); + $label .= $chars[rand @chars]; + } + $labels{$label} = 1; + $data{$what}->{label} .= $label; printf ".. _%s:\n\n", $label; -- 2.21.0