[PATCH] Byte compile the code s-expressions stored by defcustom
17 years
Aidan Kehoe
At the moment, defcustom forms are compiled with the value expression
uncompiled, which, given how much slower uncompiled code is in XEmacs, is a
loss for us if complex expressions are given, which is routine. This byte
compiles those expressions. It also byte compiles any #'-quoted or unquoted
lambdas in the arguments, which is something GNU does (but they don’t *do*
the former right now, though they are discussing it). Their bytecomp.el has,
beyond this, lots of functionality that it should be worth merging--nothing
huge, but helpful all the same.
lisp/ChangeLog addition:
2007-11-15 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-file-form-custom-declare-variable):
Byte compile the DEFAULT argument to custom-declare-variable, to
speed up complex expressions; also byte compile any lambda
expressions in the argument list.
XEmacs Trunk source patch:
Diff command: cvs -q diff -Nu
Files affected: lisp/bytecomp.el
===================================================================
RCS
Index: lisp/bytecomp.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/bytecomp.el,v
retrieving revision 1.20
diff -u -u -r1.20 bytecomp.el
--- lisp/bytecomp.el 2007/05/12 10:17:01 1.20
+++ lisp/bytecomp.el 2007/11/15 21:24:51
@@ -2376,13 +2376,33 @@
(put 'custom-declare-variable 'byte-hunk-handler
'byte-compile-file-form-custom-declare-variable)
(defun byte-compile-file-form-custom-declare-variable (form)
- (if (memq 'free-vars byte-compile-warnings)
- (setq byte-compile-bound-variables
- (cons (cons (nth 1 (nth 1 form))
- byte-compile-global-bit)
- byte-compile-bound-variables)))
- form)
-
+ ;; XEmacs change; our implementation byte compiles the default value code,
+ ;; which GNU's doesn't.
+ (let* ((quoted-default (car-safe (cdr-safe (cdr-safe form))))
+ (to-examine (car-safe (cdr-safe quoted-default))))
+ (if (memq 'free-vars byte-compile-warnings)
+ (setq byte-compile-bound-variables
+ (cons (cons (nth 1 (nth 1 form))
+ byte-compile-global-bit)
+ byte-compile-bound-variables)))
+ ;; Byte compile the default value, as we do for defvar.
+ (when (consp to-examine)
+ (setq form (copy-sequence form))
+ (setcdr (third form)
+ (list (byte-compile-top-level to-examine nil 'file))))
+ ;; Byte compile anything that smells like a lambda. I initially
+ ;; considered limiting it to the :initialize, :set and :get args, but
+ ;; that's not amazingly forward-compatible, and anyone expecting other
+ ;; things to be stored as data, not code, is unrealistic.
+ (loop
+ for entry in-ref (nthcdr 4 form)
+ do (cond ((and (eq 'function (car-safe entry))
+ (consp (car-safe (cdr-safe entry))))
+ (setf entry (copy-sequence entry))
+ (setcar (cdr entry) (byte-compile-lambda (car (cdr entry)))))
+ ((and (eq 'lambda (car-safe entry)))
+ (setf entry (byte-compile-lambda entry)))))
+ form))
;;;###autoload
(defun byte-compile (form)
--
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[COMMIT] Remove a useless let binding in byte-optimize-featurep
17 years
Aidan Kehoe
APPROVE COMMIT
NOTE: This patch has been committed.
lisp/ChangeLog addition:
2007-11-27 Aidan Kehoe <kehoea(a)parhasard.net>
* byte-optimize.el (byte-optimize-featurep):
Remove a useless let binding that was a hangover from an earlier
version of the code. Eliminates a byte-compile time warning.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: lisp/byte-optimize.el
===================================================================
RCS
Index: lisp/byte-optimize.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/byte-optimize.el,v
retrieving revision 1.13
diff -u -r1.13 byte-optimize.el
--- lisp/byte-optimize.el 2007/10/15 10:55:49 1.13
+++ lisp/byte-optimize.el 2007/11/27 15:28:58
@@ -1174,15 +1174,14 @@
(put 'featurep 'byte-optimizer 'byte-optimize-featurep)
(defun byte-optimize-featurep (form)
- (let ((to-check (cdr-safe form)))
- (if (memq (car-safe
- (cdr-safe
- (car-safe
- (cdr-safe
- form))))
- byte-optimize-ever-present-features)
- t
- form)))
+ (if (memq (car-safe
+ (cdr-safe
+ (car-safe
+ (cdr-safe
+ form))))
+ byte-optimize-ever-present-features)
+ t
+ form))
;;; enumerating those functions which need not be called if the returned
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[COMMIT] Merge a bugfix to some previously merged SXEmacs #'format code.
17 years
Aidan Kehoe
Thank you Hans!
APPROVE COMMIT
NOTE: This patch has been committed.
src/ChangeLog addition:
2007-11-26 Aidan Kehoe <kehoea(a)parhasard.net>
* doprnt.c:
Default to a buffer size of 350 for the sprintf call, but increase
it if the precision and minwidth indicate that it should be
bigger. Issue reported by Hans de Graaff; bug originally fixed by
Sebastian Freundt in SXEmacs following the change I merged on
2006-11-28. Forks have their disadvantages.
tests/ChangeLog addition:
2007-11-26 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/lisp-tests.el:
Check that a couple of previously problematic calls to #'format
succeed.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: tests/automated/lisp-tests.el
===================================================================
RCS src/doprnt.c
===================================================================
RCS
Index: src/doprnt.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/doprnt.c,v
retrieving revision 1.32
diff -u -r1.32 doprnt.c
--- src/doprnt.c 2006/11/28 16:09:47 1.32
+++ src/doprnt.c 2007/11/27 13:49:06
@@ -776,9 +776,21 @@
#endif /* HAVE_BIGFLOAT */
else
{
- Ascbyte *text_to_print = alloca_array (char, 350);
+ Ascbyte *text_to_print;
Ascbyte constructed_spec[100];
Ascbyte *p = constructed_spec;
+ int alloca_sz = 350;
+ int min = spec->minwidth, prec = spec->precision;
+
+ if (prec < 0)
+ prec = 0;
+ if (min < 0)
+ min = 0;
+
+ if (32+min+prec > alloca_sz)
+ alloca_sz = 32 + min + prec;
+
+ text_to_print = alloca_array(char, alloca_sz);
/* Mostly reconstruct the spec and use sprintf() to
format the string. */
Index: tests/automated/lisp-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/lisp-tests.el,v
retrieving revision 1.7
diff -u -r1.7 lisp-tests.el
--- tests/automated/lisp-tests.el 2004/05/13 15:33:18 1.7
+++ tests/automated/lisp-tests.el 2007/11/27 13:49:06
@@ -1279,6 +1279,10 @@
(Assert (= (read (format "%d" most-negative-fixnum)) most-negative-fixnum))
(Assert (= (read (format "%ld" most-negative-fixnum)) most-negative-fixnum))
+;; These used to crash.
+(Assert (eql (read (format "%f" 1.2e+302)) 1.2e+302))
+(Assert (eql (read (format "%.1000d" 1)) 1))
+
;;; "%u" is undocumented, and Emacs Lisp has no unsigned type.
;;; What to do if "%u" is used with a negative number?
;;; For non-bignum XEmacsen, the most reasonable thing seems to be to print an
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[C] xemacsweb: I can finally commit issue36 now that it is resolved
17 years
Adrian Aichner
COMMIT
xemacsweb ChangeLog patch:
Diff command: cvs -q diff -U 0
Files affected: About/ChangeLog
Index: About/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacsweb/About/ChangeLog,v
retrieving revision 1.218
diff -u -U0 -r1.218 ChangeLog
--- About/ChangeLog 6 Nov 2007 20:58:59 -0000 1.218
+++ About/ChangeLog 26 Nov 2007 19:00:20 -0000
@@ -0,0 +1,4 @@
+2007-11-26 Adrian Aichner <adrian(a)xemacs.org>
+
+ * XEmacsServices.content: Document and resolve issue 36.
+
xemacsweb source patch:
Diff command: cvs -f -z3 -q diff -u -w -N
Files affected: About/XEmacsServices.content
===================================================================
RCS
Index: About/XEmacsServices.content
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacsweb/About/XEmacsServices.content,v
retrieving revision 1.71
diff -u -w -r1.71 XEmacsServices.content
--- About/XEmacsServices.content 6 Nov 2007 20:59:00 -0000 1.71
+++ About/XEmacsServices.content 26 Nov 2007 18:56:51 -0000
@@ -87,9 +87,57 @@
;; See `sgml-comment-begin', `sgml-comment-end', and
;; http://htmlhelp.com/reference/wilbur/misc/comment.html
(format
- " <tr>\n %2$s Issue ID %3$s\n <td rowspan=\"7\" valign=\"top\"><a id=\"issue%1$d\" name=\"issue%1$d\">%1$d</a></td>\n %2$s Service(s) %3$s\n <td>all services of gwyn.tux.org are unavailable: DNS for xemacs.org, ssh, http, ftp</td>\n %2$s YYYY-MM-DD( HH:MM:SS UTC) Date found %3$s\n <td nowrap=\"nowrap\">YYYY-MM-DD( HH:MM:SS UTC)</td>\n %2$s YYYY-MM-DD( HH:MM:SS UTC) Date fixed %3$s\n <td nowrap=\"nowrap\">YYYY-MM-DD( HH:MM:SS UTC)</td>\n </tr>\n <tr>\n\t%2$s Error(s), Symptom(s) %3$s\n <th colspan=\"3\">Error(s), Symptom(s)</th>\n </tr>\n <tr>\n <td colspan=\"3\">\n\t <p>free-form description of a error or symptom.</p>\n <pre xml:space=\"preserve\">\nSending failed; SMTP protocol error\n221 Closing connection. Good bye.\n\t </pre>\n\t</td>\n </tr>\n <tr>\n\t%2$s Resolution(s) %3$s\n <th colspan=\"3\">Resolution(s)</th>\n </tr>\n <tr>\n !
<td colspan=\"3\">\n\t <p>Description of resolution.</p>\n\t</td>\n </tr>\n <tr>\n\t%2$s Reference(s) %3$s\n <th colspan=\"3\">References</th>\n </tr>\n <tr>\n <td colspan=\"3\">\n\t <p>References to other information, like URLs for external issue documenation.</p>\n\t</td>\n </tr>\n\n"
+ " <tr>\n %2$s Issue ID %3$s\n <td rowspan=\"7\" valign=\"top\"><a id=\"issue%1$d\" name=\"issue%1$d\">%1$d</a></td>\n %2$s Service(s) %3$s\n <td>all services of gwyn.tux.org are unavailable: DNS for xemacs.org, ssh, http, ftp</td>\n %2$s YYYY-MM-DD( HH:MM:SS UTC) Date found %3$s\n <td nowrap=\"nowrap\">YYYY-MM-DD( HH:MM:SS UTC)</td>\n %2$s YYYY-MM-DD( HH:MM:SS UTC) Date fixed %3$s\n <td nowrap=\"nowrap\">YYYY-MM-DD( HH:MM:SS UTC)</td>\n </tr>\n <tr>\n\t%2$s Error(s), Symptom(s) %3$s\n <th colspan=\"3\">Error(s), Symptom(s)</th>\n </tr>\n <tr>\n <td colspan=\"3\">\n\t <p>free-form description of a error or symptom.</p>\n <pre xml:space=\"preserve\">\nSending failed; SMTP protocol error\n221 Closing connection. Good bye.\n\t </pre>\n\t</td>\n </tr>\n <tr>\n\t%2$s Resolution(s) %3$s\n <th colspan=\"3\">Resolution(s)</th>\n </tr>\n <tr>\n !
<td colspan=\"3\">\n\t <p>Description of resolution.</p>\n\t</td>\n </tr>\n <tr>\n\t%2$s Reference(s) %3$s\n <th colspan=\"3\">References</th>\n </tr>\n <tr>\n <td colspan=\"3\">\n\t <p>References to other information, like URLs for external issue documentation.</p>\n\t</td>\n </tr>\n\n"
next-issue-number sgml-comment-begin sgml-comment-end))))
-->
+
+ <tr>
+ <!-- Issue ID -->
+ <td rowspan="7" valign="top"><a id="issue36" name="issue36">36</a></td>
+ <!-- Service(s) -->
+ <td>ssh</td>
+ <!-- YYYY-MM-DD( HH:MM:SS UTC) Date found -->
+ <td nowrap="nowrap">2007-11-24</td>
+ <!-- YYYY-MM-DD( HH:MM:SS UTC) Date fixed -->
+ <td nowrap="nowrap">2007-11-26</td>
+ </tr>
+ <tr>
+ <!-- Error(s), Symptom(s) -->
+ <th colspan="3">Error(s), Symptom(s)</th>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <p>ssh is not functional on cvs.xemacs.org.
+ Consequencially, cvs operations involving access via ssh do
+ not work. CVS read-only access via pserver is
+ operational.</p>
+ <pre xml:space="preserve">
+Connection to cvs.xemacs.org closed by remote host.
+cvs [update aborted]: end of file from server (consult above messages if any)
+ </pre>
+ <pre xml:space="preserve">
+ssh: connect to host dotsrc.org port 22: Connection timed out
+ </pre>
+ </td>
+ </tr>
+ <tr>
+ <!-- Resolution(s) -->
+ <th colspan="3">Resolution(s)</th>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <p></p>
+ </td>
+ </tr>
+ <tr>
+ <!-- Reference(s) -->
+ <th colspan="3">References</th>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <p>The problem has been reported to dotsrc.org.</p>
+ </td>
+ </tr>
<tr>
<!-- Issue ID -->
--
Adrian Aichner
mailto:adrian@xemacs.org
http://www.xemacs.org/
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[AC21.5] Updating my 21.5 bio info
17 years, 1 month
Vin Shelton
Updating by 21.5 bio.
- Vin
ChangeLog addition:
2007-11-22 Vin Shelton <acs(a)xemacs.org>
* etc/photos/vin.png:
* etc/photos/vinm.png: Updated.
lisp/ChangeLog addition:
2007-11-22 Vin Shelton <acs(a)xemacs.org>
* about.el (about-hacker-contribution): Updated my bio.
- Vin
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[AC21.4] Update my biographical info
17 years, 1 month
Vin Shelton
I'm updating my bio in 21.4 with 21.5 soon to follow.
- Vin
ChangeLog addition:
2007-11-22 Vin Shelton <acs(a)xemacs.org>
* etc/photos/vin.png:
* etc/photos/vinm.png: Updated.
lisp/ChangeLog addition:
2007-11-22 Vin Shelton <acs(a)xemacs.org>
* about.el (about-hacker-contribution): Updated my bio.
- Vin
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
Re: [COMMIT] Import make-temp-name (the functionality of mkstemp(3)) from GNU
17 years, 1 month
Aidan Kehoe
Ar an séú lá déag de mí na Samhain, scríobh Stephen J. Turnbull:
> Aidan Kehoe writes:
>
> > > Wouldn't it be better to keep the CODING-SYSTEM name and simply document
> > > the additional semantics? I don't think we should encourage use of this
> > > misfeature in application code.
> >
> > There's no other way, beyond using write-region-internal--not portable to
> > GNU--to access this functionality--avoiding the race condition between
> > checking for a file's existence and creating it. It's ugly, but it is a
> > positive feature.
>
> I'm not suggesting otherwise. I'm just suggesting keeping the *name*
> CODING-SYSTEM.
That’s reasonable enough, and your docstring does that.
> > I'm not sure you're clear on the point of the MUSTBENEW argument. To make
> > the check-for-an-existing-file-if-it-doesn't-exist-create-it operation
> > atomic¹--which it needs to be to avoid security issues for temporary
> > files--it needs to be done in the OS kernel. Which means a subr is needed to
> > expose it to Lisp.
>
> That could be taken as an argument for implementing make-temp-file in
> C. I would prefer that to overengineering `write-region*'. Are there
> security implications for other than make-temp-file,
No.
> and does anybody actually use this feature on non-temp files?
The existing checks in the rest of the emacs code offer the same
functionality, they just don’t offer the atomic guarantee of the O_CREAT |
O_EXCL combination.
> > > BTW, do you insist on 'excl (eg, for gagmacs compatibility)?
> >
> > Yes.
>
> Excuse me while I retch, then.
>
> > I read that to mean that O_EXCL does have function when O_CREAT isn't set,
> > but I admittedly haven't written any code to test that understanding.
>
> I think we'd better, since this is an area with security implications.
>
> My understanding FWIW is that the passage you quoted simply documents
> a possibly astonishing corner case, where there is a dangling symlink.
Yes, from my tests and from looking at vfs_vnops.c, that seems correct.
> Without O_EXCL, the symlink will be followed and the target file
> created if it doesn't exist. With O_EXCL, open(2) notices a directory
> entry, and errors rather than creating the file. The man page also says
>
> O_EXCL error if create and file exists
>
> and
>
> [EEXIST] O_CREAT and O_EXCL were specified and the file exists.
>
> In other words, there is no documented functionality without O_CREAT.
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpo de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
[PATCH] Call #'find-coding-system as appropriate in #'write-region.
17 years, 1 month
Aidan Kehoe
Ar an cúigiú lá déag de mí na Samhain, scríobh Vin Shelton:
> Thank you for that fix. It fixed my -debug and non-mule builds, but
> my -mule build is still failing (sorry I didn't mention previously
> that all 3 of my builds were failing). Here's the relevant info from
> the build failure here at work:
Thanks for the report. Does this fix the issue for you? I wasn’t seeing the
problem locally when developing because the ELC files were not rebuilt every
time; you need to have a fresh checkout to provoke the problem.
lisp/ChangeLog addition:
2007-11-15 Aidan Kehoe <kehoea(a)parhasard.net>
* code-files.el (write-region):
Call #'find-coding-system on the (possible) coding system argument
before checking it with #'coding-system-p; the latter function
gives false results when passed coding system names as symbols.
Preserve the old order of determination of the coding system
better.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: lisp/code-files.el
===================================================================
RCS
Index: lisp/code-files.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/code-files.el,v
retrieving revision 1.23
diff -u -r1.23 code-files.el
--- lisp/code-files.el 2007/11/14 18:51:31 1.23
+++ lisp/code-files.el 2007/11/15 14:32:36
@@ -559,14 +559,19 @@
'write-region-pre-hook
start end filename append visit lockname
coding-system-or-mustbenew)
- coding-system
+ (if (and coding-system-or-mustbenew
+ (coding-system-p
+ (find-coding-system coding-system-or-mustbenew)))
+ coding-system-or-mustbenew)
buffer-file-coding-system
(find-file-coding-system-for-write-from-filename filename)))
(if (consp hook-result)
;; One of the `write-region-pre-hook' functions wrote the file.
hook-result
;; The hooks didn't do the work; do it ourselves.
- (setq mustbenew (unless (coding-system-p coding-system-or-mustbenew)
+ (setq hook-result (find-coding-system hook-result)
+ mustbenew (unless (coding-system-p
+ (find-coding-system coding-system-or-mustbenew))
coding-system-or-mustbenew)
coding-system (cond ((coding-system-p hook-result) hook-result)
((null mustbenew) coding-system-or-mustbenew))
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpo de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
Re: [COMMIT] Import make-temp-name (the functionality of mkstemp(3)) from GNU
17 years, 1 month
Aidan Kehoe
Ar an cúigiú lá déag de mí na Samhain, scríobh Stephen J. Turnbull:
> QUERY
>
> AFAICS your implementation is basically buggy. Some suggestions for
> alternative implementation below.
>
> Aidan Kehoe writes:
> >
> > Yes, the CODING-SYSTEM-OR-MUSTBENEW argument is ugly. No, I don't see a
> > better approach to this which would be compatible with GNU, given that our
> > CODING-SYSTEM argument was already in 21.4.
>
> Where is this argument used with MUSTBENEW semantics?
http://google.com/codesearch?hl=de&lr=&q=file%3A%5C.el+%27excl%5B%5Ea-z%5...
apel/poe.el
gnus/mm-util.el
gnus/nnmaildir.el
ediff-util.el
And in make-temp-file, the function I just merged.
> Wouldn't it be better to keep the CODING-SYSTEM name and simply document
> the additional semantics? I don't think we should encourage use of this
> misfeature in application code.
There’s no other way, beyond using write-region-internal--not portable to
GNU--to access this functionality--avoiding the race condition between
checking for a file’s existence and creating it. It’s ugly, but it is a
positive feature.
> > * code-files.el (write-region):
> > Provide a new arg, CODING-SYSTEM-OR-MUSTBENEW, for compatibility
> > both with GNU (where it has the MUSTBENEW meaning) and earlier
> > XEmacs code (where it has the CODING-SYSTEM meaning).
>
> For the sake of review, please be accurate. This argument is not new,
> it's just been given additional semantics.
OK.
> > * fileio.c (Fwrite_region_internal):
> > Take a new arg, MUSTBENEW, to error if the file to be written
> > already exists.
>
> *gag* It's just wrong to do this at that level. Isn't there some way to
> avoid this? That function is already way overcomplicated.
I’m not sure you’re clear on the point of the MUSTBENEW argument. To make
the check-for-an-existing-file-if-it-doesn’t-exist-create-it operation
atomic¹--which it needs to be to avoid security issues for temporary
files--it needs to be done in the OS kernel. Which means a subr is needed to
expose it to Lisp. Which means it needs to be done at this level.
> As long as we're here ...
>
> > Kludgy feature:
>
> Wouldn't it be less work to mark the *clean* features of this monster?
> :-( How about something like [...]
Yeah, that’s a much nicer docstring.
> BTW, do you insist on 'excl (eg, for gagmacs compatibility)?
Yes.
> Really I'd like to see t instead of 'excl, and restrict to 'ask for the
> query confirmation.
I agree that would be a better interface. It’s unhelpfully incompatible,
though.
> > Index: src/fileio.c
> > ===================================================================
>
> > + if (!NILP (mustbenew) && !EQ (mustbenew, Qexcl))
> > + barf_or_query_if_file_exists (filename, "overwrite", 1, NULL);
>
> Isn't it cleaner to do
>
> if (!NILP (mustbenew))
> barf_or_query_if_file_exists (filename, "overwrite",
> EQ (mustbenew, Qexcl) ? 0 : 1, NULL);
That would be a little friendlier for most people most of the time, yes. I
copied the logic from GNU, though, so I didn’t write it like that.
> > @@ -3433,12 +3448,14 @@
> > desc = -1;
> > if (!NILP (append))
> > {
> > - desc = qxe_open (XSTRING_DATA (fn), O_WRONLY | OPEN_BINARY, 0);
> > + desc = qxe_open (XSTRING_DATA (fn), O_WRONLY | OPEN_BINARY
> > + | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), 0);
>
> Note that on Mac OS X, at least, O_EXCL is documented to have no
> effect unless O_CREAT is also specified. Even if this does work on
> some systems, the user will get a less specific `file-error' rather
> than `file-already-exists'.
FreeBSD: ‘If O_EXCL is set with O_CREAT and the file already exists, open()
returns an error. This may be used to implement a simple exclusive access
locking mechanism. If O_EXCL is set and the last component of the pathname
is a symbolic link, open() will fail even if the symbolic link points to a
non-existent name.’
I read that to mean that O_EXCL does have function when O_CREAT isn’t set,
but I admittedly haven’t written any code to test that understanding.
¹ In the sense that it cannot be interrupted by other processes and resumed.
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpo de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches