Now on revision 111569. ------------------------------------------------------------ revno: 111569 committer: Glenn Morris branch nick: trunk timestamp: Sat 2013-01-19 18:40:49 -0800 message: * lisp-mode.el (emacs-lisp-mode-map): Add native profiler menu entries. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-01-20 02:39:59 +0000 +++ lisp/ChangeLog 2013-01-20 02:40:49 +0000 @@ -1,5 +1,8 @@ 2013-01-20 Glenn Morris + * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map): + Add native profiler menu entries. + * profiler.el (profiler-running-p): New function. (profiler-cpu-profile): Use profiler-running-p. (profiler-report-mode-map): Add some more menu entries. === modified file 'lisp/emacs-lisp/lisp-mode.el' --- lisp/emacs-lisp/lisp-mode.el 2013-01-19 20:38:13 +0000 +++ lisp/emacs-lisp/lisp-mode.el 2013-01-20 02:40:49 +0000 @@ -335,6 +335,22 @@ (bindings--define-key prof-map [prof-func] '(menu-item "Instrument Function..." elp-instrument-function :help "Instrument a function for profiling")) + ;; Maybe this should be in a separate submenu from the ELP stuff? + (bindings--define-key prof-map [sep-natprof] menu-bar-separator) + (bindings--define-key prof-map [prof-natprof-stop] + '(menu-item "Stop Native Profiler" profiler-stop + :help "Stop recording profiling information" + :enable (and (featurep 'profiler) + (profiler-running-p)))) + (bindings--define-key prof-map [prof-natprof-report] + '(menu-item "Show Profiler Report" profiler-report + :help "Show the current profiler report" + :enable (and (featurep 'profiler) + (profiler-running-p)))) + (bindings--define-key prof-map [prof-natprof-start] + '(menu-item "Start Native Profiler..." profiler-start + :help "Start recording profiling information")) + (bindings--define-key menu-map [lint] (cons "Linting" lint-map)) (bindings--define-key lint-map [lint-di] '(menu-item "Lint Directory..." elint-directory ------------------------------------------------------------ revno: 111568 committer: Glenn Morris branch nick: trunk timestamp: Sat 2013-01-19 18:39:59 -0800 message: profiler.el tweaks * profiler.el (profiler-running-p): New function. (profiler-cpu-profile): Use profiler-running-p. (profiler-report-mode-map): Add some more menu entries. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-01-19 20:54:56 +0000 +++ lisp/ChangeLog 2013-01-20 02:39:59 +0000 @@ -1,3 +1,9 @@ +2013-01-20 Glenn Morris + + * profiler.el (profiler-running-p): New function. + (profiler-cpu-profile): Use profiler-running-p. + (profiler-report-mode-map): Add some more menu entries. + 2013-01-19 Glenn Morris * mail/unrmail.el (unrmail): Do not mangle the mbox From line; === modified file 'lisp/profiler.el' --- lisp/profiler.el 2013-01-02 16:13:04 +0000 +++ lisp/profiler.el 2013-01-20 02:39:59 +0000 @@ -200,11 +200,18 @@ (goto-char (point-min)) (read (current-buffer)))) +(defun profiler-running-p (&optional mode) + "Return non-nil if the profiler is running. +Optional argument MODE means only check for the specified mode (cpu or mem)." + (cond ((eq mode 'cpu) (and (fboundp 'profiler-cpu-running-p) + (profiler-cpu-running-p))) + ((eq mode 'mem) (profiler-memory-running-p)) + (t (or (profiler-running-p 'cpu) + (profiler-running-p 'mem))))) + (defun profiler-cpu-profile () "Return CPU profile." - (when (and (fboundp 'profiler-cpu-running-p) - (fboundp 'profiler-cpu-log) - (profiler-cpu-running-p)) + (when (profiler-running-p 'cpu) (profiler-make-profile :type 'cpu :timestamp (current-time) @@ -457,7 +464,12 @@ ["Compare Profile..." profiler-report-compare-profile :active t :help "Compare current profile with another"] ["Write Profile..." profiler-report-write-profile :active t - :help "Write current profile to a file"])) + :help "Write current profile to a file"] + "--" + ["Stop Profiler" profiler-stop :active (profiler-running-p) + :help "Stop profiling"] + ["New Report" profiler-report :active (profiler-running-p) + :help "Make a new report"])) map) "Keymap for `profiler-report-mode'.") ------------------------------------------------------------ revno: 111567 fixes bug: http://debbugs.gnu.org/13445 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-01-19 14:48:47 -0800 message: Improve addr2line suggestion. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-01-19 22:12:27 +0000 +++ doc/emacs/ChangeLog 2013-01-19 22:48:47 +0000 @@ -1,9 +1,10 @@ 2013-01-19 Paul Eggert - * trouble.texi (Crashing): Suggest -p for recent addrline. (Bug#13445) - Without it, I don't see function names. Older addrlines will die - out sooner or later, so tailor the suggestion to recent addrline - and put in a comment about older ones. + * trouble.texi (Crashing): Suggest -p for newer addr2line. (Bug#13445) + Without it, I don't see function names. Older addr2line + implementations will die out sooner or later, so tailor the + first suggestion to recent addr2line, with a followup about + older ones. 2013-01-19 Glenn Morris === modified file 'doc/emacs/trouble.texi' --- doc/emacs/trouble.texi 2013-01-19 22:15:03 +0000 +++ doc/emacs/trouble.texi 2013-01-19 22:48:47 +0000 @@ -326,7 +326,6 @@ @example sed -n 's/.*\[\(.*\)]$/\1/p' @var{backtrace} | addr2line -C -f -i -p -e @var{bindir}/@var{emacs-binary} -# Omit '-p' for binutils 2.20 and earlier. @end example @noindent @@ -334,9 +333,9 @@ the backtrace, @var{bindir} is the name of the directory that contains the Emacs executable, and @var{emacs-binary} is the name of the Emacs executable file, normally @file{emacs} on GNU and Unix -systems and @file{emacs.exe} on MS-Windows and MS-DOS.@footnote{You -may wish to add the @option{-p} option, if your version of -@command{addr2line} supports it.} +systems and @file{emacs.exe} on MS-Windows and MS-DOS. Omit the +@option{-p} option if your version of @command{addr2line} is too old +to have it. @cindex core dump Optionally, Emacs can generate a @dfn{core dump} when it crashes, on ------------------------------------------------------------ revno: 111566 fixes bug: http://debbugs.gnu.org/13419 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-01-19 14:33:29 -0800 message: * lisp.h (eabs): Define unconditionally. The old "#if !defined (eabs)" was an unnecessary revenant of back when this macro was called "abs". Document 'eabs' better. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-01-19 20:38:13 +0000 +++ src/ChangeLog 2013-01-19 22:33:29 +0000 @@ -1,3 +1,9 @@ +2013-01-19 Paul Eggert + + * lisp.h (eabs): Define unconditionally (Bug#13419). + The old "#if !defined (eabs)" was an unnecessary revenant of back + when this macro was called "abs". Document 'eabs' better. + 2013-01-19 Glenn Morris * fns.c (Frandom): Doc fix. === modified file 'src/lisp.h' --- src/lisp.h 2013-01-19 04:44:34 +0000 +++ src/lisp.h 2013-01-19 22:33:29 +0000 @@ -3711,12 +3711,11 @@ /* Set up the name of the machine we're running on. */ extern void init_system_name (void); -/* We used to use `abs', but that clashes with system headers on some - platforms, and using a name reserved by Standard C is a bad idea - anyway. */ -#if !defined (eabs) +/* Return the absolute value of X. X should be a signed integer + expression without side effects, and X's absolute value should not + exceed the maximum for its promoted type. This is called 'eabs' + because 'abs' is reserved by the C standard. */ #define eabs(x) ((x) < 0 ? -(x) : (x)) -#endif /* Return a fixnum or float, depending on whether VAL fits in a Lisp fixnum. */ ------------------------------------------------------------ revno: 111565 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-01-19 14:15:03 -0800 message: Fix typo: addrline -> binutils. diff: === modified file 'doc/emacs/trouble.texi' --- doc/emacs/trouble.texi 2013-01-19 22:12:27 +0000 +++ doc/emacs/trouble.texi 2013-01-19 22:15:03 +0000 @@ -326,7 +326,7 @@ @example sed -n 's/.*\[\(.*\)]$/\1/p' @var{backtrace} | addr2line -C -f -i -p -e @var{bindir}/@var{emacs-binary} -# Omit '-p' for addrline 2.20 and earlier. +# Omit '-p' for binutils 2.20 and earlier. @end example @noindent ------------------------------------------------------------ revno: 111564 fixes bug: http://debbugs.gnu.org/13445 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-01-19 14:12:27 -0800 message: * trouble.texi (Crashing): Suggest -p for recent addrline. Without it, I don't see function names. Older addrlines will die out sooner or later, so tailor the suggestion to recent addrline and put in a comment about older ones. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-01-19 20:38:13 +0000 +++ doc/emacs/ChangeLog 2013-01-19 22:12:27 +0000 @@ -1,3 +1,10 @@ +2013-01-19 Paul Eggert + + * trouble.texi (Crashing): Suggest -p for recent addrline. (Bug#13445) + Without it, I don't see function names. Older addrlines will die + out sooner or later, so tailor the suggestion to recent addrline + and put in a comment about older ones. + 2013-01-19 Glenn Morris * custom.texi (Directory Variables): Fix paren typo. === modified file 'doc/emacs/trouble.texi' --- doc/emacs/trouble.texi 2013-01-19 20:38:13 +0000 +++ doc/emacs/trouble.texi 2013-01-19 22:12:27 +0000 @@ -325,7 +325,8 @@ @example sed -n 's/.*\[\(.*\)]$/\1/p' @var{backtrace} | - addr2line -C -f -i -e @var{bindir}/@var{emacs-binary} + addr2line -C -f -i -p -e @var{bindir}/@var{emacs-binary} +# Omit '-p' for addrline 2.20 and earlier. @end example @noindent ------------------------------------------------------------ revno: 111563 committer: Glenn Morris branch nick: trunk timestamp: Sat 2013-01-19 12:58:00 -0800 message: Tweak previous change diff: === modified file 'lisp/mail/unrmail.el' --- lisp/mail/unrmail.el 2013-01-19 20:54:56 +0000 +++ lisp/mail/unrmail.el 2013-01-19 20:58:00 +0000 @@ -240,8 +240,6 @@ (insert "X-RMAIL-ATTRIBUTES: " (apply 'string attrs) "\n") (when keywords (insert "X-RMAIL-KEYWORDS: " keywords "\n")) - (goto-char (point-min)) - (forward-line 1) ; skip `From ' line ;; Convert From to >From, etc. (let ((case-fold-search nil) (fromline (if (eq 'mboxrd unrmail-mbox-format) ------------------------------------------------------------ revno: 111562 fixes bug: http://debbugs.gnu.org/13499 committer: Glenn Morris branch nick: trunk timestamp: Sat 2013-01-19 12:54:56 -0800 message: * lisp/mail/unrmail.el (unrmail): Do not mangle the mbox From line fixes 2012-12-07 change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-01-19 20:38:13 +0000 +++ lisp/ChangeLog 2013-01-19 20:54:56 +0000 @@ -1,3 +1,8 @@ +2013-01-19 Glenn Morris + + * mail/unrmail.el (unrmail): Do not mangle the mbox From line; + fixes 2012-12-07 change. (Bug#13499) + 2013-01-19 Leo Liu * dired.el (dired-get-marked-files): Prune erroneous values due to === modified file 'lisp/mail/unrmail.el' --- lisp/mail/unrmail.el 2013-01-02 16:13:04 +0000 +++ lisp/mail/unrmail.el 2013-01-19 20:54:56 +0000 @@ -241,6 +241,7 @@ (when keywords (insert "X-RMAIL-KEYWORDS: " keywords "\n")) (goto-char (point-min)) + (forward-line 1) ; skip `From ' line ;; Convert From to >From, etc. (let ((case-fold-search nil) (fromline (if (eq 'mboxrd unrmail-mbox-format) ------------------------------------------------------------ revno: 111561 [merge] committer: Glenn Morris branch nick: trunk timestamp: Sat 2013-01-19 12:38:13 -0800 message: Merge from emacs-24; up to r111189 diff: === modified file 'ChangeLog' --- ChangeLog 2013-01-16 17:45:39 +0000 +++ ChangeLog 2013-01-19 20:38:13 +0000 @@ -1,3 +1,8 @@ +2013-01-19 Glenn Morris + + * Makefile.in (install-arch-indep): Put back a chmod that was + removed 2012-05-19. (Bug#13430) + 2013-01-16 Paul Eggert Merge from gnulib, incorporating: === modified file 'Makefile.in' --- Makefile.in 2013-01-02 16:13:04 +0000 +++ Makefile.in 2013-01-19 20:38:13 +0000 @@ -534,6 +534,7 @@ tar -xvf - && cat > /dev/null) || exit 1; \ [ "$${dir}" != "${srcdir}/etc" ] || rm -f $${dest}/DOC* ; \ for subdir in `find $${dest} -type d -print` ; do \ + chmod a+rx $${subdir} ; \ rm -f $${subdir}/.gitignore ; \ rm -f $${subdir}/.arch-inventory ; \ rm -f $${subdir}/.DS_Store ; \ @@ -568,7 +569,9 @@ done ) -chmod -R a+r $(DESTDIR)${datadir}/emacs/${version} ${COPYDESTS} -# The last chmod isn't needed at present. +## The above chmods are needed because "umask 022; tar ..." is not +## guaranteed to do the right thing; eg if we are root and tar is +## preserving source permissions. ## We install only the relevant DOC file if possible ## (ie DOC-${version}.buildnumber), otherwise DOC-${version}*. === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-01-07 22:00:55 +0000 +++ doc/emacs/ChangeLog 2013-01-19 20:38:13 +0000 @@ -1,3 +1,11 @@ +2013-01-19 Glenn Morris + + * custom.texi (Directory Variables): Fix paren typo. + + * trouble.texi (Crashing): Not all addr2line have -p. (Bug#13445) + + * custom.texi (Custom Themes): Fix typo. + 2013-01-07 Bastien Guerry * help.texi (Apropos): Document `apropos-user-option' and update === modified file 'doc/emacs/custom.texi' --- doc/emacs/custom.texi 2013-01-01 09:11:05 +0000 +++ doc/emacs/custom.texi 2013-01-18 01:53:34 +0000 @@ -555,7 +555,7 @@ between various collections of settings, and to transfer such collections from one computer to another. - A Custom theme is stored an Emacs Lisp source file. If the name of + A Custom theme is stored as an Emacs Lisp source file. If the name of the Custom theme is @var{name}, the theme file is named @file{@var{name}-theme.el}. @xref{Creating Custom Themes}, for the format of a theme file and how to make one. @@ -1305,7 +1305,7 @@ @example ((nil . ((indent-tabs-mode . t) (fill-column . 80))) - (c-mode . ((c-file-style . "BSD"))) + (c-mode . ((c-file-style . "BSD") (subdirs . nil))) ("src/imported" . ((nil . ((change-log-default-name === modified file 'doc/emacs/trouble.texi' --- doc/emacs/trouble.texi 2013-01-02 16:13:04 +0000 +++ doc/emacs/trouble.texi 2013-01-19 20:38:13 +0000 @@ -325,7 +325,7 @@ @example sed -n 's/.*\[\(.*\)]$/\1/p' @var{backtrace} | - addr2line -Cfip -e @var{bindir}/@var{emacs-binary} + addr2line -C -f -i -e @var{bindir}/@var{emacs-binary} @end example @noindent @@ -333,7 +333,9 @@ the backtrace, @var{bindir} is the name of the directory that contains the Emacs executable, and @var{emacs-binary} is the name of the Emacs executable file, normally @file{emacs} on GNU and Unix -systems and @file{emacs.exe} on MS-Windows and MS-DOS. +systems and @file{emacs.exe} on MS-Windows and MS-DOS.@footnote{You +may wish to add the @option{-p} option, if your version of +@command{addr2line} supports it.} @cindex core dump Optionally, Emacs can generate a @dfn{core dump} when it crashes, on === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-01-19 09:59:51 +0000 +++ doc/lispref/ChangeLog 2013-01-19 20:38:13 +0000 @@ -1,3 +1,8 @@ +2013-01-19 Glenn Morris + + * macros.texi (Indenting Macros): Fix order of an indent + symbol's arguments. (Bug#13450) + 2013-01-19 Paul Eggert Allow floating-point file offsets. === modified file 'doc/lispref/macros.texi' --- doc/lispref/macros.texi 2013-01-01 09:11:05 +0000 +++ doc/lispref/macros.texi 2013-01-16 02:03:06 +0000 @@ -606,12 +606,12 @@ function receives two arguments: @table @asis +@item @var{pos} +The position at which the line being indented begins. @item @var{state} The value returned by @code{parse-partial-sexp} (a Lisp primitive for indentation and nesting computation) when it parses up to the beginning of this line. -@item @var{pos} -The position at which the line being indented begins. @end table @noindent === modified file 'etc/NEWS' --- etc/NEWS 2013-01-19 15:22:38 +0000 +++ etc/NEWS 2013-01-19 20:38:13 +0000 @@ -275,9 +275,9 @@ ** New configure option `--enable-gcc-warnings' (for developing/debugging Emacs). If building with GCC, this enables compile-time checks that -warn about possibly-questionable C code. On a recent GNU system there -should be no warnings; on older and on non-GNU systems the generated -warnings may be useful. +warn/give errors about possibly-questionable C code. On a recent GNU +system there should be no warnings; on older and on non-GNU systems +the results may be useful to developers. ** The configure option `--enable-use-lisp-union-type' has been renamed to `--enable-check-lisp-object-type', as the resulting === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-01-19 15:22:38 +0000 +++ lisp/ChangeLog 2013-01-19 20:38:13 +0000 @@ -1,3 +1,15 @@ +2013-01-19 Leo Liu + + * dired.el (dired-get-marked-files): Prune erroneous values due to + last change. (Bug#13152) + +2013-01-19 Glenn Morris + + * progmodes/etags.el (tags-table-check-computed-list): + Preserve point in tags buffer. (Bug#13412) + + * emacs-lisp/lisp-mode.el (lisp-indent-function): Doc fix. + 2013-01-19 Christian Wittern (tiny change) Chong Yidong === modified file 'lisp/dired.el' --- lisp/dired.el 2013-01-02 16:13:04 +0000 +++ lisp/dired.el 2013-01-19 20:38:13 +0000 @@ -620,12 +620,14 @@ If DISTINGUISH-ONE-MARKED is non-nil, then if we find just one marked file, return (t FILENAME) instead of (FILENAME). Don't use that together with FILTER." - (let* ((all-of-them - (save-excursion - (dired-map-over-marks - (dired-get-filename localp 'no-error-if-not-filep) - arg nil distinguish-one-marked))) - result) + (let ((all-of-them + (save-excursion + (delq nil (dired-map-over-marks + (dired-get-filename localp 'no-error-if-not-filep) + arg nil distinguish-one-marked)))) + result) + (when (equal all-of-them '(t)) + (setq all-of-them nil)) (if (not filter) (if (and distinguish-one-marked (eq (car all-of-them) t)) all-of-them === modified file 'lisp/emacs-lisp/lisp-mode.el' --- lisp/emacs-lisp/lisp-mode.el 2013-01-02 16:13:04 +0000 +++ lisp/emacs-lisp/lisp-mode.el 2013-01-19 20:38:13 +0000 @@ -1156,7 +1156,7 @@ The function `calculate-lisp-indent' calls this to determine if the arguments of a Lisp function call should be indented specially. -INDENT-POINT is the position where the user typed TAB, or equivalent. +INDENT-POINT is the position at which the line being indented begins. Point is located at the point to indent under (for default indentation); STATE is the `parse-partial-sexp' state for that position. === modified file 'lisp/progmodes/etags.el' --- lisp/progmodes/etags.el 2013-01-11 23:08:55 +0000 +++ lisp/progmodes/etags.el 2013-01-19 20:38:13 +0000 @@ -336,12 +336,15 @@ (save-excursion (tags-verify-table (buffer-file-name table-buffer)))) (with-current-buffer table-buffer - (if (tags-included-tables) - ;; Insert the included tables into the list we - ;; are processing. - (setcdr tables (nconc (mapcar 'tags-expand-table-name - (tags-included-tables)) - (cdr tables))))) + ;; Needed so long as etags-tags-included-tables + ;; does not save-excursion. + (save-excursion + (if (tags-included-tables) + ;; Insert the included tables into the list we + ;; are processing. + (setcdr tables (nconc (mapcar 'tags-expand-table-name + (tags-included-tables)) + (cdr tables)))))) ;; This table is not in core yet. Insert a placeholder ;; saying we must read it into core to check for included ;; tables before searching the next table in the list. @@ -1550,6 +1553,7 @@ files))) (nreverse files))) +;; FIXME? Should this save-excursion? (defun etags-tags-included-tables () ; Doc string? (let ((files nil) beg) === modified file 'src/ChangeLog' --- src/ChangeLog 2013-01-19 20:04:33 +0000 +++ src/ChangeLog 2013-01-19 20:38:13 +0000 @@ -1,3 +1,7 @@ +2013-01-19 Glenn Morris + + * fns.c (Frandom): Doc fix. + 2013-01-19 Eli Zaretskii * editfns.c (get_pos_property): Use SAFE_ALLOCA_LISP, to avoid === modified file 'src/fns.c' --- src/fns.c 2013-01-04 02:53:48 +0000 +++ src/fns.c 2013-01-19 20:38:13 +0000 @@ -66,7 +66,10 @@ With positive integer LIMIT, return random number in interval [0,LIMIT). With argument t, set the random number seed from the current time and pid. -Other values of LIMIT are ignored. */) +With a string argument, set the seed based on the string's contents. +Other values of LIMIT are ignored. + +See Info node `(elisp)Random Numbers' for more details. */) (Lisp_Object limit) { EMACS_INT val; ------------------------------------------------------------ revno: 111560 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2013-01-19 22:04:33 +0200 message: Fix crashes with lots of overlays. src/editfns.c (get_pos_property): Use SAFE_ALLOCA_LISP, to avoid segfault when there are lots of overlays. src/buffer.c (sort_overlays): Use SAFE_NALLOCA, to avoid segfault when there are lots of overlays. See http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00421.html for the details and a way to reproduce. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-01-19 18:58:40 +0000 +++ src/ChangeLog 2013-01-19 20:04:33 +0000 @@ -1,3 +1,13 @@ +2013-01-19 Eli Zaretskii + + * editfns.c (get_pos_property): Use SAFE_ALLOCA_LISP, to avoid + segfault when there are lots of overlays. + + * buffer.c (sort_overlays): Use SAFE_NALLOCA, to avoid segfault + when there are lots of overlays. See + http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00421.html + for the details and a way to reproduce. + 2013-01-19 Paul Eggert * fileio.c: Use O_APPEND to append. === modified file 'src/buffer.c' --- src/buffer.c 2013-01-17 05:52:13 +0000 +++ src/buffer.c 2013-01-19 20:04:33 +0000 @@ -3151,7 +3151,10 @@ sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w) { ptrdiff_t i, j; - struct sortvec *sortvec = alloca (noverlays * sizeof *sortvec); + USE_SAFE_ALLOCA; + struct sortvec *sortvec; + + SAFE_NALLOCA (sortvec, 1, noverlays); /* Put the valid and relevant overlays into sortvec. */ @@ -3197,6 +3200,8 @@ for (i = 0; i < noverlays; i++) overlay_vec[i] = sortvec[i].overlay; + + SAFE_FREE (); return (noverlays); } === modified file 'src/editfns.c' --- src/editfns.c 2013-01-17 06:29:40 +0000 +++ src/editfns.c 2013-01-19 20:04:33 +0000 @@ -386,6 +386,7 @@ ptrdiff_t noverlays; Lisp_Object *overlay_vec, tem; struct buffer *obuf = current_buffer; + USE_SAFE_ALLOCA; set_buffer_temp (XBUFFER (object)); @@ -398,7 +399,7 @@ make enough space for all, and try again. */ if (noverlays > 40) { - overlay_vec = alloca (noverlays * sizeof *overlay_vec); + SAFE_ALLOCA_LISP (overlay_vec, noverlays); noverlays = overlays_around (posn, overlay_vec, noverlays); } noverlays = sort_overlays (overlay_vec, noverlays, NULL); @@ -421,10 +422,12 @@ ; /* The overlay will not cover a char inserted at point. */ else { + SAFE_FREE (); return tem; } } } + SAFE_FREE (); { /* Now check the text properties. */ int stickiness = text_property_stickiness (prop, position, object); ------------------------------------------------------------ revno: 111559 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-01-19 10:58:40 -0800 message: * fileio.c: Use O_APPEND to append. This corresponds better to the natural interpretation of "append", and avoids the need to open the output file twice, or to invoke lseek when APPEND is neither nil nor a number. This relies on POSIX 1003.1-1988 or later, which is OK nowadays. (Fwrite_region): Simplify. Use O_APPEND instead of opening the file possibly twice, and lseeking to its end; this avoids the need to lseek on non-regular files. Do not use O_EXCL and O_TRUNC at the same time: the combination is never needed and apparently it doesn't work with DOS_NT. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-01-19 12:29:10 +0000 +++ src/ChangeLog 2013-01-19 18:58:40 +0000 @@ -1,5 +1,16 @@ 2013-01-19 Paul Eggert + * fileio.c: Use O_APPEND to append. + This corresponds better to the natural interpretation of "append", + and avoids the need to open the output file twice, or to invoke + lseek when APPEND is neither nil nor a number. + This relies on POSIX 1003.1-1988 or later, which is OK nowadays. + (Fwrite_region): Simplify. Use O_APPEND instead of opening the + file possibly twice, and lseeking to its end; this avoids the + need to lseek on non-regular files. Do not use O_EXCL and O_TRUNC + at the same time: the combination is never needed and apparently + it doesn't work with DOS_NT. + Fix size bug on DOS_NT introduced by CIFS workaround (Bug#13149). * fileio.c (Fwrite_region): Use O_BINARY in checking code, too. === modified file 'src/fileio.c' --- src/fileio.c 2013-01-19 12:29:10 +0000 +++ src/fileio.c 2013-01-19 18:58:40 +0000 @@ -4741,7 +4741,9 @@ (Lisp_Object start, Lisp_Object end, Lisp_Object filename, Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, Lisp_Object mustbenew) { int desc; - off_t offset; + int open_flags; + int mode; + off_t offset IF_LINT (= 0); bool ok; int save_errno = 0; const char *fn; @@ -4861,28 +4863,20 @@ #endif /* CLASH_DETECTION */ encoded_filename = ENCODE_FILE (filename); - fn = SSDATA (encoded_filename); - offset = 0; - desc = -1; - if (!NILP (append)) - { - if (NUMBERP (append)) - offset = file_offset (append); - desc = emacs_open (fn, O_WRONLY | O_BINARY, 0); - } - - if (desc < 0 && (NILP (append) || errno == ENOENT)) + open_flags = O_WRONLY | O_BINARY | O_CREAT; + open_flags |= EQ (mustbenew, Qexcl) ? O_EXCL : !NILP (append) ? 0 : O_TRUNC; + if (NUMBERP (append)) + offset = file_offset (append); + else if (!NILP (append)) + open_flags |= O_APPEND; #ifdef DOS_NT - desc = emacs_open (fn, - O_WRONLY | O_CREAT | O_BINARY - | (EQ (mustbenew, Qexcl) ? O_EXCL : O_TRUNC), - S_IREAD | S_IWRITE); -#else /* not DOS_NT */ - desc = emacs_open (fn, O_WRONLY | O_TRUNC | O_CREAT - | (EQ (mustbenew, Qexcl) ? O_EXCL : 0), - auto_saving ? auto_save_mode_bits : 0666); -#endif /* not DOS_NT */ + mode = S_IREAD | S_IWRITE; +#else + mode = auto_saving ? auto_save_mode_bits : 0666; +#endif + + desc = emacs_open (fn, open_flags, mode); if (desc < 0) { @@ -4897,9 +4891,9 @@ record_unwind_protect (close_file_unwind, make_number (desc)); - if (!NILP (append)) + if (NUMBERP (append)) { - off_t ret = lseek (desc, offset, NUMBERP (append) ? SEEK_SET : SEEK_END); + off_t ret = lseek (desc, offset, SEEK_SET); if (ret < 0) { #ifdef CLASH_DETECTION ------------------------------------------------------------ revno: 111558 fixes bug: http://debbugs.gnu.org/8453 author: Christian Wittern committer: Chong Yidong branch nick: trunk timestamp: Sat 2013-01-19 23:22:38 +0800 message: * image-mode.el (image-next-file, image-previous-file): New commands. (image-mode-map): Bind them to n and p. (image-mode--images-in-directory): New helper function. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-01-19 10:34:07 +0000 +++ etc/NEWS 2013-01-19 15:22:38 +0000 @@ -110,6 +110,11 @@ *** Removed icomplete-show-key-bindings. ** Image mode + +*** New commands `n' (`image-next-file') and `p' (`image-previous-file') +visit the next image file and the previous image file in the same +directory, respectively. + --- *** The command `image-mode-fit-frame' deletes other windows. When toggling, it restores the frame's previous window configuration. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-01-19 10:34:07 +0000 +++ lisp/ChangeLog 2013-01-19 15:22:38 +0000 @@ -1,3 +1,11 @@ +2013-01-19 Christian Wittern (tiny change) + Chong Yidong + + * image-mode.el (image-next-file, image-previous-file): New + commands (Bug#8453). + (image-mode-map): Bind them to n and p. + (image-mode--images-in-directory): New helper function. + 2013-01-19 Chong Yidong * image-mode.el (image-mode-fit-frame): Add a frame argument. === modified file 'lisp/image-mode.el' --- lisp/image-mode.el 2013-01-19 10:34:07 +0000 +++ lisp/image-mode.el 2013-01-19 15:22:38 +0000 @@ -339,6 +339,8 @@ (define-key map (kbd "SPC") 'image-scroll-up) (define-key map (kbd "DEL") 'image-scroll-down) (define-key map (kbd "RET") 'image-toggle-animation) + (define-key map "n" 'image-next-file) + (define-key map "p" 'image-previous-file) (define-key map [remap forward-char] 'image-forward-hscroll) (define-key map [remap backward-char] 'image-backward-hscroll) (define-key map [remap right-char] 'image-forward-hscroll) @@ -618,6 +620,52 @@ (if image-animate-loop t))))))))) +;;; Switching to the next/previous image + +(defun image-next-file (&optional n) + "Visit the next image in the same directory as the current image file. +With optional argument N, visit the Nth image file after the +current one, in cyclic alphabetical order. + +This command visits the specified file via `find-alternate-file', +replacing the current Image mode buffer." + (interactive "p") + (unless (derived-mode-p 'image-mode) + (error "The buffer is not in Image mode")) + (unless buffer-file-name + (error "The current image is not associated with a file")) + (let* ((file (file-name-nondirectory buffer-file-name)) + (images (image-mode--images-in-directory file)) + (idx 0)) + (catch 'image-visit-next-file + (dolist (f images) + (if (string= f file) + (throw 'image-visit-next-file (1+ idx))) + (setq idx (1+ idx)))) + (setq idx (mod (+ idx (or n 1)) (length images))) + (find-alternate-file (nth idx images)))) + +(defun image-previous-file (&optional n) + "Visit the preceding image in the same directory as the current file. +With optional argument N, visit the Nth image file preceding the +current one, in cyclic alphabetical order. + +This command visits the specified file via `find-alternate-file', +replacing the current Image mode buffer." + (interactive "p") + (image-next-file (- n))) + +(defun image-mode--images-in-directory (file) + (let* ((dir (file-name-directory buffer-file-name)) + (files (directory-files dir nil + (image-file-name-regexp) t))) + ;; Add the current file to the list of images if necessary, in + ;; case it does not match `image-file-name-regexp'. + (unless (member file files) + (push file files)) + (sort files 'string-lessp))) + + ;;; Support for bookmark.el (declare-function bookmark-make-record-default "bookmark" (&optional no-file no-context posn)) ------------------------------------------------------------ revno: 111557 fixes bug: http://debbugs.gnu.org/13149 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-01-19 04:29:10 -0800 message: Fix size bug on DOS_NT introduced by CIFS workaround. * fileio.c (Fwrite_region): Use O_BINARY in checking code, too. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-01-19 09:59:51 +0000 +++ src/ChangeLog 2013-01-19 12:29:10 +0000 @@ -1,5 +1,8 @@ 2013-01-19 Paul Eggert + Fix size bug on DOS_NT introduced by CIFS workaround (Bug#13149). + * fileio.c (Fwrite_region): Use O_BINARY in checking code, too. + Allow floating-point file offsets. Problem reported by Vitalie Spinu in . === modified file 'src/fileio.c' --- src/fileio.c 2013-01-19 12:17:20 +0000 +++ src/fileio.c 2013-01-19 12:29:10 +0000 @@ -4989,7 +4989,7 @@ if (EMACS_TIME_VALID_P (modtime) && ! (valid_timestamp_file_system && st.st_dev == timestamp_file_system)) { - int desc1 = emacs_open (fn, O_WRONLY, 0); + int desc1 = emacs_open (fn, O_WRONLY | O_BINARY, 0); if (0 <= desc1) { struct stat st1; ------------------------------------------------------------ revno: 111556 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-01-19 04:17:20 -0800 message: * fileio.c (Fwrite_region): Sync diagnostic to previous change. diff: === modified file 'src/fileio.c' --- src/fileio.c 2013-01-19 09:59:51 +0000 +++ src/fileio.c 2013-01-19 12:17:20 +0000 @@ -5065,7 +5065,7 @@ } if (!auto_saving) - message_with_string ((INTEGERP (append) + message_with_string ((NUMBERP (append) ? "Updated %s" : ! NILP (append) ? "Added to %s" ------------------------------------------------------------ revno: 111555 fixes bug: http://debbugs.gnu.org/7730 committer: Chong Yidong branch nick: trunk timestamp: Sat 2013-01-19 18:34:07 +0800 message: * image-mode.el (image-mode-fit-frame): Add a frame argument. Suggested by Drew Adams. Handle window decorations; save and restore the old window configuration. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-01-13 19:55:51 +0000 +++ etc/NEWS 2013-01-19 10:34:07 +0000 @@ -109,6 +109,13 @@ *** The icomplete-separator is customizable, and its default has changed. *** Removed icomplete-show-key-bindings. +** Image mode +--- +*** The command `image-mode-fit-frame' deletes other windows. +When toggling, it restores the frame's previous window configuration. +It also has an optional frame argument, which can be used by Lisp +callers to fit the image to a frame other than the selected frame. + ** Isearch *** `C-x 8 RET' in Isearch mode reads a character by its Unicode name === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-01-18 18:22:18 +0000 +++ lisp/ChangeLog 2013-01-19 10:34:07 +0000 @@ -1,3 +1,9 @@ +2013-01-19 Chong Yidong + + * image-mode.el (image-mode-fit-frame): Add a frame argument. + Suggested by Drew Adams (Bug#7730). Handle window decorations; + save and restore the old window configuration. + 2013-01-18 Leo Liu * progmodes/js.el: Tweak autoload cookie for alias. === modified file 'lisp/image-mode.el' --- lisp/image-mode.el 2013-01-09 22:47:27 +0000 +++ lisp/image-mode.el 2013-01-19 10:34:07 +0000 @@ -278,28 +278,50 @@ ;; Adjust frame and image size. -(defun image-mode-fit-frame () - "Toggle whether to fit the frame to the current image. -This function assumes the current frame has only one window." - ;; FIXME: This does not take into account decorations like mode-line, - ;; minibuffer, header-line, ... - (interactive) - (let* ((saved (frame-parameter nil 'image-mode-saved-size)) +(defun image-mode-fit-frame (&optional frame toggle) + "Fit FRAME to the current image. +If FRAME is omitted or nil, it defaults to the selected frame. +All other windows on the frame are deleted. + +If called interactively, or if TOGGLE is non-nil, toggle between +fitting FRAME to the current image and restoring the size and +window configuration prior to the last `image-mode-fit-frame' +call." + (interactive (list nil t)) + (let* ((buffer (current-buffer)) (display (image-get-display-property)) - (size (image-display-size display))) - (if (and saved - (eq (caar saved) (frame-width)) - (eq (cdar saved) (frame-height))) - (progn ;; Toggle back to previous non-fitted size. - (set-frame-parameter nil 'image-mode-saved-size nil) - (setq size (cdr saved))) - ;; Round up size, and save current size so we can toggle back to it. - (setcar size (ceiling (car size))) - (setcdr size (ceiling (cdr size))) - (set-frame-parameter nil 'image-mode-saved-size - (cons size (cons (frame-width) (frame-height))))) - (set-frame-width (selected-frame) (car size)) - (set-frame-height (selected-frame) (cdr size)))) + (size (image-display-size display)) + (saved (frame-parameter frame 'image-mode-saved-params)) + (window-configuration (current-window-configuration frame)) + (width (frame-width frame)) + (height (frame-height frame))) + (with-selected-frame (or frame (selected-frame)) + (if (and toggle saved + (= (caar saved) width) + (= (cdar saved) height)) + (progn + (set-frame-width frame (car (nth 1 saved))) + (set-frame-height frame (cdr (nth 1 saved))) + (set-window-configuration (nth 2 saved)) + (set-frame-parameter frame 'image-mode-saved-params nil)) + (delete-other-windows) + (switch-to-buffer buffer t t) + (let* ((edges (window-inside-edges)) + (inner-width (- (nth 2 edges) (nth 0 edges))) + (inner-height (- (nth 3 edges) (nth 1 edges)))) + (set-frame-width frame (+ (ceiling (car size)) + width (- inner-width))) + (set-frame-height frame (+ (ceiling (cdr size)) + height (- inner-height))) + ;; The frame size after the above `set-frame-*' calls may + ;; differ from what we specified, due to window manager + ;; interference. We have to call `frame-width' and + ;; `frame-height' to get the actual results. + (set-frame-parameter frame 'image-mode-saved-params + (list (cons (frame-width) + (frame-height)) + (cons width height) + window-configuration))))))) ;;; Image Mode setup ------------------------------------------------------------ revno: 111554 committer: Paul Eggert branch nick: trunk timestamp: Sat 2013-01-19 01:59:51 -0800 message: Allow floating-point file offsets. Problem reported by Vitalie Spinu in . * doc/lispref/files.texi (Reading from Files, Writing to Files): Say that file offsets can be numbers, not just integers. * src/fileio.c (emacs_lseek): Remove. (file_offset): New function. (Finsert_file_contents, Fwrite_region): Use it. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-01-10 03:43:02 +0000 +++ doc/lispref/ChangeLog 2013-01-19 09:59:51 +0000 @@ -1,3 +1,9 @@ +2013-01-19 Paul Eggert + + Allow floating-point file offsets. + * files.texi (Reading from Files, Writing to Files): + Say that file offsets can be numbers, not just integers. + 2013-01-09 Glenn Morris * commands.texi (Interactive Codes): === modified file 'doc/lispref/files.texi' --- doc/lispref/files.texi 2013-01-04 02:42:08 +0000 +++ doc/lispref/files.texi 2013-01-19 09:59:51 +0000 @@ -533,9 +533,9 @@ file name and its last save file modtime. This feature is used by @code{find-file-noselect} and you probably should not use it yourself. -If @var{beg} and @var{end} are non-@code{nil}, they should be integers -specifying the portion of the file to insert. In this case, @var{visit} -must be @code{nil}. For example, +If @var{beg} and @var{end} are non-@code{nil}, they should be numbers +that are byte offsets specifying the portion of the file to insert. +In this case, @var{visit} must be @code{nil}. For example, @example (insert-file-contents filename nil 0 500) @@ -605,8 +605,8 @@ this case. If @var{append} is non-@code{nil}, then the specified text is appended -to the existing file contents (if any). If @var{append} is an -integer, @code{write-region} seeks to that byte offset from the start +to the existing file contents (if any). If @var{append} is a +number, @code{write-region} seeks to that byte offset from the start of the file and writes the data from there. If @var{mustbenew} is non-@code{nil}, then @code{write-region} asks === modified file 'src/ChangeLog' --- src/ChangeLog 2013-01-19 08:49:17 +0000 +++ src/ChangeLog 2013-01-19 09:59:51 +0000 @@ -1,3 +1,12 @@ +2013-01-19 Paul Eggert + + Allow floating-point file offsets. + Problem reported by Vitalie Spinu in + . + * fileio.c (emacs_lseek): Remove. + (file_offset): New function. + (Finsert_file_contents, Fwrite_region): Use it. + 2013-01-19 Chong Yidong * emacs.c (Fkill_emacs): Set waiting_for_input to 0 to avoid === modified file 'src/fileio.c' --- src/fileio.c 2013-01-19 04:44:34 +0000 +++ src/fileio.c 2013-01-19 09:59:51 +0000 @@ -3443,19 +3443,25 @@ return Qnil; } -/* Reposition FD to OFFSET, based on WHENCE. This acts like lseek - except that it also tests for OFFSET being out of lseek's range. */ +/* Return the file offset that VAL represents, checking for type + errors and overflow. */ static off_t -emacs_lseek (int fd, EMACS_INT offset, int whence) +file_offset (Lisp_Object val) { - /* Use "&" rather than "&&" to suppress a bogus GCC warning; see - . */ - if (! ((offset >= TYPE_MINIMUM (off_t)) & (offset <= TYPE_MAXIMUM (off_t)))) + if (RANGED_INTEGERP (0, val, TYPE_MAXIMUM (off_t))) + return XINT (val); + + if (FLOATP (val)) { - errno = EINVAL; - return -1; + double v = XFLOAT_DATA (val); + if (0 <= v + && (sizeof (off_t) < sizeof v + ? v <= TYPE_MAXIMUM (off_t) + : v < TYPE_MAXIMUM (off_t))) + return v; } - return lseek (fd, offset, whence); + + wrong_type_argument (intern ("file-offset"), val); } /* Return a special time value indicating the error number ERRNUM. */ @@ -3606,20 +3612,12 @@ } if (!NILP (beg)) - { - if (! RANGED_INTEGERP (0, beg, TYPE_MAXIMUM (off_t))) - wrong_type_argument (intern ("file-offset"), beg); - beg_offset = XFASTINT (beg); - } + beg_offset = file_offset (beg); else beg_offset = 0; if (!NILP (end)) - { - if (! RANGED_INTEGERP (0, end, TYPE_MAXIMUM (off_t))) - wrong_type_argument (intern ("file-offset"), end); - end_offset = XFASTINT (end); - } + end_offset = file_offset (end); else { if (not_regular) @@ -4714,7 +4712,7 @@ instead of any buffer contents; END is ignored. Optional fourth argument APPEND if non-nil means - append to existing file contents (if any). If it is an integer, + append to existing file contents (if any). If it is a number, seek to that offset in the file before writing. Optional fifth argument VISIT, if t or a string, means set the last-save-file-modtime of buffer to this file's modtime @@ -4743,6 +4741,7 @@ (Lisp_Object start, Lisp_Object end, Lisp_Object filename, Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, Lisp_Object mustbenew) { int desc; + off_t offset; bool ok; int save_errno = 0; const char *fn; @@ -4864,13 +4863,14 @@ encoded_filename = ENCODE_FILE (filename); fn = SSDATA (encoded_filename); + offset = 0; desc = -1; if (!NILP (append)) -#ifdef DOS_NT - desc = emacs_open (fn, O_WRONLY | O_BINARY, 0); -#else /* not DOS_NT */ - desc = emacs_open (fn, O_WRONLY, 0); -#endif /* not DOS_NT */ + { + if (NUMBERP (append)) + offset = file_offset (append); + desc = emacs_open (fn, O_WRONLY | O_BINARY, 0); + } if (desc < 0 && (NILP (append) || errno == ENOENT)) #ifdef DOS_NT @@ -4897,14 +4897,9 @@ record_unwind_protect (close_file_unwind, make_number (desc)); - if (!NILP (append) && !NILP (Ffile_regular_p (filename))) + if (!NILP (append)) { - off_t ret; - - if (NUMBERP (append)) - ret = emacs_lseek (desc, XINT (append), SEEK_CUR); - else - ret = lseek (desc, 0, SEEK_END); + off_t ret = lseek (desc, offset, NUMBERP (append) ? SEEK_SET : SEEK_END); if (ret < 0) { #ifdef CLASH_DETECTION ------------------------------------------------------------ revno: 111553 fixes bug: http://debbugs.gnu.org/13289 committer: Chong Yidong branch nick: trunk timestamp: Sat 2013-01-19 16:49:17 +0800 message: * emacs.c (Fkill_emacs): Set waiting_for_input to 0 to avoid aborting on Fsignal. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-01-19 07:32:36 +0000 +++ src/ChangeLog 2013-01-19 08:49:17 +0000 @@ -1,3 +1,8 @@ +2013-01-19 Chong Yidong + + * emacs.c (Fkill_emacs): Set waiting_for_input to 0 to avoid + aborting on Fsignal (Bug#13289). + 2013-01-19 Eli Zaretskii * w32.c (acl_set_file): Treat ERROR_ACCESS_DENIED from === modified file 'src/emacs.c' --- src/emacs.c 2013-01-19 04:44:34 +0000 +++ src/emacs.c 2013-01-19 08:49:17 +0000 @@ -133,7 +133,7 @@ Lisp_Object Qrisky_local_variable; -Lisp_Object Qkill_emacs; +Lisp_Object Qkill_emacs, Qkill_emacs_hook; /* If true, Emacs should not attempt to use a window-specific code, but instead should use the virtual terminal under which it was started. */ @@ -1841,7 +1841,6 @@ (Lisp_Object arg) { struct gcpro gcpro1; - Lisp_Object hook; int exit_code; GCPRO1 (arg); @@ -1849,9 +1848,10 @@ if (feof (stdin)) arg = Qt; - hook = intern ("kill-emacs-hook"); - Frun_hooks (1, &hook); - + /* Fsignal calls emacs_abort () if it sees that waiting_for_input is + set. */ + waiting_for_input = 0; + Frun_hooks (1, &Qkill_emacs_hook); UNGCPRO; #ifdef HAVE_X_WINDOWS @@ -2263,6 +2263,7 @@ DEFSYM (Qfile_name_handler_alist, "file-name-handler-alist"); DEFSYM (Qrisky_local_variable, "risky-local-variable"); DEFSYM (Qkill_emacs, "kill-emacs"); + DEFSYM (Qkill_emacs_hook, "kill-emacs-hook"); #ifndef CANNOT_DUMP defsubr (&Sdump_emacs); ------------------------------------------------------------ revno: 111552 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2013-01-19 09:32:36 +0200 message: Make 'fstat' on MS-Windows behave more like 'stat' and 'lstat'. src/w32.c (fstat): Return owner and group like 'stat' and 'lstat' do. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-01-19 07:13:19 +0000 +++ src/ChangeLog 2013-01-19 07:32:36 +0000 @@ -3,6 +3,7 @@ * w32.c (acl_set_file): Treat ERROR_ACCESS_DENIED from set_file_security as failure due to insufficient privileges. Reported by Fabrice Popineau . + (fstat): Return owner and group like 'stat' and 'lstat' do. 2013-01-19 Paul Eggert === modified file 'src/w32.c' --- src/w32.c 2013-01-19 07:13:19 +0000 +++ src/w32.c 2013-01-19 07:32:36 +0000 @@ -4164,13 +4164,23 @@ else buf->st_ino = fake_inode; - /* Consider files to belong to current user. - FIXME: this should use GetSecurityInfo API, but it is only - available for _WIN32_WINNT >= 0x501. */ - buf->st_uid = dflt_passwd.pw_uid; - buf->st_gid = dflt_passwd.pw_gid; - strcpy (buf->st_uname, dflt_passwd.pw_name); - strcpy (buf->st_gname, dflt_group.gr_name); + /* If the caller so requested, get the true file owner and group. + Otherwise, consider the file to belong to the current user. */ + if (!w32_stat_get_owner_group || is_windows_9x () == TRUE) + get_file_owner_and_group (NULL, buf); + else + { + PSECURITY_DESCRIPTOR psd = NULL; + + psd = get_file_security_desc_by_handle (fh); + if (psd) + { + get_file_owner_and_group (psd, buf); + LocalFree (psd); + } + else + get_file_owner_and_group (NULL, buf); + } buf->st_dev = info.dwVolumeSerialNumber; buf->st_rdev = info.dwVolumeSerialNumber; ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.