GNU bug report logs - #15417
(compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Thu, 19 Sep 2013 10:58:02 UTC

Severity: minor

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15417 in the body.
You can then email your comments to 15417 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15417; Package emacs. (Thu, 19 Sep 2013 10:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 19 Sep 2013 10:58:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: bug-gnu-emacs <at> gnu.org
Subject: (compile "cd /u*r && ... cd: No such directory found via CDPATH
 environment variable
Date: Thu, 19 Sep 2013 18:55:45 +0800
Cannot do
(compile "cd /u*r && echo wow")
will get
cd: No such directory found via CDPATH environment variable

OK, but add "kindly don't use wildcards" etc. to tell the user this is
intentional if so...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15417; Package emacs. (Wed, 25 Sep 2013 05:45:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#15417: (compile "cd /u*r && ... cd: No such directory found
 via CDPATH environment variable
Date: Tue, 24 Sep 2013 23:44:02 -0600
On 9/19/13 4:55 AM, jidanni <at> jidanni.org wrote:
> Cannot do
> (compile "cd /u*r&&  echo wow")
> will get
> cd: No such directory found via CDPATH environment variable
>
> OK, but add "kindly don't use wildcards" etc. to tell the user this is
> intentional if so...

Why is this a bug?  i.e. is there a /u*r directory, and do its permissions
allow you to cd to it (executable bit set for user/group/other as appropriate)?

-- 
Kevin Rodgers
Denver, Colorado, USA





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15417; Package emacs. (Wed, 25 Sep 2013 17:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 15417 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
Cc: 15417 <at> debbugs.gnu.org
Subject: Re: bug#15417: (compile "cd /u*r && ... cd: No such directory found
 via CDPATH environment variable
Date: Wed, 25 Sep 2013 13:06:20 -0400
> Why is this a bug?  i.e. is there a /u*r directory, and do its permissions

Yes, in the shell (which is normally what runs this command), "cd /u*r"
will probably succeed by expanding "/u*r" to "/usr".
But the hack I added to "M-x compile" which tries to recognize a leading
"cd <blabla>" gets in the way.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15417; Package emacs. (Thu, 26 Sep 2013 05:47:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#15417: (compile "cd /u*r && ... cd: No such directory found
 via CDPATH environment variable
Date: Wed, 25 Sep 2013 23:45:18 -0600
On 9/25/13 11:06 AM, Stefan Monnier wrote:
>> Why is this a bug?  i.e. is there a /u*r directory, and do its permissions
>
> Yes, in the shell (which is normally what runs this command), "cd /u*r"
> will probably succeed by expanding "/u*r" to "/usr".
> But the hack I added to "M-x compile" which tries to recognize a leading
> "cd<blabla>" gets in the way.

Ah, I see.

Seems like after extracting the <blabla> arg and substituting the values
of any referenced environment variables (already implemented by the
current hack), you could pass the result to file-expand-wildcards.  Then
check that there is only a single directory in the result, and pass that
directory to `cd'.

-- 
Kevin Rodgers
Denver, Colorado, USA





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15417; Package emacs. (Thu, 26 Sep 2013 13:57:02 GMT) Full text and rfc822 format available.

Message #17 received at 15417 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
Cc: 15417 <at> debbugs.gnu.org
Subject: Re: bug#15417: (compile "cd /u*r && ... cd: No such directory found
 via CDPATH environment variable
Date: Thu, 26 Sep 2013 09:56:49 -0400
> Seems like after extracting the <blabla> arg and substituting the values
> of any referenced environment variables (already implemented by the
> current hack), you could pass the result to file-expand-wildcards.  Then
> check that there is only a single directory in the result, and pass that
> directory to `cd'.

Indeed.  Could you take care of it?


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15417; Package emacs. (Wed, 02 Oct 2013 13:42:01 GMT) Full text and rfc822 format available.

Message #20 received at 15417 <at> debbugs.gnu.org (full text, mbox):

From: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15417 <at> debbugs.gnu.org
Subject: Re: bug#15417: (compile "cd /u*r && ... cd: No such directory found
 via CDPATH environment variable
Date: Wed, 2 Oct 2013 07:41:04 -0600
[Message part 1 (text/plain, inline)]
> > Seems like after extracting the <blabla> arg and substituting the values
> > of any referenced environment variables (already implemented by the
> > current hack), you could pass the result to file-expand-wildcards.  Then
> > check that there is only a single directory in the result, and pass that
> > directory to `cd'.
>
> Indeed.  Could you take care of it?

Sure, sorry for the delay:

**** compile.el~    Fri Jan 21 18:08:13 2011
--- compile.el    Wed Oct  2 07:25:47 2013
***************
*** 1217,1223 ****
      ;; sh -c "cd ..; make"
      (cd (if (string-match "^\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]"
command)
          (if (match-end 1)
!             (substitute-env-vars (match-string 1 command))
            "~")
            default-directory))
      (erase-buffer)
--- 1217,1229 ----
      ;; sh -c "cd ..; make"
      (cd (if (string-match "^\\s *cd\\(?:\\s +\\(\\S +?\\)\\)?\\s *[;&\n]"
command)
          (if (match-end 1)
!             (let* ((substituted-dir
!                 (substitute-env-vars (match-string 1 command)))
!                (expanded-dir
!                 (file-expand-wildcards substituted-dir)))
!               (if (= (length expanded-dir) 1)
!               (car expanded-dir)
!             substituted-dir))
            "~")
            default-directory))
      (erase-buffer)

-- 
Kevin Rodgers
Denver, Colorado


>
>
>         Stefan
>



On Thu, Sep 26, 2013 at 7:56 AM, Stefan Monnier <monnier <at> iro.umontreal.ca>wrote:

> > Seems like after extracting the <blabla> arg and substituting the values
> > of any referenced environment variables (already implemented by the
> > current hack), you could pass the result to file-expand-wildcards.  Then
> > check that there is only a single directory in the result, and pass that
> > directory to `cd'.
>
> Indeed.  Could you take care of it?
>
>
>         Stefan
>
[Message part 2 (text/html, inline)]

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Wed, 02 Oct 2013 23:36:02 GMT) Full text and rfc822 format available.

Notification sent to jidanni <at> jidanni.org:
bug acknowledged by developer. (Wed, 02 Oct 2013 23:36:03 GMT) Full text and rfc822 format available.

Message #25 received at 15417-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Kevin Rodgers <kevin.d.rodgers <at> gmail.com>
Cc: 15417-done <at> debbugs.gnu.org
Subject: Re: bug#15417: (compile "cd /u*r && ... cd: No such directory found
 via CDPATH environment variable
Date: Wed, 02 Oct 2013 19:35:35 -0400
> Sure, sorry for the delay:

Thanks, installed.  There are still many ways to make the code fail, tho.
I think the better solution would be to pass the whole argument to
a shell, so we get the actually correct expansion.


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 31 Oct 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 239 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.