From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Utkarsh Singh Newsgroups: gmane.emacs.bugs Subject: bug#47547: 28.0.50; [PATCH] Eshell cannot 'cd' in directory with 'eshell' as name Date: Thu, 01 Apr 2021 20:22:05 +0530 Message-ID: <87h7kqgiqy.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5445"; mail-complaints-to="usenet@ciao.gmane.io" To: 47547@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 01 16:50:22 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 1lRyeM-0001LN-Hy for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Apr 2021 16:50:22 +0200 Original-Received: from localhost ([::1]:48680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRyeL-0007M7-KG for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 01 Apr 2021 10:50:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRye2-0007Dm-Ui for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 10:50:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lRye2-0002Xl-L9 for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 10:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lRye2-0002HE-Ih for bug-gnu-emacs@gnu.org; Thu, 01 Apr 2021 10:50:02 -0400 X-Loop: help-debbugs@gnu.org 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 X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16172885998737 (code B ref -1); Thu, 01 Apr 2021 14:50:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Apr 2021 14:49:59 +0000 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) 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-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:203427 Archived-At: 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