unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#767: 23.0.60; compilation-start gives bad default-directory
@ 2008-08-23 13:05 ` Lennart Borgman (gmail)
  2008-09-07 19:20   ` bug#767: marked as done (23.0.60; compilation-start gives bad default-directory) Emacs bug Tracking System
  2008-09-07 19:34   ` bug#767: 23.0.60; compilation-start gives bad default-directory Stefan Monnier
  0 siblings, 2 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-08-23 13:05 UTC (permalink / raw)
  To: emacs-pretest-bug

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

If on w32 default-directory is something like c:\top\sub then the
subprocess started by compilation-start will get pwd=c:\top.

This can be cured by the attached patch for this special case, but it is
only a demonstration of the problem, not the right fix for this problem.

The attached patch only does

  (let ((default-directory (file-name-as-directory default-directory))

just before calling `start-file-process-shell-command'.

A slightly better fix would probably be to add the same thing in
`start-file-process', but it seems to me that this should handled at the
C level to catch all cases. I do not know where to do that but it must
be done somewhere before make_process in start-process.


In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2008-08-10
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags
-Ic:/g/include -fno-crossjumping'

[-- Attachment #2: compile-start-default-directory.diff --]
[-- Type: text/plain, Size: 675 bytes --]

? compile-start-default-directory.diff
Index: compile.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.476
diff -b -u -r1.476 compile.el
--- compile.el	13 Jun 2008 16:22:16 -0000	1.476
+++ compile.el	23 Aug 2008 12:49:59 -0000
@@ -1246,7 +1246,8 @@
 	    (funcall compilation-process-setup-function))
 	(compilation-set-window-height outwin)
 	;; Start the compilation.
-	(let ((proc
+	(let* ((default-directory (file-name-as-directory default-directory))
+               (proc
 	       (if (eq mode t)
 		   ;; comint uses `start-file-process'.
 		   (get-buffer-process

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

* bug#767: 23.0.60; compilation-start gives bad default-directory
@ 2008-08-26 22:18 Chong Yidong
  0 siblings, 0 replies; 11+ messages in thread
From: Chong Yidong @ 2008-08-26 22:18 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: 767

> If on w32 default-directory is something like c:\top\sub then the
> subprocess started by compilation-start will get pwd=c:\top.

Does the following patch fix this?

*** trunk/src/callproc.c.~1.240.~	2008-07-31 12:19:14.000000000 -0400
--- trunk/src/callproc.c	2008-08-26 18:15:59.000000000 -0400
***************
*** 374,379 ****
--- 374,381 ----
  	 a sensible default. */
        current_dir = build_string ("~/");
      current_dir = expand_and_dir_to_file (current_dir, Qnil);
+     current_dir = Ffile_name_as_directory (current_dir);
+ 
      if (NILP (Ffile_accessible_directory_p (current_dir)))
        report_file_error ("Setting current directory",
  			 Fcons (current_buffer->directory, Qnil));






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

* bug#767: marked as done (23.0.60; compilation-start gives bad  default-directory)
  2008-08-23 13:05 ` bug#767: 23.0.60; compilation-start gives bad default-directory Lennart Borgman (gmail)
@ 2008-09-07 19:20   ` Emacs bug Tracking System
  2008-09-07 19:34   ` bug#767: 23.0.60; compilation-start gives bad default-directory Stefan Monnier
  1 sibling, 0 replies; 11+ messages in thread
From: Emacs bug Tracking System @ 2008-09-07 19:20 UTC (permalink / raw)
  To: Chong Yidong

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


Your message dated Sun, 07 Sep 2008 15:14:50 -0400
with message-id <87prnfu5sl.fsf@cyd.mit.edu>
and subject line Re: 23.0.60; compilation-start gives bad default-directory
has caused the Emacs bug report #767,
regarding 23.0.60; compilation-start gives bad default-directory
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
767: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=767
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 4455 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 925 bytes --]

If on w32 default-directory is something like c:\top\sub then the
subprocess started by compilation-start will get pwd=c:\top.

This can be cured by the attached patch for this special case, but it is
only a demonstration of the problem, not the right fix for this problem.

The attached patch only does

  (let ((default-directory (file-name-as-directory default-directory))

just before calling `start-file-process-shell-command'.

A slightly better fix would probably be to add the same thing in
`start-file-process', but it seems to me that this should handled at the
C level to catch all cases. I do not know where to do that but it must
be done somewhere before make_process in start-process.


In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2008-08-10
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags
-Ic:/g/include -fno-crossjumping'

[-- Attachment #2.1.2: compile-start-default-directory.diff --]
[-- Type: text/plain, Size: 675 bytes --]

? compile-start-default-directory.diff
Index: compile.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.476
diff -b -u -r1.476 compile.el
--- compile.el	13 Jun 2008 16:22:16 -0000	1.476
+++ compile.el	23 Aug 2008 12:49:59 -0000
@@ -1246,7 +1246,8 @@
 	    (funcall compilation-process-setup-function))
 	(compilation-set-window-height outwin)
 	;; Start the compilation.
-	(let ((proc
+	(let* ((default-directory (file-name-as-directory default-directory))
+               (proc
 	       (if (eq mode t)
 		   ;; comint uses `start-file-process'.
 		   (get-buffer-process

[-- Attachment #3: Type: message/rfc822, Size: 1003 bytes --]

From: Chong Yidong <cyd@stupidchicken.com>
To: "Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>
Cc: 767-done@emacsbugs.donarmstrong.com
Subject: Re: 23.0.60; compilation-start gives bad default-directory
Date: Sun, 07 Sep 2008 15:14:50 -0400
Message-ID: <87prnfu5sl.fsf@cyd.mit.edu>

I've checked in the fix.


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

* bug#767: 23.0.60; compilation-start gives bad default-directory
  2008-08-23 13:05 ` bug#767: 23.0.60; compilation-start gives bad default-directory Lennart Borgman (gmail)
  2008-09-07 19:20   ` bug#767: marked as done (23.0.60; compilation-start gives bad default-directory) Emacs bug Tracking System
@ 2008-09-07 19:34   ` Stefan Monnier
  2008-09-07 19:40     ` Lennart Borgman (gmail)
  2008-09-07 21:19     ` Eli Zaretskii
  1 sibling, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2008-09-07 19:34 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: 767, emacs-pretest-bug

> If on w32 default-directory is something like c:\top\sub then the

Then it's a bug.  C-h v default-directory says:

   Name of default directory of current buffer.  Should end with slash.
   To interactively change the default directory, use command `cd'.

So if it doesn't end in slash, we have a problem.


        Stefan






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

* bug#767: 23.0.60; compilation-start gives bad default-directory
  2008-09-07 19:34   ` bug#767: 23.0.60; compilation-start gives bad default-directory Stefan Monnier
@ 2008-09-07 19:40     ` Lennart Borgman (gmail)
  2008-09-07 19:59       ` Stefan Monnier
  2008-09-07 21:19     ` Eli Zaretskii
  1 sibling, 1 reply; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-07 19:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 767

Stefan Monnier wrote:
>> If on w32 default-directory is something like c:\top\sub then the
> 
> Then it's a bug.  C-h v default-directory says:
> 
>    Name of default directory of current buffer.  Should end with slash.
>    To interactively change the default directory, use command `cd'.
> 
> So if it doesn't end in slash, we have a problem.


I never noticed that it must end with a slash and in many circumstances
it works without it.

I suggested that this should be fixed somewhere in start-process and I
think Chong added something along those lines.

Do you suggest something else? (Making Emacs actually require the ending
slash seems is not very backwards compatible.)






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

* bug#767: 23.0.60; compilation-start gives bad default-directory
  2008-09-07 19:40     ` Lennart Borgman (gmail)
@ 2008-09-07 19:59       ` Stefan Monnier
  2008-09-07 20:04         ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2008-09-07 19:59 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: 767

> I never noticed that it must end with a slash and in many circumstances
> it works without it.

I know it does in many cases, but as you've found out it doesn't
always work.

> I suggested that this should be fixed somewhere in start-process and I
> think Chong added something along those lines.

I saw that yes.  And I think that given the docstring, the patch should
not let-bind default-directory but just setq it (or do nothing at all).

> (Making Emacs actually require the ending slash seems is not very
> backwards compatible.)

AFAIK it's been that way for ever, so backward compatibility is not
really relevant.


        Stefan






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

* bug#767: 23.0.60; compilation-start gives bad default-directory
  2008-09-07 19:59       ` Stefan Monnier
@ 2008-09-07 20:04         ` Lennart Borgman (gmail)
  2008-09-07 20:38           ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-07 20:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 767

Stefan Monnier wrote:
>> I suggested that this should be fixed somewhere in start-process and I
>> think Chong added something along those lines.
> 
> I saw that yes.  And I think that given the docstring, the patch should
> not let-bind default-directory but just setq it (or do nothing at all).

Why not change the doc string instead and say that it is recommended
that default-directory ends with a slash? I do not understand the reason
for your suggestions above.







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

* bug#767: 23.0.60; compilation-start gives bad default-directory
  2008-09-07 20:04         ` Lennart Borgman (gmail)
@ 2008-09-07 20:38           ` Stefan Monnier
  2008-09-07 20:59             ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2008-09-07 20:38 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: 767

>>> I suggested that this should be fixed somewhere in start-process and I
>>> think Chong added something along those lines.
>> I saw that yes.  And I think that given the docstring, the patch should
>> not let-bind default-directory but just setq it (or do nothing at all).
> Why not change the doc string instead and say that it is recommended
> that default-directory ends with a slash?

Because it worked just fine as it is.  You still haven't told us where
the offending (non slash-terminated) value came from (which is the
thing that needs to be fixed).


        Stefan








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

* bug#767: 23.0.60; compilation-start gives bad default-directory
  2008-09-07 20:38           ` Stefan Monnier
@ 2008-09-07 20:59             ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-07 20:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 767

Stefan Monnier wrote:
>>>> I suggested that this should be fixed somewhere in start-process and I
>>>> think Chong added something along those lines.
>>> I saw that yes.  And I think that given the docstring, the patch should
>>> not let-bind default-directory but just setq it (or do nothing at all).
>> Why not change the doc string instead and say that it is recommended
>> that default-directory ends with a slash?
> 
> Because it worked just fine as it is.  You still haven't told us where
> the offending (non slash-terminated) value came from (which is the
> thing that needs to be fixed).


It is not a bad question, but I can't remember now. Whatever I try to do
I get an ending slash there (unless I do not set default-directory
myself of course). However I am quite sure I did not get that before.
Something must be different ...

The value of default-directory on w32 may still use \ instead of /. That
is the case after "emacs -Q", but that is another problem.






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

* bug#767: 23.0.60; compilation-start gives bad default-directory
  2008-09-07 19:34   ` bug#767: 23.0.60; compilation-start gives bad default-directory Stefan Monnier
  2008-09-07 19:40     ` Lennart Borgman (gmail)
@ 2008-09-07 21:19     ` Eli Zaretskii
  2008-09-07 23:48       ` Lennart Borgman (gmail)
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2008-09-07 21:19 UTC (permalink / raw)
  To: Stefan Monnier, 767; +Cc: emacs-pretest-bug

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Sun, 07 Sep 2008 15:34:10 -0400
> Cc: 767@emacsbugs.donarmstrong.com, emacs-pretest-bug@gnu.org
> 
> > If on w32 default-directory is something like c:\top\sub then the
> 
> Then it's a bug.  C-h v default-directory says:
> 
>    Name of default directory of current buffer.  Should end with slash.
>    To interactively change the default directory, use command `cd'.
> 
> So if it doesn't end in slash, we have a problem.

It does end in a slash on my machine (also on MS-Windows).

I think the original problem is that it uses backslashes instead of
forward slashes.






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

* bug#767: 23.0.60; compilation-start gives bad default-directory
  2008-09-07 21:19     ` Eli Zaretskii
@ 2008-09-07 23:48       ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-09-07 23:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 767

Eli Zaretskii wrote:
>> From: Stefan Monnier <monnier@iro.umontreal.ca>
>> Date: Sun, 07 Sep 2008 15:34:10 -0400
>> Cc: 767@emacsbugs.donarmstrong.com, emacs-pretest-bug@gnu.org
>>
>>> If on w32 default-directory is something like c:\top\sub then the
>> Then it's a bug.  C-h v default-directory says:
>>
>>    Name of default directory of current buffer.  Should end with slash.
>>    To interactively change the default directory, use command `cd'.
>>
>> So if it doesn't end in slash, we have a problem.
> 
> It does end in a slash on my machine (also on MS-Windows).
> 
> I think the original problem is that it uses backslashes instead of
> forward slashes.

No, but I do not understand now why the final forward slash was missing.

But of course it might also mean trouble that default-directory when you
start Emacs on w32 uses backslashes. Is there any reason not to change that?






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

end of thread, other threads:[~2008-09-07 23:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87prnfu5sl.fsf@cyd.mit.edu>
2008-08-23 13:05 ` bug#767: 23.0.60; compilation-start gives bad default-directory Lennart Borgman (gmail)
2008-09-07 19:20   ` bug#767: marked as done (23.0.60; compilation-start gives bad default-directory) Emacs bug Tracking System
2008-09-07 19:34   ` bug#767: 23.0.60; compilation-start gives bad default-directory Stefan Monnier
2008-09-07 19:40     ` Lennart Borgman (gmail)
2008-09-07 19:59       ` Stefan Monnier
2008-09-07 20:04         ` Lennart Borgman (gmail)
2008-09-07 20:38           ` Stefan Monnier
2008-09-07 20:59             ` Lennart Borgman (gmail)
2008-09-07 21:19     ` Eli Zaretskii
2008-09-07 23:48       ` Lennart Borgman (gmail)
2008-08-26 22:18 Chong Yidong

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