From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#50946: Emacs-28: Inadequate coding in hack-elisp-shorthands Date: Sat, 02 Oct 2021 01:48:31 +0100 Message-ID: <871r54xnds.fsf@gmail.com> References: <831r54einq.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19350"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Alan Mackenzie , 50946-done@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 02 02:49:20 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWTDM-0004qV-9q for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Oct 2021 02:49:20 +0200 Original-Received: from localhost ([::1]:36040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWTDL-00005d-7w for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Oct 2021 20:49:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWTD4-0008WL-6d for bug-gnu-emacs@gnu.org; Fri, 01 Oct 2021 20:49:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWTD3-0008UW-VO for bug-gnu-emacs@gnu.org; Fri, 01 Oct 2021 20:49:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mWTD3-0007LU-Py for bug-gnu-emacs@gnu.org; Fri, 01 Oct 2021 20:49:01 -0400 Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Oct 2021 00:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 50946 X-GNU-PR-Package: emacs Mail-Followup-To: 50946@debbugs.gnu.org, joaotavora@gmail.com, acm@muc.de Original-Received: via spool by 50946-done@debbugs.gnu.org id=D50946.163313572328205 (code D ref 50946); Sat, 02 Oct 2021 00:49:01 +0000 Original-Received: (at 50946-done) by debbugs.gnu.org; 2 Oct 2021 00:48:43 +0000 Original-Received: from localhost ([127.0.0.1]:57609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWTCk-0007Kr-QA for submit@debbugs.gnu.org; Fri, 01 Oct 2021 20:48:43 -0400 Original-Received: from mail-wm1-f48.google.com ([209.85.128.48]:33706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWTCf-0007KZ-Oh for 50946-done@debbugs.gnu.org; Fri, 01 Oct 2021 20:48:41 -0400 Original-Received: by mail-wm1-f48.google.com with SMTP id q17-20020a7bce91000000b0030d4e298215so1932219wmj.0 for <50946-done@debbugs.gnu.org>; Fri, 01 Oct 2021 17:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=Mqf6WJGaFQAHHVw8NLkKpqY+Gy11RyrbUkXgmWZn7vI=; b=nrfKazC1oADRhr50J4yiLSlXMHoFjFX1Gv9ne+NKRqLDmE1EtrTs1tD3GNMwsML+1E k2/s0e2UMmFZqTltB0BEvBhBJLriKR0bdmW+BqR1DhcM6Eld2VlKk8Qf+2IRxb8MTH3r rtPcWWGPUwtD2Ld4CXEiIPCCUievCVM/ZFXRg61rXUmsTf4f1+lN0Qg9MTazo9lKVuYN 8Vr3/ibJ8M26d2cz7ra19/7jhWh6WHB9SdlYJb3sjejrPCkLVSIVcETIfZlK1WsoyB/x QizQjN29zWbUw5iZD3f5EdrUOHlm3u/kzWtfdWCOH+2lEy4QnxTS4dgYlhRVZm4/h05A ayhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=Mqf6WJGaFQAHHVw8NLkKpqY+Gy11RyrbUkXgmWZn7vI=; b=qlO09AeFpxR7YK8vMI8O73Rd6ZqAIPIMQm6X02ipA28X98Bdjut76I4c9W0ez/t+5R ccT/S/Hh/FdnI4eoB1aW3hQyWkZYVlif3SaNRAFMkjmD5NqbGe0jwju2C5I3jOKfZJqQ KPesrKd4vWGH8NqKKGWq2QZ/atay7R+1c/9BiL9Cab3RL/qBc8SwUoSZdnCYiT1N0dKi HJBqkholLyGVR4yf7bz9ECZR/xcxwVNHFoDR4VNBH/8Y5PaOuV9YYDNsGQmo/KoVBJPp mt85OWi3u7HFq/gzbUGWketNT7wpJgB16snSB+yWxIsycMcq8fzNvPf8nSrgAzAYXTXp lrWA== X-Gm-Message-State: AOAM53356KRdfA09a5rS1hOW1+wfgj6Xq33u5+46VwvvFQV9IbLS/63n /ZiKXMOlz48mIvlRaAwTYl6/CirO+8o= X-Google-Smtp-Source: ABdhPJz2HNk/IlaV4FJ6lx/hPDbfqlaE83Nh270wLQwpgNxM457H+dw/T1SSaDBAzKBotjvcS8j91Q== X-Received: by 2002:a1c:ed13:: with SMTP id l19mr7397299wmh.48.1633135711408; Fri, 01 Oct 2021 17:48:31 -0700 (PDT) Original-Received: from krug ([87.196.156.235]) by smtp.gmail.com with ESMTPSA id z6sm9978186wmp.1.2021.10.01.17.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 17:48:30 -0700 (PDT) In-Reply-To: <831r54einq.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 01 Oct 2021 20:53:13 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:216092 Archived-At: Eli Zaretskii writes: >> Date: Fri, 1 Oct 2021 17:10:57 +0000 >> From: Alan Mackenzie >>=20 >> In emacs -Q in the emacs-28 branch, create the following two line file, >> foobar.el, and try to load it: >>=20 >> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >> (defvar foo-baz "foobar-baz") >> FOOBARELISP-SHORTHANDS: (("foo" . "foobar"))) >> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >>=20 >> This will throw an error, but that isn't important. >>=20 >> What is important is that the symbol foobar-baz is created by the >> elisp-shorthands facility. >>=20 >> This shouldn't happen since: >> 1/- There is no Local Variables section. >> 2/- There is no variable elisp-shorthands in that non-existent section. >>=20 >> The following errors are evident in hack-elisp-shorthands: >> 1/- The code doesn't check for a correctly formatted Local Variables >> section. >> 2/- The code, even if it did check, would only check the last 3000 bytes >> in the file. The section can occur anywhere in the last 3000 >> CHARACTERS. >> 3/- The code doesn't do a case-sensitive search for "elisp-shorthands". >> 4/- The code doesn't check for "elisp-shorthands" being a complete >> symbol. >> 5/- The code doesn't even check that "elisp-shorthands" is in a comment. > > Thanks. > > Jo=C3=A3o, could you please look into this? Done. In the Emacs 28 branch. All tests pass (except a strange 'seccomp' one that never did). Let me know if some more bugs lurk. Addressed all the points except the last one which doesn't make much sense, since normal `hack-local-variables` also doesn't do any such check. In fact what I'm doing is re-using hack-local-variables--find-variables from files.el, as I had wanted to anyway. Jo=C3=A3o