From unknown Fri Aug 15 18:13:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#63291: libxml-parse-{html,xml}-region help page incorrect argument lower bound Resent-From: Ruijie Yu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 May 2023 06:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63291 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 63291@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1683269323357 (code B ref -1); Fri, 05 May 2023 06:49:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 May 2023 06:48:43 +0000 Received: from localhost ([127.0.0.1]:53015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pupFC-00005g-Qn for submit@debbugs.gnu.org; Fri, 05 May 2023 02:48:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:57596) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pupFA-00005W-Cf for submit@debbugs.gnu.org; Fri, 05 May 2023 02:48:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pupFA-0007Bn-2L for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 02:48:40 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pupF8-0001Uc-5r for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 02:48:39 -0400 Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 381cd1c8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 5 May 2023 06:48:36 +0000 (UTC) User-agent: mu4e 1.9.22; emacs 30.0.50 From: Ruijie Yu Date: Fri, 05 May 2023 14:38:02 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) First of all, this is newest Emacs 30 in-source build (pulled and built a few hours ago). I'm reading the help page of `libxml-parse-xml-region' and noticed this: --8<---------------cut here---------------start------------->8--- libxml-parse-xml-region is a built-in function in =E2=80=98src/xml.c=E2=80= =99. (libxml-parse-xml-region START END &optional BASE-URL) Parse the region as an XML document and return the parse tree. If START is nil, it defaults to =E2=80=98point-min=E2=80=99. If END is nil= , it defaults to =E2=80=98point-max=E2=80=99. ... --8<---------------cut here---------------end--------------->8--- Notice the function signature: it implies that the first two arguments are mandatory, even though the docstring proceeds to talk about what happens when these two arguments are nil. Similarly for `libxml-parse-html-region'. However, both the C source code and experiments show that these two functions do accept 0 arguments. ```emacs-lisp (with-temp-buffer (insert "") (libxml-parse-html-region)) ;=3D> (html nil) ``` I have zero knowledge of dealing with C defuns, so I'll leave fixing this issue to someone more experienced at that. --=20 Best, RY [Please note that this mail might go to spam due to some misconfiguration in my mail server -- still investigating.] From unknown Fri Aug 15 18:13:53 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ruijie Yu Subject: bug#63291: closed (Re: bug#63291: libxml-parse-{html, xml}-region help page incorrect argument lower bound) Message-ID: References: <83y1m3i72o.fsf@gnu.org> X-Gnu-PR-Message: they-closed 63291 X-Gnu-PR-Package: emacs Reply-To: 63291@debbugs.gnu.org Date: Fri, 05 May 2023 07:14:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1683270842-4109-1" This is a multi-part message in MIME format... ------------=_1683270842-4109-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #63291: libxml-parse-{html,xml}-region help page incorrect argument lower b= ound which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 63291@debbugs.gnu.org. --=20 63291: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D63291 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1683270842-4109-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 63291-done) by debbugs.gnu.org; 5 May 2023 07:13:15 +0000 Received: from localhost ([127.0.0.1]:53071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pupcu-00012u-1W for submit@debbugs.gnu.org; Fri, 05 May 2023 03:13:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pupco-00012D-Fk for 63291-done@debbugs.gnu.org; Fri, 05 May 2023 03:13:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pupch-0001Vx-0y; Fri, 05 May 2023 03:13:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=PKNBuzUrQuDieSfe90My3ydzhCvsnsOWqgHldsnyHjo=; b=gu4eXl8IYj/5lSjNBIwP 1hUtGP9yJNi/e+m2Ge1Z67Gg5KS/LuUskA2cVg0oKvDBTR46A2YO2ekNHRZP9GpNawW7JLUd2Ee82 +ZhwF+o8k10Up8uh/flWgkGcOVBi8BskslFNDUI1UN5bnLYlDItlwxdCNi0L/vnm7Ho+HhCxOBgOf VvVwJ3rkOF3ZisKJpaHTfxV8DHfiKMfY1mswV2aiZO0/ZeuHVgC/RRkptQLAyjUnL/PEDSPsP9Ho8 OlBCaEtiYYAfZNZjtzdnhC1bixIFcuqbbK1BleiCqDjAqDWas+X25Vaj+BE7S/gaHemRabVLIP51a VwZ/a0SI8ICecA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pupcg-0007RZ-GD; Fri, 05 May 2023 03:12:58 -0400 Date: Fri, 05 May 2023 10:13:51 +0300 Message-Id: <83y1m3i72o.fsf@gnu.org> From: Eli Zaretskii To: Ruijie Yu In-Reply-To: (bug-gnu-emacs@gnu.org) Subject: Re: bug#63291: libxml-parse-{html, xml}-region help page incorrect argument lower bound References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 63291-done Cc: 63291-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 05 May 2023 14:38:02 +0800 > From: Ruijie Yu via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > I'm reading the help page of `libxml-parse-xml-region' and noticed this: > > --8<---------------cut here---------------start------------->8--- > libxml-parse-xml-region is a built-in function in ‘src/xml.c’. > > (libxml-parse-xml-region START END &optional BASE-URL) > > Parse the region as an XML document and return the parse tree. > If START is nil, it defaults to ‘point-min’. If END is nil, it > defaults to ‘point-max’. > > ... > --8<---------------cut here---------------end--------------->8--- > > Notice the function signature: it implies that the first two arguments > are mandatory, even though the docstring proceeds to talk about what > happens when these two arguments are nil. Similarly for > `libxml-parse-html-region'. > > However, both the C source code and experiments show that these two > functions do accept 0 arguments. This is because a recent change made the first 2 arguments optional, but advertised-calling-convention of these functions in subr.el was not adjusted to that change, and was overriding the effect of the DEFUN macros, which say the truth: up to 4 arguments, with zero mandatory ones. Fixed on the emacs-29 branch. ------------=_1683270842-4109-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 5 May 2023 06:48:43 +0000 Received: from localhost ([127.0.0.1]:53015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pupFC-00005g-Qn for submit@debbugs.gnu.org; Fri, 05 May 2023 02:48:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:57596) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pupFA-00005W-Cf for submit@debbugs.gnu.org; Fri, 05 May 2023 02:48:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pupFA-0007Bn-2L for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 02:48:40 -0400 Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pupF8-0001Uc-5r for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 02:48:39 -0400 Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 381cd1c8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 5 May 2023 06:48:36 +0000 (UTC) User-agent: mu4e 1.9.22; emacs 30.0.50 From: Ruijie Yu To: bug-gnu-emacs@gnu.org Subject: libxml-parse-{html,xml}-region help page incorrect argument lower bound Date: Fri, 05 May 2023 14:38:02 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.6 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) First of all, this is newest Emacs 30 in-source build (pulled and built a few hours ago). I'm reading the help page of `libxml-parse-xml-region' and noticed this: --8<---------------cut here---------------start------------->8--- libxml-parse-xml-region is a built-in function in =E2=80=98src/xml.c=E2=80= =99. (libxml-parse-xml-region START END &optional BASE-URL) Parse the region as an XML document and return the parse tree. If START is nil, it defaults to =E2=80=98point-min=E2=80=99. If END is nil= , it defaults to =E2=80=98point-max=E2=80=99. ... --8<---------------cut here---------------end--------------->8--- Notice the function signature: it implies that the first two arguments are mandatory, even though the docstring proceeds to talk about what happens when these two arguments are nil. Similarly for `libxml-parse-html-region'. However, both the C source code and experiments show that these two functions do accept 0 arguments. ```emacs-lisp (with-temp-buffer (insert "") (libxml-parse-html-region)) ;=3D> (html nil) ``` I have zero knowledge of dealing with C defuns, so I'll leave fixing this issue to someone more experienced at that. --=20 Best, RY [Please note that this mail might go to spam due to some misconfiguration in my mail server -- still investigating.] ------------=_1683270842-4109-1--