unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "MIYASHITA Hisashi" <himi@meadowy.org>
Cc: emacs-devel@gnu.org,  knagano@sodan.org
Subject: Re: init_buffer PWD fix
Date: Wed, 24 Apr 2002 16:45:43 +0900	[thread overview]
Message-ID: <u8z7dv8t4.fsf@MILCH.meadowy.org> (raw)
In-Reply-To: <200204240713.g3O7DgO17536@sic.twinsun.com> (Paul Eggert's message of "Wed, 24 Apr 2002 00:13:42 -0700 (PDT)")

Paul Eggert <eggert@twinsun.com> writes:

> But don't similar issues arise in Windows ports?

I think the answer is "No".

Windows dose not have symbolic link and if the current directory
permission dose not allow to enter, we cannot invoke any programs.

> For example, I know that Windows sometimes plays funky games with
> letter case in file names.  Suppose the user prefers one case for the
> directory name, and sets PWD accordingly.  Won't the user be annoyed if
> Emacs uses the different case returned by getcwd?
> Similarly, suppose the Windows directory has a mangled file name that
> is returned by getcwd, but the user prefers the non-mangled name in
> $PWD.

Unfortunately or fortunately, almost all of Windows programs do not
are "PWD" environment variable.  So we won't obtain better pathname
from "PWD".

And top of that, accoding to my test, GetCurrentDirectory()
holds the straightforward value set by SetCurrentDirectory().
So we don't have to take care of "PWD", and should always use the value of
GetCurrentDirectory().
(Note that GetCurrentDirectory() is W32 API used by getcwd())

You can see the behavior by something like the following code.
--------------------------------------------------------------------------------
#include <windows.h>

int main(int argc, char **argv)
{
  char buf[_MAX_PATH];
  SetCurrentDirectory("c:\\PROGRA~1");
  GetCurrentDirectory(sizeof(buf), buf);
  printf ("GetCurrentDirectory1:%s\n", buf);
  SetCurrentDirectory("c:\\Program Files");
  GetCurrentDirectory(sizeof(buf), buf);
  printf ("GetCurrentDirectory2:%s\n", buf);
}
--------------------------------------------------------------------------------

> Also, are permissions problems ever an issue on Windows platforms?  In
> Unix and GNU/Linux, getcwd can fail because a parent directory is not
> readable, and that is an argument for preferring $PWD to getcwd.  Is
> such a getcwd failure possible in Windows?

If it is, we cannot invoke Emacs because CreateProcess() API would fail. ;-)

from himi

  reply	other threads:[~2002-04-24  7:45 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-21 20:15 init_buffer PWD fix Keiichiro Nagano
2002-04-21 23:00 ` Keiichiro Nagano
2002-04-22  6:18 ` Paul Eggert
2002-04-22  7:20   ` Keiichiro Nagano
2002-04-22 11:15     ` Eli Zaretskii
2002-04-22 21:16     ` Jason Rumney
2002-04-22  7:53   ` Eli Zaretskii
2002-04-22  7:01     ` Paul Eggert
2002-04-22  8:10       ` Eli Zaretskii
2002-04-22  7:22         ` Paul Eggert
2002-04-22 11:14           ` Eli Zaretskii
2002-04-22 23:21             ` Paul Eggert
2002-04-23  6:05               ` Eli Zaretskii
2002-04-22 21:21         ` Jason Rumney
2002-04-23  5:56           ` Eli Zaretskii
2002-04-23  6:14   ` MIYASHITA Hisashi
2002-04-23 11:00     ` Eli Zaretskii
2002-04-24 17:55       ` Richard Stallman
2002-04-24 18:14         ` MIYASHITA Hisashi
2002-04-23 17:45     ` Paul Eggert
2002-04-24  6:52       ` MIYASHITA Hisashi
2002-04-24  7:13         ` Paul Eggert
2002-04-24  7:45           ` MIYASHITA Hisashi [this message]
2002-04-24 11:12             ` Eli Zaretskii
2002-04-24 10:30               ` MIYASHITA Hisashi
2002-04-24 16:03                 ` Eli Zaretskii
2002-04-24 17:13                   ` MIYASHITA Hisashi
2002-04-24 18:10                     ` Eli Zaretskii
2002-04-24 18:25                       ` MIYASHITA Hisashi
2002-04-24 19:19                     ` Paul Eggert
2002-04-24 19:41                       ` MIYASHITA Hisashi
2002-04-24 19:59                         ` MIYASHITA Hisashi
2002-04-24 20:21                         ` Paul Eggert
2002-04-24 20:41                           ` MIYASHITA Hisashi
2002-04-24 21:01                             ` Paul Eggert
2002-04-24 21:23                               ` MIYASHITA Hisashi
2002-04-24 21:35                                 ` MIYASHITA Hisashi
2002-04-25 22:52                                 ` Stefan Monnier
2002-04-25  3:42                             ` Eli Zaretskii
2002-04-24 16:47                 ` Paul Eggert
2002-04-24 17:55                   ` MIYASHITA Hisashi
2002-04-24 10:38               ` MIYASHITA Hisashi
2002-04-24 16:08                 ` Eli Zaretskii
2002-04-24 16:10                 ` Eli Zaretskii
2002-04-24  7:55           ` MIYASHITA Hisashi
2002-04-24 11:07           ` Eli Zaretskii
2002-04-24 11:05         ` Eli Zaretskii
2002-04-24 10:31           ` MIYASHITA Hisashi
2002-04-24 16:05             ` Eli Zaretskii
2002-04-22  7:03 ` Eli Zaretskii
2002-04-22  6:49   ` Keiichiro Nagano
2002-04-22  8:01     ` Eli Zaretskii
2002-04-22  8:26       ` Keiichiro Nagano
2002-04-22 11:19         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u8z7dv8t4.fsf@MILCH.meadowy.org \
    --to=himi@meadowy.org \
    --cc=emacs-devel@gnu.org \
    --cc=knagano@sodan.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).