From unknown Fri Jun 20 19:49:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75983: project crash, file-name-directory "~", file-equal-p nil Resent-From: Ship Mints Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Feb 2025 00:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 75983@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173836877320404 (code B ref -1); Sat, 01 Feb 2025 00:13:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Feb 2025 00:12:53 +0000 Received: from localhost ([127.0.0.1]:55443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1te181-0005J2-50 for submit@debbugs.gnu.org; Fri, 31 Jan 2025 19:12:53 -0500 Received: from lists.gnu.org ([2001:470:142::17]:47968) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1te17x-0005If-Ud for submit@debbugs.gnu.org; Fri, 31 Jan 2025 19:12:51 -0500 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 1te17r-0001pG-R9 for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2025 19:12:43 -0500 Received: from mail-vk1-xa30.google.com ([2607:f8b0:4864:20::a30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1te17q-0001k0-7u for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2025 19:12:43 -0500 Received: by mail-vk1-xa30.google.com with SMTP id 71dfb90a1353d-5187cd9b8e5so821679e0c.1 for ; Fri, 31 Jan 2025 16:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738368761; x=1738973561; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=gkkh+5FZPn2iUHCpXCotAfuKYcsq94QS5bdeMcJcyHo=; b=N5WeuSF9xyerVHRQap0hUij6+VGcA2c9M6TulrrpISPLEDT/mBSu2hCvR8CXbhm4jy EskcpqaU4l0ZMKElx36gmuDuU3YyjViiESKlAxkEspSPeWmns9aRR9DnYbYVq8gruXy1 3VwrrtZs40xyWF4O6Mpxcbc+LZCwr68odBYW2GnqgpAIjLTUr7YqFkkb0fiUb/5n8Bm4 QsUIQGPBwfmuM5hdLReRn+ylr03BXjVj84BCUEQmzKAEQ4RRPzfKiz85BOaaIvZ/p/sg 5VUEc1m/S3aPywWhNGBIKme63BVe7DTuCZa3+iwEVePSjh0u1zUpJrkBdJIO0YVu1bI5 M2Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738368761; x=1738973561; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=gkkh+5FZPn2iUHCpXCotAfuKYcsq94QS5bdeMcJcyHo=; b=jqMQhzrTG+SMrM2sPWsoExW9zi8EHzcFGXHEWYQAoq0ZNTvgAb0yX5DwHMSSaIRtCK T2uAV1ysTSoINhUO46HagwylQr6yhjbfHAiTwc0EwkPBBbJ/DBbDTL1por497qxN/En1 AltwNMp92WhCGnd2+Xr9hCNoPSm/VHs+y1T0M8tdd9iSnJ1OsFUpZe2QxIrtFmjz/C3C /VmElzTqSUB8/7Nkn4A6/mMKc1KZB4v9yhmLapyIzkl57heDfeHpOc11B+RrcaJL4Dz8 VcH1epAkQiiD84E2QIlxSyxtE+HBI1VcUxD7ipxI+n4qoZNPPrFsRro9gl3f+jTi00YQ IIVA== X-Gm-Message-State: AOJu0Yx6t/tfNRXxAfKZ05/EVVgANlw9LPOS/r+o0nVSz9F7cjF46Z67 Ai0qHwyds3k/0xSDSVmaxWPuryC3H7oCEgNH5VkZ9p9SI/281I2woXieIN+mecLgw1Lyy6Fs9Vr ETtaAPmS8pNUcVEFB99hn+OIhKJ1MpZZN X-Gm-Gg: ASbGncvxRUGw5SbNQh/Mg+mInqyc1a4s4klNipQ0Ha7joObedw7udX3kJ+5qruD5Up5 aByuYNRo3HmFLPuLEml/gPDOCUJ3I5kqGOd8nMLpBncRgQTDkVAOiwFPel6D8f7BIOUcdAQVz X-Google-Smtp-Source: AGHT+IHC8j2ZAIe/y13jupJszlf7QoEAiXXk+2WrBekgGREgMmRnplR8eJfU6JnPVJuaI+SlHIrl0KsbkpwADYF/xXc= X-Received: by 2002:a05:6122:6594:b0:517:167a:5cc6 with SMTP id 71dfb90a1353d-51e9e4d434amr13551470e0c.6.1738368760669; Fri, 31 Jan 2025 16:12:40 -0800 (PST) MIME-Version: 1.0 From: Ship Mints Date: Fri, 31 Jan 2025 19:10:47 -0500 X-Gm-Features: AWEUYZni7--8ysWX40Xq3UgFXsKu3NAHAtrxs04Y0-Yi0L2tHwGmCPLMIERAQDE Message-ID: Content-Type: multipart/alternative; boundary="00000000000077edfe062d098493" Received-SPF: pass client-ip=2607:f8b0:4864:20::a30; envelope-from=shipmints@gmail.com; helo=mail-vk1-xa30.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) 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: -0.0 (/) --00000000000077edfe062d098493 Content-Type: text/plain; charset="UTF-8" The behaviors below can be seen on 29, 30, 31 (I don't have an earlier Emacs to test but these issues probably are long-standing). Let's discuss these as I suspect there may be historical reasons for these behaviors that I'm unaware of, or maybe these are legitimate, even if old. It's also possible that I'm misunderstanding something. Issue 1: (file-name-directory "~") ; returns nil but I think this should return "~/": (file-name-directory (abbreviate-file-name "/home/username")) ; same (file-name-directory (abbreviate-file-name "/Users/username")) ; for all us macOS users Issue 2: I think file-equal-p should accept nil and consider it unspecified as in its docstring: "If FILE1 or FILE2 does not exist, the return value is unspecified." And/or find-file-name-handler should accept nil and then return nil. (file-equal-p "~" "~") ; t (file-equal-p "~" "/home/username") ; t (file-equal-p "~" (file-name-directory "~")) ; boom ;; (wrong-type-argument stringp nil) ;; find-file-name-handler(nil file-equal-p) Issue 3: project-forget-projects-under crashes when `project-list-file' contains "/home/username", which appears in my remembered project list. (defun project--read-project-list () ... (abbreviate-file-name name) ; converts "/home/username" to "~" (defun project-forget-projects-under () ... (dolist (proj (project-known-project-roots)) (when (file-equal-p (file-name-directory proj) dir) ; <--- boom on nil I'm happy to submit patches for any or all of these including guarding project-forget-projects-under to check for nil and/or amending project--read-project-list to convert "~" to "~/" as workarounds, with each submitted against a discrete bug number. -Stephane --00000000000077edfe062d098493 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The behaviors below can be seen on 29, 30, 31 (I don't have an earli= er Emacs to test but these issues probably are long-standing). Let's di= scuss these as I suspect there may be historical reasons for these behavior= s that I'm unaware of, or maybe these are legitimate,=C2=A0even if old.= It's also possible that I'm misunderstanding something.

Issue 1:

(file-name-directory "~") ; returns nil but I think = this should return "~/":
(file-name-directory
=C2=A0 (abbreviate-file-name "/home/username")) ; same
(file-name-director= y
=C2=A0 (abbreviate-file-name "/Use= rs/username")) ; for all us macOS users

Issue 2:

I think file-equal-p should accept nil and consider it unspecifie= d as in its docstring: "If FILE1 or FILE2 does not exist, the return v= alue is unspecified."

And/or find-file-name-handler should accept nil an= d then return nil.

(file-equal-p "~" "~") ; t
=
(file-equal-p "~" "/home/userna= me") ; t
(file-equal-p "~"= (file-name-directory "~")) ; boom
;; (wrong-type-argument stringp nil)
=
;; find-file-name-handler(nil file-equal-p)

Issue 3:

project-forget-projects-under crashes w= hen `project-list-file' contains "/home/username", which appe= ars in my remembered project list.

(defun project--read-project-list ()
...
=C2=A0 =C2=A0(abbreviate= -file-name name) ; converts "/home/username" to "~"

(defun project-f= orget-projects-under ()
...
=C2=A0 =C2=A0 =C2=A0 (dolist (proj (project-known-project-roots))=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (file-equal-p (file-name-directory pr= oj) dir) ; <--- boom on nil

I'm happy to submit patches for any or all of th= ese including guarding project-forget-projects-under to check for nil and/o= r amending project--read-project-list to convert "~" to "~/&= quot; as workarounds, with each submitted against a discrete bug number.

<= div class=3D"gmail_default" style=3D"font-family:monospace">-Stephane
=

--00000000000077edfe062d098493-- From unknown Fri Jun 20 19:49:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75983: project crash, file-name-directory "~", file-equal-p nil Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Feb 2025 08:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ship Mints , Dmitry Gutov Cc: 75983@debbugs.gnu.org Received: via spool by 75983-submit@debbugs.gnu.org id=B75983.173839983216839 (code B ref 75983); Sat, 01 Feb 2025 08:51:02 +0000 Received: (at 75983) by debbugs.gnu.org; 1 Feb 2025 08:50:32 +0000 Received: from localhost ([127.0.0.1]:56215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1te9Cy-0004NW-1r for submit@debbugs.gnu.org; Sat, 01 Feb 2025 03:50:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48064) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1te9Cw-0004NI-2z for 75983@debbugs.gnu.org; Sat, 01 Feb 2025 03:50:30 -0500 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 1te9Cq-0004rm-Hy; Sat, 01 Feb 2025 03:50:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=iJgV/Tpn0qG/5NGYwIlTmQV+TLAxg2En9ZyWGfvNKWM=; b=ovL7lE6nSMzT 6GucW64BA9FXurjCDXyuZZhOYQQk7/EZsKBj7MArRS5BF5G8XVJlAVZhi7g3Z8AitazrEXX1dBlJY j8jcFmRto2An6EAfzOMZju2u2C6zGxCSWbQzkQ3/IgLDcclbqtLNisjqijxiCaUpxQJ7osML8Fn0Y vX2UzX0I2ls+7ZAhG0FaOEPB/uDt248M9Oem0bB/RyK1rZ/pzMYY1qgjUQ+00RjdPvuBfX/pBk5BS 1xdzuSwxkukpVVxGevTzbwDj/ujyxFE9ciC7S+eC5z4LJAllsy9i4Zm8XX4TRkDMBqTvBaN28wnsW m99dvS4Jr9nwTlKD1bngZQ==; Date: Sat, 01 Feb 2025 10:50:21 +0200 Message-Id: <86wmeagib6.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Ship Mints on Fri, 31 Jan 2025 19:10:47 -0500) References: X-Spam-Score: -2.3 (--) 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 (---) > From: Ship Mints > Date: Fri, 31 Jan 2025 19:10:47 -0500 > > The behaviors below can be seen on 29, 30, 31 (I don't have an earlier Emacs to test but these issues > probably are long-standing). Let's discuss these as I suspect there may be historical reasons for these > behaviors that I'm unaware of, or maybe these are legitimate, even if old. It's also possible that I'm > misunderstanding something. Thanks, but please don't mix separate issues in the same bug report. If you think file-name-directory has a bug (I disagree), please report a separate bug against file-name-directory. If you think file-equal-p should accept nil as its argument (I'm not sure I will agree, but maybe you will convince), please report a separate feature-request bug about that function. > Issue 3: > > project-forget-projects-under crashes when `project-list-file' contains "/home/username", which appears in > my remembered project list. It doesn't crash, it signals an error. Crashing means the entire Emacs session goes down in flames. > (defun project--read-project-list () > ... > (abbreviate-file-name name) ; converts "/home/username" to "~" > > (defun project-forget-projects-under () > ... > (dolist (proj (project-known-project-roots)) > (when (file-equal-p (file-name-directory proj) dir) ; <--- boom on nil > > I'm happy to submit patches for any or all of these including guarding project-forget-projects-under to check > for nil and/or amending project--read-project-list to convert "~" to "~/" as workarounds, with each submitted > against a discrete bug number. I think this should be solved in project.el, but let's hear what Dmitry (CC'ed) thinks. From unknown Fri Jun 20 19:49:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75983: project error with file-name-directory "~" returning nil Resent-From: Ship Mints Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Feb 2025 11:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Dmitry Gutov , 75983@debbugs.gnu.org Received: via spool by 75983-submit@debbugs.gnu.org id=B75983.1738407984416 (code B ref 75983); Sat, 01 Feb 2025 11:07:02 +0000 Received: (at 75983) by debbugs.gnu.org; 1 Feb 2025 11:06:24 +0000 Received: from localhost ([127.0.0.1]:56565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1teBKS-00006d-6M for submit@debbugs.gnu.org; Sat, 01 Feb 2025 06:06:24 -0500 Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]:55666) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1teBKP-00006F-Od for 75983@debbugs.gnu.org; Sat, 01 Feb 2025 06:06:22 -0500 Received: by mail-vs1-xe33.google.com with SMTP id ada2fe7eead31-4afe70b41a8so866713137.3 for <75983@debbugs.gnu.org>; Sat, 01 Feb 2025 03:06:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738407976; x=1739012776; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=l53cCMzD2DHO9wVjUxADbNmPnGso0pNT6lbI7e9sXIE=; b=FtG2sTzCBB9BSbr68+6Y2DhFj6XzG+qCHixSkFycngA5ePH9nRvJF9fKLbmghynbGI TGtPofgQ3LIbOGTgVzJmA4av7mwcXsFKtf1k9lH3kJ00WK4RFBz8JhNKOkGWa/hR2XNx nO9aneETanLwjC0/mTSA45/2uj/jShlGkEbzl6wdcCbU17TQWm/Ur/4lmJcX6jWnCsel xq9xe4wgGjsGnfBMI4pUYaw/lH2MviK2TL9/qCtbNmEH92uDvnlHNAMa/HVT+/lPPsV1 en4OzgJtIc3uSfDmwV03N6RJOs45Ge1yVUsui/UJiyDiLhITllooO97hBPdk0PzQpd6V /vJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738407976; x=1739012776; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=l53cCMzD2DHO9wVjUxADbNmPnGso0pNT6lbI7e9sXIE=; b=nblpSmO5V7IszhRvb3Wmw8XxfIjm91MAWtBV0KVz6YXyaTbb5Dzbkz74BadwrlXC8a gyX5lJBKafKe5Dy+5L497MFbpY3+pvC9oQY7Gcwlps2H+rI1bwILhMdrI3X+gpVTdalC HzekGKtIhpohYp1VY71sQ6MgSTQzQ2nX30CC6kli8G/XrdpiPKQuc5+QFV6TQsxQaQzW pSkkv0WctxWj5KnijVgd7gvBtvBXxqQ2BE2E5u09bC7CIGRQfscAKTkMktaZdfCt9mGa ZWkMeLm/IP5wrbVlx9Qabbv6w288+HO9JeFAzZ3XXGWvXH3mU07E/0Pa0Cz+1bTmeSL5 p+VQ== X-Forwarded-Encrypted: i=1; AJvYcCW8C+fGimzbA8fvTgmYXC3XiPXP7gVHcask5baHWkCaS5SMFqSfeRfZOygcmeNyZJ18XfAdwA==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzqXub2yntxOs5OcH/kvib7SM+sLBLLiFmy6UYNfkGxAdoKMKtX Gg+cYLwe5CR3ZLMFQfHM5RxcgTn0vpWmopxFaYCTK2TqfS6PHmnHYhFLZTiE8TOeRQ1YJ8Im5iZ XYCDgoY4RgGYPxuHy+aNfXJwDxGI= X-Gm-Gg: ASbGncvTaUe3vaFhWyNT+mbhdCpW8jDpIgHhIXMwGBTdV4LPa+W3wyPt4N3jlAXQwMA X5bUtSoWjSdg5KZh1886FY8vDjwUqmCoGgM9MiDkRhPRWMGA7RwEZHblmAV8CV7KTrUe5zhZ7 X-Google-Smtp-Source: AGHT+IEzygrOckmWoovcR5lK4n8pQFYr5RovjxG6rtzVrsfodsLfFYpt4b6zuhVAgc2RxCAJ8+Rno5Oga6MwwYsnhkI= X-Received: by 2002:a05:6102:2ad3:b0:4af:bb06:62d with SMTP id ada2fe7eead31-4b9a4f499c9mr11419010137.11.1738407975871; Sat, 01 Feb 2025 03:06:15 -0800 (PST) MIME-Version: 1.0 References: <86wmeagib6.fsf@gnu.org> In-Reply-To: <86wmeagib6.fsf@gnu.org> From: Ship Mints Date: Sat, 1 Feb 2025 06:04:21 -0500 X-Gm-Features: AWEUYZnQxmuc3_Y4ivso825Td2p36P2KqQa-sSeio460xS8zeZzo_vRxYs6EFp0 Message-ID: Content-Type: multipart/alternative; boundary="000000000000e06ba3062d12a5b1" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --000000000000e06ba3062d12a5b1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Separate bugs reports for sure, Eli, but I first thought it useful to discuss holistically to illustrate. Let's consider this bug report to be solely about project. Dmitry, I think the following patch to project--write-project-list might suffice to avoid this in the future: diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index f2a27ff91dd..f9b3b8891bc 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1824,7 +1824,7 @@ project--read-project-list (lambda (elem) (let ((name (car elem))) (list (if (file-remote-p name) name - (abbreviate-file-name name))))) + (file-name-as-directory (abbreviate-file-name name)))))) (condition-case nil (read (current-buffer)) (end-of-file This causes /Users/xxx to appear as /Users/xxx/ in the project file and then project--read-project-list produces ~/ rather than ~ for which file-name-directory produces nil. (defun project--read-project-list () ... (file-name-as-directory (abbreviate-file-name name)))))) Note: I did not consider the tramp/remote file cases in this analysis. On Sat, Feb 1, 2025 at 3:50=E2=80=AFAM Eli Zaretskii wrote: > > From: Ship Mints > > Date: Fri, 31 Jan 2025 19:10:47 -0500 > > > > The behaviors below can be seen on 29, 30, 31 (I don't have an earlier > Emacs to test but these issues > > probably are long-standing). Let's discuss these as I suspect there may > be historical reasons for these > > behaviors that I'm unaware of, or maybe these are legitimate, even if > old. It's also possible that I'm > > misunderstanding something. > > Thanks, but please don't mix separate issues in the same bug report. > If you think file-name-directory has a bug (I disagree), please report > a separate bug against file-name-directory. If you think file-equal-p > should accept nil as its argument (I'm not sure I will agree, but > maybe you will convince), please report a separate feature-request bug > about that function. > > > Issue 3: > > > > project-forget-projects-under crashes when `project-list-file' contains > "/home/username", which appears in > > my remembered project list. > > It doesn't crash, it signals an error. Crashing means the entire > Emacs session goes down in flames. > > > (defun project--read-project-list () > > ... > > (abbreviate-file-name name) ; converts "/home/username" to "~" > > > > (defun project-forget-projects-under () > > ... > > (dolist (proj (project-known-project-roots)) > > (when (file-equal-p (file-name-directory proj) dir) ; <--- boom > on nil > > > > I'm happy to submit patches for any or all of these including guarding > project-forget-projects-under to check > > for nil and/or amending project--read-project-list to convert "~" to > "~/" as workarounds, with each submitted > > against a discrete bug number. > > I think this should be solved in project.el, but let's hear what > Dmitry (CC'ed) thinks. > --000000000000e06ba3062d12a5b1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Separate bugs reports for sure, Eli, but I first though= t it useful to discuss holistically to illustrate. Let's consider this = bug report to be solely about project.

Dmitry, I think the following patch to project--= write-project-list might suffice to avoid this in the future:

diff --git a/lisp/progmodes/pro= ject.el b/lisp/progmodes/project.el
index f2a27ff91dd..f9b3b8891bc 10064= 4
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
= @@ -1824,7 +1824,7 @@ project--read-project-list
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda (elem)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((name (car elem)))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (list (i= f (file-remote-p name) name
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (abbreviate-file-name name= )))))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (file-name-as-directory (abbreviate-file-name n= ame))))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (condi= tion-case nil
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (read (current-buffer))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (end-of-file

This causes=C2=A0/Users/xxx to appear as /= Users/xxx/ in the project file and then project--read-project-list produces= ~/ rather than ~ for which file-name-directory produces nil.
<= div class=3D"gmail_default">
(defun project--read-project-list ()
...
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(file-name-a= s-directory (abbreviate-file-name name))))))

Note: I did not consider the tramp/remo= te file cases in this analysis.

On Sat, F= eb 1, 2025 at 3:50=E2=80=AFAM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Ship Mints <shipmints@gmail.com>
> Date: Fri, 31 Jan 2025 19:10:47 -0500
>
> The behaviors below can be seen on 29, 30, 31 (I don't have an ear= lier Emacs to test but these issues
> probably are long-standing). Let's discuss these as I suspect ther= e may be historical reasons for these
> behaviors that I'm unaware of, or maybe these are legitimate, even= if old. It's also possible that I'm
> misunderstanding something.

Thanks, but please don't mix separate issues in the same bug report. If you think file-name-directory has a bug (I disagree), please report
a separate bug against file-name-directory.=C2=A0 If you think file-equal-p=
should accept nil as its argument (I'm not sure I will agree, but
maybe you will convince), please report a separate feature-request bug
about that function.

> Issue 3:
>
> project-forget-projects-under crashes when `project-list-file' con= tains "/home/username", which appears in
> my remembered project list.

It doesn't crash, it signals an error.=C2=A0 Crashing means the entire<= br> Emacs session goes down in flames.

> (defun project--read-project-list ()
> ...
>=C2=A0 =C2=A0 (abbreviate-file-name name) ; converts "/home/userna= me" to "~"
>
> (defun project-forget-projects-under ()
> ...
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(dolist (proj (project-known-project-roots))=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (file-equal-p (file-name-direct= ory proj) dir) ; <--- boom on nil
>
> I'm happy to submit patches for any or all of these including guar= ding project-forget-projects-under to check
> for nil and/or amending project--read-project-list to convert "~&= quot; to "~/" as workarounds, with each submitted
> against a discrete bug number.

I think this should be solved in project.el, but let's hear what
Dmitry (CC'ed) thinks.
--000000000000e06ba3062d12a5b1-- From unknown Fri Jun 20 19:49:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75983: project error with file-name-directory "~" returning nil Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Feb 2025 02:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ship Mints , Eli Zaretskii Cc: 75983@debbugs.gnu.org Received: via spool by 75983-submit@debbugs.gnu.org id=B75983.173932861319228 (code B ref 75983); Wed, 12 Feb 2025 02:51:02 +0000 Received: (at 75983) by debbugs.gnu.org; 12 Feb 2025 02:50:13 +0000 Received: from localhost ([127.0.0.1]:59863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ti2pI-0004zu-5t for submit@debbugs.gnu.org; Tue, 11 Feb 2025 21:50:12 -0500 Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]:46211) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ti2p3-0004tY-29 for 75983@debbugs.gnu.org; Tue, 11 Feb 2025 21:49:57 -0500 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.phl.internal (Postfix) with ESMTP id D567D13808BF; Tue, 11 Feb 2025 21:49:51 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Tue, 11 Feb 2025 21:49:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1739328591; x=1739414991; bh=QLxNMkWqMsNEEoD8SAMzp7cJj2Whf3is62syUrFt4r4=; b= lErwIvNBY2H55+pOxN1kEBJ3IprOhk5Tnjx42anD2ICv4d5koZLwlizC49CnX/aD GYsxRr76rwSFYCx+b5eYNpATb1742OV0iXZaXve7DwJBxNS4nY4HzfDoskyUgnQh 4V9qVo1Oh8/C9iGX6GMtu9flLxOqgOKE29GZ6awogyUEA+GXy851VDBeA6JGlmG2 MZHVYCXMMYHR0TDKEzNevrTWu7NKHH6hLNDAJ1ZChfUMWaq9wJdA/ILKtk6l180l SNn37C3tILulekbKuJY/vObINU4RNPeYWT6gPr5wb4eDADH5R+Cnoz3PnR/vxgrA u+kiONFZHQL4r9BwPrz6aQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1739328591; x= 1739414991; bh=QLxNMkWqMsNEEoD8SAMzp7cJj2Whf3is62syUrFt4r4=; b=L bsfQ5jModFEe00dsklEr5dHSwRVHQly4rkrGBOy2GRjvVE9SytraTGcNag31FzBl EmDGDRDrho61jOI4ucaXwcGrkEhD0TtxqnTwe9LpzpczvaHf3fdi4Rt4jewsDZr2 uWgq9YbUSqLonl4BReX/LK+npDlOHRccoQI97MaStIvMRFn3uDCc3KeYcb9tC5Fa 8nwtGDKLAkjvMKnUq+eRib0JpWPacbO+6ZGDFsF/t+R/O9Y5dfsB7btDyv1kxROM xmpnOLaJAzGOl8l8iZIfNVZYjcD/bq8Yd8xb9sm2R2JCc/5F0sa/LKlVPNENrQ2f DsFnjyZx9ifk23O7AanZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdegvdejvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddv jeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrd guvghvqeenucggtffrrghtthgvrhhnpeegleefteekgffhvdfhtdegveevveetteegteev geettdehhfdukeetheffueekkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthht ohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepshhhihhpmhhinhhtshesgh hmrghilhdrtghomhdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtthho peejheelkeefseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 11 Feb 2025 21:49:50 -0500 (EST) Message-ID: <3de49cb1-8617-484b-a0af-82517b9e34e5@gutov.dev> Date: Wed, 12 Feb 2025 04:49:46 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <86wmeagib6.fsf@gnu.org> Content-Language: en-US From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) 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: -1.0 (-) Hi! On 01/02/2025 13:04, Ship Mints wrote: > Dmitry, I think the following patch to project--write-project-list might > suffice to avoid this in the future: > > diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el > index f2a27ff91dd..f9b3b8891bc 100644 > --- a/lisp/progmodes/project.el > +++ b/lisp/progmodes/project.el > @@ -1824,7 +1824,7 @@ project--read-project-list >                 (lambda (elem) >                   (let ((name (car elem))) >                     (list (if (file-remote-p name) name > -                           (abbreviate-file-name name))))) > +                           (file-name-as-directory (abbreviate-file- > name name)))))) >                 (condition-case nil >                     (read (current-buffer)) >                   (end-of-file Yeah, this is a decent solution, thanks. Any idea though, how an entry without a trailing "/" got into that file? Written by some older version of project.el? From unknown Fri Jun 20 19:49:05 2025 X-Loop: help-debbugs@gnu.org Subject: bug#75983: project error with file-name-directory "~" returning nil Resent-From: Ship Mints Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Feb 2025 10:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: Eli Zaretskii , 75983@debbugs.gnu.org Received: via spool by 75983-submit@debbugs.gnu.org id=B75983.173935509528951 (code B ref 75983); Wed, 12 Feb 2025 10:12:02 +0000 Received: (at 75983) by debbugs.gnu.org; 12 Feb 2025 10:11:35 +0000 Received: from localhost ([127.0.0.1]:32816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ti9iQ-0007Wt-RL for submit@debbugs.gnu.org; Wed, 12 Feb 2025 05:11:35 -0500 Received: from mail-vk1-xa34.google.com ([2607:f8b0:4864:20::a34]:45369) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ti9i8-0007WD-0w for 75983@debbugs.gnu.org; Wed, 12 Feb 2025 05:11:17 -0500 Received: by mail-vk1-xa34.google.com with SMTP id 71dfb90a1353d-51eb18130f9so1876056e0c.3 for <75983@debbugs.gnu.org>; Wed, 12 Feb 2025 02:11:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739355070; x=1739959870; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=GOxKTHvRsuvGUpEvs/yFX8uc4dwrEvkJkFQexCqsiA8=; b=jaGPO68Z8vcoFNct8A92iXUH8SrC4+KQFuj1Mh/hBr8lslJI+etTYvb8mgbVwID1ud TzY0QwFMIBunnY9cGYE3uEa/er3IsTe83ecYevXyD6E2ajX5sGF8erMhRx0IMjgFUDO6 LEVi4MLPjww2gUaZsujHcUMmgCJBrYbuivEGdy1boeLC9OfnwWfRoh2CMG7oomkEiz6X wh3ySne0o8QKKVHoobuqHHj/eJzZp0f3k9enoR8Qu7Cx8NZ/KxUIjM/+x8o/11y7U9ge bgZ+oSiiCti5OlctcpTVcuRRWXxoO7rYFzJl2oTfMDydz8D0Mh7uLE6UFkzafX+MirdU ldEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739355070; x=1739959870; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GOxKTHvRsuvGUpEvs/yFX8uc4dwrEvkJkFQexCqsiA8=; b=icnnz+9Vigb+tmDsKDUrxZeT5GqpmcLhfUWSMhkKF4MvrsY02WXyP65aNig308DZ0z /w3rFx7Igs2zTzWqaYN+xSSA2TZ2kSwuO+7dQxBPx0gX/Q9P2thIyHqnH052iH7VC0KP Vmil9a3eWapmhXfuqjHfZXU7MZywXMXTBQLYJ01WrR7oOUuRhAv9tTk8MdB6DCs7vvA1 Z9Y/1RUE6JLf58CbrR1Df4cGOzKS1dC/LW0HJe5/ki0Zwa36h82UFMuLVQ0MmcXPP1yR eUaOhMzRYt1tbilQVml5lzPbVvNh3VUiHNfzkaGeUxPEcd8cWzJlQ+4AQFvr6k+evzRv JpCQ== X-Forwarded-Encrypted: i=1; AJvYcCUcTlmKPKzuqPETlKoKFl09noad5CcKtmVYPCXjmDAPKBFRfHgXpUiLZy3V7balSJTc2MQnxA==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yz+DNwAb/IjoAmzkWjbuxAWFigH1V4kGbEUiMmqpqeAkySmrlix CgYF7VgIp3M+3y0PknN4oguf557RT6f3UQ37wrePLV/5GawYhHn8wrtbpF9QY2ISv/ByPChG9AW KE52Fkik97Y11ZTJ8jhyOai/vIxU= X-Gm-Gg: ASbGncvVtmmSHubiILag6EFuF9p2vbb0EsJhdY9mVHLydnOME4Tejl6TOT/b7z4TLCv MOi8cxFIa3jyHfheEv27szFhvteahC88CODVl5Fks/IOhhpj+/rmUGf9AwLF9L+rkZ7JWymhP X-Google-Smtp-Source: AGHT+IG1GqnAqHKK7XeNGd1XLU8jhmnrZSrRlj/wk4D4OPYrgLmnfvTYLPrC7bRoVzKRatJcvMVrVOGLjFVvGHjY8WE= X-Received: by 2002:a05:6122:3295:b0:520:3e1c:500f with SMTP id 71dfb90a1353d-52069dcd732mr875287e0c.8.1739355070189; Wed, 12 Feb 2025 02:11:10 -0800 (PST) MIME-Version: 1.0 References: <86wmeagib6.fsf@gnu.org> <3de49cb1-8617-484b-a0af-82517b9e34e5@gutov.dev> In-Reply-To: <3de49cb1-8617-484b-a0af-82517b9e34e5@gutov.dev> From: Ship Mints Date: Wed, 12 Feb 2025 05:10:59 -0500 X-Gm-Features: AWEUYZk2asbXynAMeziEBQqKw-rHTMX7ykGzTLLWN9RhTDgIFNq_6Mqgh61Yev0 Message-ID: Content-Type: multipart/alternative; boundary="00000000000018d79c062def29d0" X-Spam-Score: 0.7 (/) 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: -0.3 (/) --00000000000018d79c062def29d0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I don't know. Could have been from an older project, yes. On Tue, Feb 11, 2025 at 9:49=E2=80=AFPM Dmitry Gutov wro= te: > Hi! > > On 01/02/2025 13:04, Ship Mints wrote: > > Dmitry, I think the following patch to project--write-project-list migh= t > > suffice to avoid this in the future: > > > > diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el > > index f2a27ff91dd..f9b3b8891bc 100644 > > --- a/lisp/progmodes/project.el > > +++ b/lisp/progmodes/project.el > > @@ -1824,7 +1824,7 @@ project--read-project-list > > (lambda (elem) > > (let ((name (car elem))) > > (list (if (file-remote-p name) name > > - (abbreviate-file-name name))))) > > + (file-name-as-directory (abbreviate-file- > > name name)))))) > > (condition-case nil > > (read (current-buffer)) > > (end-of-file > > Yeah, this is a decent solution, thanks. > > Any idea though, how an entry without a trailing "/" got into that file? > Written by some older version of project.el? > --00000000000018d79c062def29d0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I don't know. Could have been from an older project, yes.

On Tue, Feb 11, 2025 at 9:49=E2=80=AFPM Dmitry Gutov <<= a href=3D"mailto:dmitry@gutov.dev">dmitry@gutov.dev> wrote:
Hi!

On 01/02/2025 13:04, Ship Mints wrote:
> Dmitry, I think the following patch to project--write-project-list mig= ht
> suffice to avoid this in the future:
>
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index f2a27ff91dd..f9b3b8891bc 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -1824,7 +1824,7 @@ project--read-project-list
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (lambda = (elem)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= let ((name (car elem)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (list (if (file-remote-p name) name
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (abbreviate-file-name name)))))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (file-name-as-directory (abbreviate-file-
> name name))))))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (conditi= on-case nil
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (read (current-buffer))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= end-of-file

Yeah, this is a decent solution, thanks.

Any idea though, how an entry without a trailing "/" got into tha= t file?
Written by some older version of project.el?
--00000000000018d79c062def29d0-- From unknown Fri Jun 20 19:49:05 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: Ship Mints Subject: bug#75983: closed (Re: bug#75983: project error with file-name-directory "~" returning nil) Message-ID: References: <347ce2da-306e-4949-a631-73bf9ae12f0f@gutov.dev> X-Gnu-PR-Message: they-closed 75983 X-Gnu-PR-Package: emacs Reply-To: 75983@debbugs.gnu.org Date: Wed, 12 Feb 2025 16:08:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1739376482-30033-1" This is a multi-part message in MIME format... ------------=_1739376482-30033-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #75983: project crash, file-name-directory "~", file-equal-p nil 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 75983@debbugs.gnu.org. --=20 75983: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D75983 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1739376482-30033-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 75983-done) by debbugs.gnu.org; 12 Feb 2025 16:07:09 +0000 Received: from localhost ([127.0.0.1]:37927 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tiFGX-0007mw-15 for submit@debbugs.gnu.org; Wed, 12 Feb 2025 11:07:09 -0500 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]:39095) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tiFGV-0007mP-IP for 75983-done@debbugs.gnu.org; Wed, 12 Feb 2025 11:07:07 -0500 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.stl.internal (Postfix) with ESMTP id 1CCED11401AD; Wed, 12 Feb 2025 11:07:02 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Wed, 12 Feb 2025 11:07:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1739376421; x=1739462821; bh=A8+665Fb0n+Fb3z5gVyQ4plmn6ioWIAkfcV+BXJvp4g=; b= em5kxwUBkNPZLRV1t24MrpjhZ1i0K8mJBdrWlXXW/vFwWPQuCRL00gKQCkhEsg02 7CuFzfiB4RxPpyceI/DvC11PuiUIuk7I7pgvqCdtSdScaxOhG+BJg48aiayerfJQ 8I3ZsvUWmzW75ZYOIgS/PTInhnEoSNFI19+Bj62zPvAxBhItZ/xIvJtH3vyRIwaL g3Z3QLqBhR0vRmBURs/O7IUIfOyc9c6lXKUmjJoOahC6IxAkMETatBLQ39aZch09 51GE7ay09pRRlNQOHogm+bb59AtztqP5SIcJdZaDSc2vcwdortST0PwyOFMOjypT ROyY378A40cYu34XeLrw/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1739376421; x= 1739462821; bh=A8+665Fb0n+Fb3z5gVyQ4plmn6ioWIAkfcV+BXJvp4g=; b=a PUssqnpzMAMUJR5wJxk+2oqbiEYV0J9F1eJfFiLERUPebEKcVVB4pS0j/miunYfB WVjPXxO2DQbyfHw19rKxhzxyGVGQrlm5zsSn+vQU8GQdYdh1WwtiEoeUItLNH8Ib iWL/bvi/PzHpRb5IxBUU3sBj1xDEX5TN2u4utkgD9DA6lVwJvmv0EmAIMg+dz78m p/lv0fugkUizBYURl7MOMphgTRolxwc3rM2Hhz9jC/Gzms76PDsy/i39EUbMkHu5 CjHT1QoIEd1rnHcIi+O2/SYFm2HnlK+kVyFGahHDIvEiq/9Cwc2EsAwgrVQR3HEZ NuY7NkNvBfUVbWKoHlneg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdeggeefudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddv jeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrd guvghvqeenucggtffrrghtthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeu fedtvddtveefhfdvveegudejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthht ohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepshhhihhpmhhinhhtshesgh hmrghilhdrtghomhdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtthho peejheelkeefqdguohhnvgesuggvsggsuhhgshdrghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Feb 2025 11:07:00 -0500 (EST) Message-ID: <347ce2da-306e-4949-a631-73bf9ae12f0f@gutov.dev> Date: Wed, 12 Feb 2025 18:06:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#75983: project error with file-name-directory "~" returning nil To: Ship Mints References: <86wmeagib6.fsf@gnu.org> <3de49cb1-8617-484b-a0af-82517b9e34e5@gutov.dev> Content-Language: en-US From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75983-done Cc: Eli Zaretskii , 75983-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: -1.0 (-) On 12/02/2025 12:10, Ship Mints wrote: > I don't know. Could have been from an older project, yes. All right. Well, no problem adding the conversion to account for similar cases. Pushed to master as 2bb38cc46dfedfb1, closing. ------------=_1739376482-30033-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 1 Feb 2025 00:12:53 +0000 Received: from localhost ([127.0.0.1]:55443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1te181-0005J2-50 for submit@debbugs.gnu.org; Fri, 31 Jan 2025 19:12:53 -0500 Received: from lists.gnu.org ([2001:470:142::17]:47968) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1te17x-0005If-Ud for submit@debbugs.gnu.org; Fri, 31 Jan 2025 19:12:51 -0500 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 1te17r-0001pG-R9 for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2025 19:12:43 -0500 Received: from mail-vk1-xa30.google.com ([2607:f8b0:4864:20::a30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1te17q-0001k0-7u for bug-gnu-emacs@gnu.org; Fri, 31 Jan 2025 19:12:43 -0500 Received: by mail-vk1-xa30.google.com with SMTP id 71dfb90a1353d-5187cd9b8e5so821679e0c.1 for ; Fri, 31 Jan 2025 16:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738368761; x=1738973561; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=gkkh+5FZPn2iUHCpXCotAfuKYcsq94QS5bdeMcJcyHo=; b=N5WeuSF9xyerVHRQap0hUij6+VGcA2c9M6TulrrpISPLEDT/mBSu2hCvR8CXbhm4jy EskcpqaU4l0ZMKElx36gmuDuU3YyjViiESKlAxkEspSPeWmns9aRR9DnYbYVq8gruXy1 3VwrrtZs40xyWF4O6Mpxcbc+LZCwr68odBYW2GnqgpAIjLTUr7YqFkkb0fiUb/5n8Bm4 QsUIQGPBwfmuM5hdLReRn+ylr03BXjVj84BCUEQmzKAEQ4RRPzfKiz85BOaaIvZ/p/sg 5VUEc1m/S3aPywWhNGBIKme63BVe7DTuCZa3+iwEVePSjh0u1zUpJrkBdJIO0YVu1bI5 M2Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738368761; x=1738973561; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=gkkh+5FZPn2iUHCpXCotAfuKYcsq94QS5bdeMcJcyHo=; b=jqMQhzrTG+SMrM2sPWsoExW9zi8EHzcFGXHEWYQAoq0ZNTvgAb0yX5DwHMSSaIRtCK T2uAV1ysTSoINhUO46HagwylQr6yhjbfHAiTwc0EwkPBBbJ/DBbDTL1por497qxN/En1 AltwNMp92WhCGnd2+Xr9hCNoPSm/VHs+y1T0M8tdd9iSnJ1OsFUpZe2QxIrtFmjz/C3C /VmElzTqSUB8/7Nkn4A6/mMKc1KZB4v9yhmLapyIzkl57heDfeHpOc11B+RrcaJL4Dz8 VcH1epAkQiiD84E2QIlxSyxtE+HBI1VcUxD7ipxI+n4qoZNPPrFsRro9gl3f+jTi00YQ IIVA== X-Gm-Message-State: AOJu0Yx6t/tfNRXxAfKZ05/EVVgANlw9LPOS/r+o0nVSz9F7cjF46Z67 Ai0qHwyds3k/0xSDSVmaxWPuryC3H7oCEgNH5VkZ9p9SI/281I2woXieIN+mecLgw1Lyy6Fs9Vr ETtaAPmS8pNUcVEFB99hn+OIhKJ1MpZZN X-Gm-Gg: ASbGncvxRUGw5SbNQh/Mg+mInqyc1a4s4klNipQ0Ha7joObedw7udX3kJ+5qruD5Up5 aByuYNRo3HmFLPuLEml/gPDOCUJ3I5kqGOd8nMLpBncRgQTDkVAOiwFPel6D8f7BIOUcdAQVz X-Google-Smtp-Source: AGHT+IHC8j2ZAIe/y13jupJszlf7QoEAiXXk+2WrBekgGREgMmRnplR8eJfU6JnPVJuaI+SlHIrl0KsbkpwADYF/xXc= X-Received: by 2002:a05:6122:6594:b0:517:167a:5cc6 with SMTP id 71dfb90a1353d-51e9e4d434amr13551470e0c.6.1738368760669; Fri, 31 Jan 2025 16:12:40 -0800 (PST) MIME-Version: 1.0 From: Ship Mints Date: Fri, 31 Jan 2025 19:10:47 -0500 X-Gm-Features: AWEUYZni7--8ysWX40Xq3UgFXsKu3NAHAtrxs04Y0-Yi0L2tHwGmCPLMIERAQDE Message-ID: Subject: project crash, file-name-directory "~", file-equal-p nil To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="00000000000077edfe062d098493" Received-SPF: pass client-ip=2607:f8b0:4864:20::a30; envelope-from=shipmints@gmail.com; helo=mail-vk1-xa30.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) 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: -0.0 (/) --00000000000077edfe062d098493 Content-Type: text/plain; charset="UTF-8" The behaviors below can be seen on 29, 30, 31 (I don't have an earlier Emacs to test but these issues probably are long-standing). Let's discuss these as I suspect there may be historical reasons for these behaviors that I'm unaware of, or maybe these are legitimate, even if old. It's also possible that I'm misunderstanding something. Issue 1: (file-name-directory "~") ; returns nil but I think this should return "~/": (file-name-directory (abbreviate-file-name "/home/username")) ; same (file-name-directory (abbreviate-file-name "/Users/username")) ; for all us macOS users Issue 2: I think file-equal-p should accept nil and consider it unspecified as in its docstring: "If FILE1 or FILE2 does not exist, the return value is unspecified." And/or find-file-name-handler should accept nil and then return nil. (file-equal-p "~" "~") ; t (file-equal-p "~" "/home/username") ; t (file-equal-p "~" (file-name-directory "~")) ; boom ;; (wrong-type-argument stringp nil) ;; find-file-name-handler(nil file-equal-p) Issue 3: project-forget-projects-under crashes when `project-list-file' contains "/home/username", which appears in my remembered project list. (defun project--read-project-list () ... (abbreviate-file-name name) ; converts "/home/username" to "~" (defun project-forget-projects-under () ... (dolist (proj (project-known-project-roots)) (when (file-equal-p (file-name-directory proj) dir) ; <--- boom on nil I'm happy to submit patches for any or all of these including guarding project-forget-projects-under to check for nil and/or amending project--read-project-list to convert "~" to "~/" as workarounds, with each submitted against a discrete bug number. -Stephane --00000000000077edfe062d098493 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The behaviors below can be seen on 29, 30, 31 (I don't have an earli= er Emacs to test but these issues probably are long-standing). Let's di= scuss these as I suspect there may be historical reasons for these behavior= s that I'm unaware of, or maybe these are legitimate,=C2=A0even if old.= It's also possible that I'm misunderstanding something.

Issue 1:

(file-name-directory "~") ; returns nil but I think = this should return "~/":
(file-name-directory
=C2=A0 (abbreviate-file-name "/home/username")) ; same
(file-name-director= y
=C2=A0 (abbreviate-file-name "/Use= rs/username")) ; for all us macOS users

Issue 2:

I think file-equal-p should accept nil and consider it unspecifie= d as in its docstring: "If FILE1 or FILE2 does not exist, the return v= alue is unspecified."

And/or find-file-name-handler should accept nil an= d then return nil.

(file-equal-p "~" "~") ; t
=
(file-equal-p "~" "/home/userna= me") ; t
(file-equal-p "~"= (file-name-directory "~")) ; boom
;; (wrong-type-argument stringp nil)
=
;; find-file-name-handler(nil file-equal-p)

Issue 3:

project-forget-projects-under crashes w= hen `project-list-file' contains "/home/username", which appe= ars in my remembered project list.

(defun project--read-project-list ()
...
=C2=A0 =C2=A0(abbreviate= -file-name name) ; converts "/home/username" to "~"

(defun project-f= orget-projects-under ()
...
=C2=A0 =C2=A0 =C2=A0 (dolist (proj (project-known-project-roots))=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (file-equal-p (file-name-directory pr= oj) dir) ; <--- boom on nil

I'm happy to submit patches for any or all of th= ese including guarding project-forget-projects-under to check for nil and/o= r amending project--read-project-list to convert "~" to "~/&= quot; as workarounds, with each submitted against a discrete bug number.

<= div class=3D"gmail_default" style=3D"font-family:monospace">-Stephane
=

--00000000000077edfe062d098493-- ------------=_1739376482-30033-1--