[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

[MD:1743]Meadow 1.13 Beta 1 (TANAHASHI:61) release.



>>>>> at 13 Apr 2000 17:33:23 +0900
>>>>> himi == Miyashita Hisashi(宮下 尚:HIMI) <himi@xxxxxxxxxxxxxxxxxxxxxxxxx> said,

himi> これはかなり致命的な問題なんで、さっさとpatchを作りました。
himi> 存在チェックだけでなく、directoryか否かのcheckも必要です。

時を同じくして私もパッチを作ってレポートを作成途中でしたが、
私の場合は check_writable() の方で行なうようにしました。
でもって、himi さんのpatchとは、ディレクトリ自体の writable が nil か t 
かの違いが生じます。 

以下テスト結果

-------------
For example, in following situation,
  * /temp        directory, rw permission
  * /temp/rwdir  directory, rw permission (have two files)
  * /temp/rodir  directory, ro permission (have two files)
  * /temp/rwdir/rw.c  file, rw permittion
  * /temp/rwdir/ro.c  file, ro permittion
  * /temp/rodir/rw.c  file, rw permittion
  * /temp/rodir/ro.c  file, ro permittion

These are test result of original Emacs 20.6 and patched one
on Windows 2000.

                                     original  gotoh  himi
(file-exists-p "/xxx")                 nil      nil    nil
(file-writable-p "/xxx/a.c")           t        nil    nil   <--
(file-writable-p "/temp/rwdir")        t	t      t
(file-writable-p "/temp/rodir")	       nil	t      nil   <--  ???
(file-writable-p "/temp/rwdir/rw.c")   t        t      t
(file-writable-p "/temp/rwdir/ro.c")   nil	nil    nil
(file-writable-p "/temp/rwdir/new.c")  t	t      t
(file-writable-p "/temp/rodir/rw.c")   t	t      t
(file-writable-p "/temp/rodir/ro.c")   nil	nil    nil
(file-writable-p "/temp/rodir/new.c")  t	t      t


<-- ??? の部分。これはどうあるべきでしょうかねぇ。


--- Regards,
 Shun-ichi Goto  <gotoh@xxxxxxxxxxx>
   R&D Group, TAIYO Corp., Tokyo, JAPAN


----- 
--- fileio.c.orig	Wed Feb 23 14:08:09 2000
+++ fileio.c	Thu Apr 13 08:15:40 2000
@@ -2798,6 +2798,18 @@
 #ifdef HAVE_EUIDACCESS
   return (euidaccess (filename, 2) >= 0);
 #else
+#ifdef WINDOWSNT
+  /* The read-only attribute of the parent directory doesn't affect
+     whether a file or directory can be created within it. So this
+     function `check_writable()' always return true if given FILENAME
+     is directory.  Some day we should check ACLs though, which do
+     affect this.  */
+  struct stat st;
+  if (stat (filename, &st) < 0)
+    return 0;
+  if ((st.st_mode & S_IFMT) == S_IFDIR)
+    return 1;
+#endif /* WINDOWSNT */
   /* Access isn't quite right because it uses the real uid
      and we really want to test with the effective uid.
      But Unix doesn't give us a right way to do it.
@@ -2929,12 +2941,6 @@
     return (check_writable (XSTRING (encoded)->data)
 	    ? Qt : Qnil);
 
-#ifdef WINDOWSNT
-  /* The read-only attribute of the parent directory doesn't affect
-     whether a file or directory can be created within it.  Some day we
-     should check ACLs though, which do affect this.  */
-  return Qt;
-#else
   dir = Ffile_name_directory (absname);
 #ifdef VMS
   if (!NILP (dir))
@@ -2948,7 +2954,6 @@
   dir = ENCODE_FILE (dir);
   return (check_writable (!NILP (dir) ? (char *) XSTRING (dir)->data : "")
 	  ? Qt : Qnil);
-#endif
 }
 
 DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0,