From unknown Tue Aug 19 03:05:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#47547: 28.0.50; [PATCH] Eshell cannot 'cd' in directory with 'eshell' as name Resent-From: Utkarsh Singh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Apr 2021 14:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47547 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 47547@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16172885998737 (code B ref -1); Thu, 01 Apr 2021 14:50:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Apr 2021 14:49:59 +0000 Received: from localhost ([127.0.0.1]:58244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lRydy-0002Gq-Lv for submit@debbugs.gnu.org; Thu, 01 Apr 2021 10:49:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:49828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lRydw-0002Gj-R6 for submit@debbugs.gnu.org; Thu, 01 Apr 2021 10:49:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRydv-00079I-Ej for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 10:49:56 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:37650) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRyds-0002Ph-31 for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 10:49:55 -0400 Received: by mail-pj1-x1033.google.com with SMTP id x7-20020a17090a2b07b02900c0ea793940so3211632pjc.2 for ; Thu, 01 Apr 2021 07:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=AgAKehx45Zh/WrcP9SnSmj1ptvQ/Ozouy6RTiYaeynM=; b=lcYd6W7pSvrvxF9hJkZHRiA6p3tK65TYnMhLnbWKTtWqvy3B9J+P2mg0GbExrU5wzP 9AO8LyKb6FAiDT/Xr4vT75BwSiOhiR4Fn6JUE/mUXDe/rXlAhdbD9JvVyONhGSXxz3VH cvdkspY44fCHzlI3NjKqYfEU1dWXfk4DNVZcoH5NLez1mti6ahPG6AZajNNMFQPcMf15 VZDgqnKFxkyDsCxW+FGjh+FaNUClyBqpZLbPTTqS9GJ4Enr18Aik+L+/E5sqLFAvGoDG QC57OtLaZhR+Cy+1RZrEvZuTGtGQvXYQTDJRcR9pKS5wfaCHCNns83pNxv18FK9ADdCQ peJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=AgAKehx45Zh/WrcP9SnSmj1ptvQ/Ozouy6RTiYaeynM=; b=X7K/bKPaM7t8joQ3ljCoP5SHv9Ouq8FaolBtyZXiOCB93Pmz/e5tedrPHlw5LHNu/4 Own93qfZFlhNXaOb2MAP/t47Qo5B8CkeOCZqL048l2o/b+ZvKNuostJpXNcWR/z+U7Np uaZFEHU3ykVTiNS5Vku/V/1rnlBTp3WAmwU/+dr+UhAg47C28R4ZvXKI/aywgMoKiZqP lJfNRWT3xecT5GHERzF0M8Y7NfrJ8+F6zUzPDidaSjcRt0QU5ymqxEpanjjGo20W0xZE 0kjbvocceeQKS/xuH6R0UoU65H4YCrfqsQPyDxxwKynLI/2JJFDOA+QPkCCfGN7M+z7B i5rQ== X-Gm-Message-State: AOAM531TsLuiwWWDTHY51V2+u4Xc0lpF8wdZ3Ty0Z2GpXjVLq5dOMEbA dN5JPoivPyNsoUWi3qarHtQ72bdRifY= X-Google-Smtp-Source: ABdhPJwiyxLugjZiqV3hElL79G1P/bPhhnro3ioDPrAi+FdZ6Cx862MjJpXGsxf4npUDKOvwQeitDA== X-Received: by 2002:a17:90b:23d1:: with SMTP id md17mr9275139pjb.213.1617288589446; Thu, 01 Apr 2021 07:49:49 -0700 (PDT) Received: from localhost ([45.251.50.21]) by smtp.gmail.com with ESMTPSA id o197sm5962097pfd.42.2021.04.01.07.49.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 07:49:48 -0700 (PDT) From: Utkarsh Singh Date: Thu, 01 Apr 2021 20:22:05 +0530 Message-ID: <87h7kqgiqy.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=utkarsh190601@gmail.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) 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.1 (/) Reproduce the error: (setq eshell-cd-on-directory t) ; in-case you have changed the defaults Invoke eshell and enter the following commands: $ /usr/local/share/emacs/28.0.50/lisp/eshell Read error: Is a directory, /usr/local/share/emacs/28.0.50/lisp/eshell OR $ mkdir /tmp/eshell $ /tmp/eshell Read error: Is a directory, /tmp/eshell/ So where is the problem? Checking `eshell-interpreter-alist' value: ((eshell-visual-command-p . eshell-exec-visual) ((closure (t) (file _args) (string= (file-name-nondirectory file) "eshell")) . eshell/source) (#f(compiled-function (file args) #) . eshell-dirs-substitute-cd)) We can see eshell is using `file-name-nondirectory' to source file which leads to the read error. I suggest to add one more check before loading file from `eshell/source'. One example of such check is `file-regular-p' check and hence I drafted this patch. diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el index aecc48610f..6e6ae1229e 100644 --- a/lisp/eshell/em-script.el +++ b/lisp/eshell/em-script.el @@ -60,8 +60,9 @@ eshell-script-initialize "Initialize the script parsing code." (setq-local eshell-interpreter-alist (cons (cons #'(lambda (file _args) - (string= (file-name-nondirectory file) - "eshell")) + (and (file-regular-p file) + (string= (file-name-nondirectory file)) + "eshell")) 'eshell/source) eshell-interpreter-alist)) (setq-local eshell-complex-commands -- Utkarsh Singh utkarshsingh.xyz From unknown Tue Aug 19 03:05:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#47547: 28.0.50; [PATCH] Eshell cannot 'cd' in directory with 'eshell' as name Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 05 Apr 2021 16:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47547 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Utkarsh Singh Cc: 47547@debbugs.gnu.org Received: via spool by 47547-submit@debbugs.gnu.org id=B47547.161763869532551 (code B ref 47547); Mon, 05 Apr 2021 16:05:01 +0000 Received: (at 47547) by debbugs.gnu.org; 5 Apr 2021 16:04:55 +0000 Received: from localhost ([127.0.0.1]:38432 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lTRih-0008Sw-CN for submit@debbugs.gnu.org; Mon, 05 Apr 2021 12:04:55 -0400 Received: from quimby.gnus.org ([95.216.78.240]:59076) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lTRif-0008Sb-3v for 47547@debbugs.gnu.org; Mon, 05 Apr 2021 12:04:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=UbgKWL2r6quzz+OMqUUndPO84u91ip1kdJIAck/+1Ls=; b=ZcNYKrO4Q2FCBJPz0zfRW2ulwJ uzhe46QbvDWgWIgvHpKSNcCXKqrDIQeYenJq74eN2uXtxVmbPepyt7xQ8q3ajLPHUNQA4y9rr+F8R AumE4UsOIyHpZdj5dSWulbuRmKuse8DQWqb+G6/1P56LiEG8WLLUHBla3kTrXh4C5Ggg=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lTRiW-0006gt-6f; Mon, 05 Apr 2021 18:04:46 +0200 From: Lars Ingebrigtsen References: <87h7kqgiqy.fsf@gmail.com> X-Now-Playing: Yukihiro Takahashi's _What Me Worry?_: "The Real You" Date: Mon, 05 Apr 2021 18:04:43 +0200 In-Reply-To: <87h7kqgiqy.fsf@gmail.com> (Utkarsh Singh's message of "Thu, 01 Apr 2021 20:22:05 +0530") Message-ID: <87pmz8d8f8.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Utkarsh Singh writes: > We can see eshell is using `file-name-nondirectory' to source file which > leads to the read error. I suggest to add one more check before > loading file from `eshell/source'. One example of such ch [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 (-) Utkarsh Singh writes: > We can see eshell is using `file-name-nondirectory' to source file which > leads to the read error. I suggest to add one more check before > loading file from `eshell/source'. One example of such check is > `file-regular-p' check and hence I drafted this patch. Thanks; applied to Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 05 12:04:58 2021 Received: (at control) by debbugs.gnu.org; 5 Apr 2021 16:04:59 +0000 Received: from localhost ([127.0.0.1]:38435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lTRik-0008TD-Lz for submit@debbugs.gnu.org; Mon, 05 Apr 2021 12:04:58 -0400 Received: from quimby.gnus.org ([95.216.78.240]:59090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lTRij-0008Sl-HQ for control@debbugs.gnu.org; Mon, 05 Apr 2021 12:04:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=x1WYgNPTEKh0grgWkT7+MmsT6y6eDa7lzBzqXvapzc8=; b=KADxjpDdIRqkNHA6oFOPa/0h+q zTwBGvOd8FX1H9pdjB/H+EID0rm7lXeplktLG/Fc4U6+XOd47E0uF3+GSU8O6fiEfB2ENO5RUt941 1BnNA63F8NkCVvpuoVs8cv2Iefckbw9pbzjJuczfDJO9TqTGabgzEHJP56GvgThv0Dyw=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lTRic-0006h2-2X for control@debbugs.gnu.org; Mon, 05 Apr 2021 18:04:52 +0200 Date: Mon, 05 Apr 2021 18:04:49 +0200 Message-Id: <87o8esd8f2.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #47547 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 47547 fixed close 47547 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control 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 (-) tags 47547 fixed close 47547 28.1 quit