[PATCH21.4] Fix windows support for readonly files
17 years, 9 months
Vin Shelton
I think this patch (against 21.4 in CVS) fixes the problems identified:
1) I can once again edit a non-existent file in a write-protected directory
2) XEmacs respects the readonly bit
3) the infloop on "xemacs -vanilla nonexistent_file" problem has gone away.
Please review. I will commit if no one objects.
- Vin
Index: src/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.290.2.117
diff -a -u -r1.290.2.117 ChangeLog
--- src/ChangeLog 2007/01/02 01:32:40 1.290.2.117
+++ src/ChangeLog 2007/01/04 22:34:51
@@ -1,3 +1,8 @@
+2007-01-04 Vin Shelton <acs(a)xemacs.org>
+
+ * fileio.c (check_writable): Check old-style readonly bit only for
+ non-directories.
+
2006-12-25 Benson I. Margulies <benson(a)dchbk.us>
* src/fileio.c (check_writable):
Index: src/fileio.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
retrieving revision 1.66.2.9
diff -a -u -r1.66.2.9 fileio.c
--- src/fileio.c 2007/01/02 01:32:45 1.66.2.9
+++ src/fileio.c 2007/01/04 22:34:52
@@ -2307,17 +2307,18 @@
filename = filename_buffer;
#endif
- // ask simple question first
+ // First check for a normal file with the old-style readonly bit
attributes = GetFileAttributes(filename);
- if (0 != (attributes & FILE_ATTRIBUTE_READONLY))
- return 0;
+ if (FILE_ATTRIBUTE_READONLY == (attributes &
(FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_READONLY)))
+ return 0;
/* Win32 prototype lacks const. */
error = GetNamedSecurityInfo((LPTSTR)filename, SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION,
&psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc);
if (error != ERROR_SUCCESS) { // FAT?
- return 1;
+ attributes = GetFileAttributes(filename);
+ return (attributes & FILE_ATTRIBUTE_DIRECTORY) || (0 ==
(attributes & FILE_ATTRIBUTE_READONLY));
}
genericMapping.GenericRead = FILE_GENERIC_READ;
--
The Journey by Mary Oliver
http://www.poemhunter.com/p/m/poem.asp?poet=6771&poem=30506
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
Re: [AC21.4] Fix handling of the read-only attribute bit - Oops!
17 years, 9 months
Vin Shelton
Oops - this patch:
On 1/1/07, Vin Shelton <acs(a)xemacs.org> wrote:
> APPROVE COMMIT 21.4.
>
> Thanks for the patch, Benson. I've applied it to the 21.4 branch; it
> will appear in XEmacs 21.4.21.
>
> (The patch as originally posted was malformed - I've included it here
> for reference.)
>
> Index: src/ChangeLog
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
> retrieving revision 1.290.2.116
> diff -a -u -u -0 -r1.290.2.116 ChangeLog
> --- src/ChangeLog 2006/12/10 00:14:52 1.290.2.116
> +++ src/ChangeLog 2007/01/02 00:16:10
> @@ -0,0 +1,7 @@
> +2006-12-25 Benson I. Margulies <benson(a)dchbk.us>
> +
> + * src/fileio.c (check_writable):
> + Cope with the fact that the read-only attribute trumps Windows NTFS
> + ACLS.
> +
> +
> Index: src/fileio.c
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
> retrieving revision 1.66.2.8
> diff -a -u -r1.66.2.8 fileio.c
> --- src/fileio.c 2006/11/20 18:20:22 1.66.2.8
> +++ src/fileio.c 2007/01/02 00:16:19
> @@ -2307,13 +2307,17 @@
> filename = filename_buffer;
> #endif
>
> + // ask simple question first
> + attributes = GetFileAttributes(filename);
> + if (0 != (attributes & FILE_ATTRIBUTE_READONLY))
> + return 0;
> +
> /* Win32 prototype lacks const. */
> error = GetNamedSecurityInfo((LPTSTR)filename, SE_FILE_OBJECT,
> DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION,
> &psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc);
> if (error != ERROR_SUCCESS) { // FAT?
> - attributes = GetFileAttributes(filename);
> - return (attributes & FILE_ATTRIBUTE_DIRECTORY) || (0 == (attributes & FILE_ATTRIBUTE_READONLY));
> + return 1;
> }
>
> genericMapping.GenericRead = FILE_GENERIC_READ;
>
actually makes things worse on my system. Here's what I see:
$ ls -ld Documents Documents/foo
ls: cannot access Documents/foo: No such file or directory
dr-xr-xr-x+ 22 vshelton Domain Users 0 Jan 3 09:01 Documents
$ xemacs Documents/foo
yields the late unlamented "File not found and directory
write-protected" message. (I observed this behavior under cygwin, but
the native windows build exhibits the same behavior.)
Benson, is it possible I screwed up the patch? Can you please investigate?
Even worse: "xemacs -vanilla Documents/foo" puts xemacs into an
interruptible loop attempting to update the display. I will examine
this case further.
Thanks,
Vin
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[PATCH] Fix handling of the read-only attribute bit
17 years, 9 months
Benson Margulies
src/ChangeLog addition:
2006-12-25 Benson I. Margulies <benson(a)dchbk.us>
* src/fileio.c (check_writable):
Cope with the fact that the read-only attribute trumps Windows NTFS
ACLS.
XEmacs21-4 source patch:
Diff command: cvs -q diff -u
Files affected: src/fileio.c
===================================================================
RCS
cvs server: nt/xemacs.sln is a new entry, no comparison available
cvs server: nt/xemacs.vcproj is a new entry, no comparison available
Index: src/fileio.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
retrieving revision 1.66.2.8
diff -u -r1.66.2.8 fileio.c
--- src/fileio.c 2006/11/20 18:20:22 1.66.2.8
+++ src/fileio.c 2006/12/25 14:21:36
@@ -2307,13 +2307,18 @@
filename = filename_buffer;
#endif
+ // ask simple question first
+ attributes = GetFileAttributes(filename);
+ if (0 != (attributes & FILE_ATTRIBUTE_READONLY))
+ return 0;
+
+
/* Win32 prototype lacks const. */
error = GetNamedSecurityInfo((LPTSTR)filename, SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION,
&psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc);
if (error != ERROR_SUCCESS) { // FAT?
- attributes = GetFileAttributes(filename);
- return (attributes & FILE_ATTRIBUTE_DIRECTORY) || (0 == (attributes & FILE_ATTRIBUTE_READONLY));
+ return 1;
}
genericMapping.GenericRead = FILE_GENERIC_READ;
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[ACS] [PATCH] egrep => grep -E
17 years, 9 months
Malcolm Purvis
APPROVE COMMIT SUPERSEDES m23b9jglsl.fsf(a)silver.local
Back in October Stephen suggested that we follow Emacs' new practice of
'grep -E' rather then egrep:
http://calypso.tux.org/pipermail/xemacs-beta/2006-October/009766.html
I posted a patch to do this, but for one reason or another it wasn't applied:
http://calypso.tux.org/pipermail/xemacs-patches/2006-October/000010.html
This is a slightly revised version of that patch. The only change is the use
of $EGREP rather than 'grep -E' in aclocal.m4, so that we can rely on
configure to work out if grep does what we want.
This patch has been committed.
Malcolm
ChangeLog addition:
2007-01-01 Malcolm Purvis <malcolmp(a)xemacs.org>
* aclocal.m4 (XE_SHLIB_STUFF): Use 'grep -E' instead of egrep.
man/ChangeLog addition:
2007-01-01 Malcolm Purvis <malcolmp(a)xemacs.org>
* internals/internals.texi (Ben's README): Use 'grep -F' instead
of fgrep.
xemacs-egrep source patch:
Diff command: cvs -q diff -u
Files affected: man/internals/internals.texi
===================================================================
RCS man/ChangeLog
===================================================================
RCS configure
===================================================================
RCS aclocal.m4
===================================================================
RCS ChangeLog
===================================================================
RCS
Index: aclocal.m4
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/aclocal.m4,v
retrieving revision 1.13
diff -u -r1.13 aclocal.m4
--- aclocal.m4 2006/03/28 15:55:49 1.13
+++ aclocal.m4 2007/01/01 08:28:45
@@ -355,7 +355,7 @@
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
- if "$LTLD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ if "$LTLD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' > /dev/null; then
xe_gnu_ld=yes
else
xe_gnu_ld=no
@@ -385,7 +385,7 @@
# Check to see if it really is or isn't GNU ld.
AC_MSG_CHECKING([if the linker is GNU ld])
# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LTLD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+if $LTLD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
xe_gnu_ld=yes
else
xe_gnu_ld=no
@@ -425,7 +425,7 @@
can_build_shared=yes
if test "$xe_gnu_ld" = yes && test "$gnu_ld_acts_native" != yes; then
# See if GNU ld supports shared libraries.
- if $LTLD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ if $LTLD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null; then
dll_ld=$CC
dll_ldflags="-shared"
ld_shlibs=yes
Index: man/internals/internals.texi
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/man/internals/internals.texi,v
retrieving revision 1.77
diff -u -r1.77 internals.texi
--- man/internals/internals.texi 2006/11/17 02:50:32 1.77
+++ man/internals/internals.texi 2007/01/01 08:30:23
@@ -16610,7 +16610,7 @@
the function names.) Use something like
@example
-fgrep -f ../nmkun.txt -w [a-hj-z]*.[ch] |m
+grep -F -f ../nmkun.txt -w [a-hj-z]*.[ch] |m
@end example
in the source directory, which does a word match and skips
--
Malcolm Purvis <malcolmp(a)xemacs.org>
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[PATCH] correct description of HOMEPATH usage
17 years, 9 months
Robert Pluim
man/ChangeLog addition:
2006-11-07 Robert Pluim <rpluim(a)gmail.com>
* lispref/os.texi (User Identification): The code uses HOMEPATH,
not HOMEDIR.
XEmacs source patch:
Diff command: cvs -q diff -u
Files affected: man/lispref/os.texi
Index: man/lispref/os.texi
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/man/lispref/os.texi,v
retrieving revision 1.6
diff -u -u -r1.6 os.texi
--- man/lispref/os.texi 2001/04/12 18:22:18 1.6
+++ man/lispref/os.texi 2006/11/03 07:50:55
@@ -866,10 +866,10 @@
Return the value of ``@code{(getenv "HOME")}'', if set.
@item
-If the environment variables @code{HOMEDRIVE} and @code{HOMEDIR} are
+If the environment variables @code{HOMEDRIVE} and @code{HOMEPATH} are
both set, return the concatenation (the following description uses MS
Windows environment variable substitution syntax):
-@code{%HOMEDRIVE%%HOMEDIR%}.
+@code{%HOMEDRIVE%%HOMEPATH%}.
@item
Return ``C:\'', as a fallback, but issue a warning.
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches