Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4572739pxk; Wed, 30 Sep 2020 06:33:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs4PChmyDYWx1wVNTNibMMZzmg1e+XtJxeUK8J3zpMOiALkZZY8dgvXYrUUmpvfC2INSda X-Received: by 2002:a05:6402:1558:: with SMTP id p24mr2664593edx.194.1601472822318; Wed, 30 Sep 2020 06:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601472822; cv=none; d=google.com; s=arc-20160816; b=C1v7uX7a2Tt85BEZ2mUOMI5fdlYn63J6rYtFtel0em+bmFE1veyMTqQXT94OOUO+kr EB0RXL2Pgg+/5LafUHEWpD7Ln3RL6rMJqdtBR56I2NowshiiLck/i/wxPtcw5bF4+EtB 3hSWOeMPyURbrqBo8p/4009CZs2th1J9snOQWX4ZIomWgwkHCxITZi6+xWzFzLJNus8N bGGEtJ7mCUNMvTxCt082NlCrPXtnNSXZq/5d3cHf+xVIebw1t7jF63AAJ5YgmTInJ/s9 KsuAGicxvNQ8hb+by7puMzpio7Y3bxo/VE0E1B6U2k6UjG3XqDC1HCyCT2EdjTNSoDZG 48cA== 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=jJNVXIIrjszDa7SepcTcyA4qVcYFAxaoSOuu+d8jwMw=; b=Y4inm3gwvS9jeDeNcq3gTgXifKrF/Dp0NiYMnKuSpDLuCdFLXNFH67wHyZCg4vEA1Y /aPzQGFVtKe708D6ctUfzpCFhXUZQomCsfQpr8h4xW5aCvlTy9Yl3dTlsfZAPdzrfIi5 6jHZlR6lbA8dclaonZiBNst2NDHJW5TGERrmlEnNsIQFS0oShUVTLHuO/I7UCKnbDfjZ glC7WnK3r+WQSaVsipFMqapICoih0dj/u221alqYDYTAiQz9hbJ24QeMgecQmaG9r9R3 wstH82osZb7T/tFawMuhZbe3c5UcVAzP4leahsBRvXztT3xtNZrEdm78ikagZHVrsLrT tygQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wq9DiuS7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m13si1166591edi.602.2020.09.30.06.33.19; Wed, 30 Sep 2020 06:33:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wq9DiuS7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730186AbgI3NZU (ORCPT + 99 others); Wed, 30 Sep 2020 09:25:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:38580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729205AbgI3NZU (ORCPT ); Wed, 30 Sep 2020 09:25:20 -0400 Received: from mail.kernel.org (unknown [95.90.213.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B4D472075F; Wed, 30 Sep 2020 13:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601472319; bh=zXf5IdVsjv02CToXaGl0U+R8uIJox+Ax0tMq2ZJvFgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wq9DiuS7coeK0Mv84TbR5q4Tr9FckZkb/644XnL/0ybkwLmsNQ+d4zW+2kxHKmOOA jz2MujdIjAXe+so7aKov0dMDHO/74k2Htd8Cb2ZRI7FbiIXR9JAl82xyV6/vx16aOt S+pHBBQye8FF99RaxH5txXLcPrPU1ciM9pCdqI4I= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kNc6f-001XJ3-OD; Wed, 30 Sep 2020 15:25:17 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v4 06/52] scripts: kernel-doc: fix troubles with line counts Date: Wed, 30 Sep 2020 15:24:29 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There's currently a bug with the way kernel-doc script counts line numbers that can be seen with: $ ./scripts/kernel-doc -rst -enable-lineno include/linux/math64.h >all && ./scripts/kernel-doc -rst -internal -enable-lineno include/linux/math64.h >int && diff -U0 int all --- int 2020-09-28 12:58:08.927486808 +0200 +++ all 2020-09-28 12:58:08.905486845 +0200 @@ -1 +1 @@ -#define LINENO 27 +#define LINENO 26 @@ -3 +3 @@ -#define LINENO 16 +#define LINENO 15 @@ -9 +9 @@ -#define LINENO 17 +#define LINENO 16 ... This is happening with perl version 5.30.3, but I'm not so sure if this is a perl bug, or if this is due to something else. In any case, fixing it is easy. Basically, when "-internal" parameter is used, the process_export_file() function opens the handle "IN". This makes the line number to be incremented, as the handler for the main open is also "IN". Fix the problem by using a different handler for the main open(). While here, add a missing close for it. Signed-off-by: Mauro Carvalho Chehab --- scripts/kernel-doc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index e1140869b889..07b1073b0bc0 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -2261,7 +2261,7 @@ sub process_file($) { $file = map_filename($orig_file); - if (!open(IN,"<$file")) { + if (!open(IN_FILE,"<$file")) { print STDERR "Error: Cannot open file $file\n"; ++$errors; return; @@ -2270,9 +2270,9 @@ sub process_file($) { $. = 1; $section_counter = 0; - while () { + while () { while (s/\\\s*$//) { - $_ .= ; + $_ .= ; } # Replace tabs by spaces while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; @@ -2304,6 +2304,7 @@ sub process_file($) { print STDERR "${file}:1: warning: no structured comments found\n"; } } + close IN_FILE; } -- 2.26.2