From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#47168: 28.0.50; Infinite recursion in project-root Date: Wed, 17 Mar 2021 04:47:15 +0200 Message-ID: <36f5ca08-1ddc-a183-3f12-e942f6a7ff89@yandex.ru> References: <87ft0wpooj.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20925"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 To: Juri Linkov , 47168@debbugs.gnu.org, Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 17 03:48:10 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 1lMMEE-0005KB-Cm for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Mar 2021 03:48:10 +0100 Original-Received: from localhost ([::1]:55990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMMED-0000EG-BZ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Mar 2021 22:48:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMME5-0000E5-Vq for bug-gnu-emacs@gnu.org; Tue, 16 Mar 2021 22:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58275) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lMME5-0004tG-Oq for bug-gnu-emacs@gnu.org; Tue, 16 Mar 2021 22:48:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lMME5-0003LQ-M9 for bug-gnu-emacs@gnu.org; Tue, 16 Mar 2021 22:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Mar 2021 02:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47168 X-GNU-PR-Package: emacs Original-Received: via spool by 47168-submit@debbugs.gnu.org id=B47168.161594924712810 (code B ref 47168); Wed, 17 Mar 2021 02:48:01 +0000 Original-Received: (at 47168) by debbugs.gnu.org; 17 Mar 2021 02:47:27 +0000 Original-Received: from localhost ([127.0.0.1]:41587 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lMMDX-0003KY-19 for submit@debbugs.gnu.org; Tue, 16 Mar 2021 22:47:27 -0400 Original-Received: from mail-wr1-f49.google.com ([209.85.221.49]:44956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lMMDU-0003KI-Ik for 47168@debbugs.gnu.org; Tue, 16 Mar 2021 22:47:25 -0400 Original-Received: by mail-wr1-f49.google.com with SMTP id t9so263717wrn.11 for <47168@debbugs.gnu.org>; Tue, 16 Mar 2021 19:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=UznB/PCnVerTopTO+9iNvjtViUiss+uKOcjytVo8LcY=; b=GZsRavbVojn/N9XIP8bFZqKto3uAtSq4aLUhDx2FQFbtdPivObJ1RA5jLOBrODtRdF xzBrCIArgdVNGDFoX33EeIRKm0r8aMSbGQCfBncmDZ1Sid+1qBUOwjrczhWoNiTgYg3i i3ZX5EL8qWXUy+YZ22Nap2yKIqvXRI5fesdMdCJh8EOWUpR8IE6xG3xQan9m1BVpqN9N 0LyeygvuhzoQ3lX7YTcSGQCjpYC+d34w9IW+q9o4eL1YkpsIsKiSgZYxfhOeouHGly7S /fcIdcg1eAn+DjC6VUJoH3NNiE7cZmGIWlxAKKvlXix/IUCC7FbZe2C4w9TZ3s/H5DhJ F6JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UznB/PCnVerTopTO+9iNvjtViUiss+uKOcjytVo8LcY=; b=GUlf0ZiC0Sny1qb0bT5CgIyVCpKs5eOzKzVszzg1QUQcQ1flKv47r6KGoizSFj7tN5 Mec4WqXemg1jdgTXtu1ZWJbEg0Kg1nHx1UGi+W5RPu/wehujewGQV+HPKq7HAyQ/Z4TM VQJIw/ZBymSWhUnYT48Lh7FP+8KzmszPzELFOtKLdTrD8D3K0tebhVIuOYMl9rZ97gBz bzAL0ScoMXlYaH8uYQvgugqQh9OPZU0bKEOTOeGbuvozOgxhutFv678W4+UvowPY9qnK Zd6ovUtl2BUdlFoABYGGdm17fVGLEXMrB3p9rEJzXJeW53ud6jwRV23LBNDLni7fVj4B H6ug== X-Gm-Message-State: AOAM532KmwRin+jKWUq/yZ+P+mKU80vKeQ3CNEodFzIsa61a3b22c0ae ibfneBXMDZ40YSvS34TGZ6Q= X-Google-Smtp-Source: ABdhPJzn2ZbhnIIimeaItSRJeK8Vi78NO5s+pAIKxYSb+qC2jPcJaPu91KcNHmyEIejV3riYocNmEw== X-Received: by 2002:a5d:638a:: with SMTP id p10mr1962556wru.286.1615949238431; Tue, 16 Mar 2021 19:47:18 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id u9sm955756wmc.38.2021.03.16.19.47.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Mar 2021 19:47:17 -0700 (PDT) In-Reply-To: <87ft0wpooj.fsf@mail.linkov.net> Content-Language: en-US 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:202507 Archived-At: Hi Juri, On 15.03.2021 19:04, Juri Linkov wrote: > When for some reason the argument of 'project-root' becomes nil, > for example, when the current buffer is not under version control, > then > > (project-root (project-current)) > > goes into infinite recursion: > > Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’") > project-root(nil) > project-roots(nil) > ... > project-root(nil) > project-roots(nil) > ... Note that the right way to write this code is either (project-root (project-current t)) or (when-let ((project (project-current))) (project-root project)) so we only see this when the programmer failed to account for the absence of current project. Still, it would be nice to never show a backtrace like this, even in those cases. The idea here was to keep compatibility with backends which implement project-roots and not project-root (perhaps the built-in vc backend in Emacs 27), as well as let the clients call either project-root or project-roots, also for backward compatibility purposes. Worst case, we can give up on that and require all 3rd party code standardize on project-root and have all users install the latest project.el from ELPA. But perhaps we still can have it both ways? Stefan, any chance there's a relatively non-dirty way we can check whether there is a non-default implementation for the generic function with given args, before calling it? That would allow us to break recursion.