unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15417: (compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable
@ 2013-09-19 10:55 jidanni
  2013-09-25  5:44 ` Kevin Rodgers
  0 siblings, 1 reply; 7+ messages in thread
From: jidanni @ 2013-09-19 10:55 UTC (permalink / raw)
  To: 15417

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...





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15417: (compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable
  2013-09-19 10:55 bug#15417: (compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable jidanni
@ 2013-09-25  5:44 ` Kevin Rodgers
  2013-09-25 17:06   ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2013-09-25  5:44 UTC (permalink / raw)
  To: 15417

On 9/19/13 4:55 AM, jidanni@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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15417: (compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable
  2013-09-25  5:44 ` Kevin Rodgers
@ 2013-09-25 17:06   ` Stefan Monnier
  2013-09-26  5:45     ` Kevin Rodgers
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-09-25 17:06 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: 15417

> 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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15417: (compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable
  2013-09-25 17:06   ` Stefan Monnier
@ 2013-09-26  5:45     ` Kevin Rodgers
  2013-09-26 13:56       ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2013-09-26  5:45 UTC (permalink / raw)
  To: 15417

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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15417: (compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable
  2013-09-26  5:45     ` Kevin Rodgers
@ 2013-09-26 13:56       ` Stefan Monnier
  2013-10-02 13:41         ` Kevin Rodgers
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2013-09-26 13:56 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: 15417

> 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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15417: (compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable
  2013-09-26 13:56       ` Stefan Monnier
@ 2013-10-02 13:41         ` Kevin Rodgers
  2013-10-02 23:35           ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2013-10-02 13:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15417

[-- Attachment #1: Type: text/plain, Size: 1867 bytes --]

> > 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@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
>

[-- Attachment #2: Type: text/html, Size: 2867 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#15417: (compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable
  2013-10-02 13:41         ` Kevin Rodgers
@ 2013-10-02 23:35           ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2013-10-02 23:35 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: 15417-done

> 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





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-10-02 23:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-19 10:55 bug#15417: (compile "cd /u*r && ... cd: No such directory found via CDPATH environment variable jidanni
2013-09-25  5:44 ` Kevin Rodgers
2013-09-25 17:06   ` Stefan Monnier
2013-09-26  5:45     ` Kevin Rodgers
2013-09-26 13:56       ` Stefan Monnier
2013-10-02 13:41         ` Kevin Rodgers
2013-10-02 23:35           ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).