Based on ideas from Kim F. Storm <storm@cua.dk>, see
http://lists.gnu.org/archive/html/emacs-devel/2006-12/msg00873.html.
src/w32proc.c (reader_thread): If the FILE_CONNECT flag is set, call
'_sys_wait_connect'. If it returns STATUS_CONNECT_FAILED, exit
the thread with code 2.
(sys_select): Support 'wfds' in addition to 'rfds'. If a
descriptor in 'wfds' has its bit set, but the corresponding
fd_info member doesn't have its FILE_CONNECT flag set, ignore the
descriptor. Otherwise, acknowledge a successful non-blocking
connect by resetting the FILE_CONNECT flag and setting cp->status
to STATUS_READ_ACKNOWLEDGED.
src/w32.h (STATUS_CONNECT_FAILED): New enumeration value.
(struct _child_process): New member 'errcode'.
(FILE_CONNECT): New flag.
(_sys_wait_connect): Add prototype.
src/w32.c (pfn_WSAEnumNetworkEvents): New function pointer.
(init_winsock): Load WSAEnumNetworkEvents from winsock DLL.
(set_errno): Map WSAEWOULDBLOCK and WSAENOTCONN.
(sys_connect): Support non-blocking 'connect' calls by setting the
FILE_CONNECT flag in the fd_info member and returning EINPROGRESS.
(_sys_read_ahead): Add debug message if this function is called
for a descriptor that waits for a non-blocking connect to complete.
(_sys_wait_connect): New function.
(sys_read): Support STATUS_CONNECT_FAILED. Return the error code
recorded by _sys_wait_connect when the non-blocking connect
failed. Don't call WSAGetLastError before a call to set_errno had
a chance to use its value, since WSAGetLastError clears the last
error.
nt/inc/ms-w32.h (BROKEN_NON_BLOCKING_CONNECT): Don't define.
f160106 Avoid assertion violations in Rmail due to newline cache
1b0ebbd browse-url-firefox: update for firefox 36's removal of -remote
1817892 Avoid erratic behavior of menu-bar tooltips on w32 (Bug#19925)
0260932 Bump python.el version
b0adfc7 Spelling fixes
35f047c * src/fileio.c (Fmake_temp_name): Doc tweaks.
6f2971a * lisp/comint.el (comint-line-beginning-position): Revert searching
65d8ac7 Mention in admin/notes/repo how to mark commits not to be merged.
86fe750 # Remove NEWS temporary markup
4fa778b erc.el: Add old version header for package.el compatibilty
9366f05 Tramp: Disable paging with PAGER=cat
Conflicts:
admin/notes/repo
etc/NEWS
lisp/ChangeLog
lisp/erc/ChangeLog
src/ChangeLog
4b0b27d Fix invocation of commands whose file name includes extension
87fc99f Better support for the case of typing RET on the prompt in comint.
a7b1c2f Don't lose frame's background color when setting foreground
20c817d Fix handling of frame color parameters in TTY sessions
eca7da1 Complete the remaining documentation updates for 24.5
Conflicts:
doc/lispref/ChangeLog
etc/NEWS
lisp/ChangeLog
nt/ChangeLog
src/ChangeLog
src/emacs.c <w32_daemon_event> [WINDOWSNT]: New global var.
(main) [WINDOWSNT]: Initialize it to NULL. Create the event to
signal clients we are ready for connections.
(Fdaemon_initialized): Use DAEMON_RUNNING.
[WINDOWSNT]: MS-Windows specific code to signal clients we are
ready for connections.
src/lisp.h (DAEMON_RUNNING): New macro, encapsulates Posix and
MS-Windows conditions for running in daemon mode.
src/minibuf.c (read_minibuf): Use DAEMON_RUNNING.
src/keyboard.c (kbd_buffer_get_event): Use DAEMON_RUNNING.
src/dispnew.c (init_display) [WINDOWSNT]: Initialize frames/terminal
even in daemon mode.
nt/inc/ms-w32.h (W32_DAEMON_EVENT): New macro.
lib-src/emacsclient.c (decode_options) [WINDOWSNT]: Don't reject empty
arguments for --alternate-editor.
(print_help_and_exit) [WINDOWSNT]: Don't refrain from advertising
empty arguments for --alternate-editor.
(start_daemon_and_retry_set_socket) [WINDOWSNT]: MS-Windows
specific code to start Emacs in daemon mode and wait for it to be
ready for client connections.
lisp/server.el (server-process-filter): Force GUI frames on
MS-Windows in daemon mode, even if a TTY frame was requested.
lisp/frameset.el (frameset-keep-original-display-p): Don't assume
windows-nt cannot be in daemon mode.
lisp/frame.el (window-system-for-display): Don't assume windows-nt
cannot be in daemon mode.
nt/cmdproxy.c (get_next_token): Don't make backslashes disappear
without a trace when they are not followed by a quote.
(search_dir): Support searching programs whose file name already
has an arbitrary extension.
(main): When passing a command line to the shell, use cmd.exe
rules for quoting command-line tail.
These are dates that admin/update-copyright did not update, or
updated incorrectly. Also, back out the copyright-date change to
doc/misc/texinfo.tex, as upstream hasn't updated that date yet.
a5f90a3 * .gitattributes: New file.
5a9710f Make sure tool-bar changes are reflected on display.
93796ba * autogen.sh: Port better to non-GNU 'cp'.
9758516 Fix a typo in a comment in the previous commit.
aa472a3 Fix the pixel coordinates returned by pos-visible-in-window-p. (Bug#19473)
d261229 * automated/tramp-tests.el (tramp--test-smb-or-windows-nt-p): New defun. (tramp-test30-special-characters): Use it. (tramp--test-check-files): Filter nil file names out.
9278f05 Omit trailing white space
1c93fd3 Sync with Tramp 2.2.11.
96ebe18 Sync with Tramp 2.2.11.
e792450 Sync with Tramp 2.2.11.
2d17e12 Fix ChangeLog entry.
6444482 Fix auto-revert-tail-mode for remote files
b5c9c13 Spelling fixes
c5504d1 src/w32proc.c (Fw32_get_codepage_charset): Doc fix. (Bug#19458)
Conflicts:
ChangeLog
doc/misc/ChangeLog
lisp/ChangeLog
src/ChangeLog
test/ChangeLog
src/w32proc.c (sys_spawnve, get_lcid_callback): Use strcpy instead
of strcat.
src/w32menu.c (add_menu_item): Use stpcpy instead of strcat.
src/w32.c (sys_readdir, stat_worker, symlink): Use strcpy instead of
strcat.
nt/gnulib.mk (stpcpy, string): Sync with the latest change in
lib/gnulib.mk.
* nt/Makefile.in (../src/emacs.res): New target.
* src/Makefile.in (emacs.res): Use ../nt rule, rather than duplicating it.
(ntsource, WINDRES, EMACS_MANIFEST): Remove, now unused.
* configure.ac (comma_version, comma_space_version) [mingw32]:
New output variables.
(nt/emacs.rc, nt/emacsclient.rc) [mingw32]: New output files.
* make-dist: Update nt/ for *.rc -> *.rc.in changes.
* nt/emacs.rc.in, nt/emacsclient.rc.in: Rename from nt/emacs.rc, emacsclient.rc.
Let configure generate the real files, and set the version numbers.
* lib-src/Makefile.in (emacsclient.res): Update deps for nt/emacsclient.rc
now being in the build directory, not the source directory.
* nt/Makefile.in (distclean): Delete *.rc.
(emacs.res): Update deps for nt/emacsclient.rc now being in the
build directory, not the source directory.
* admin/admin.el (set-version): No more need to update nt/*.rc.
* admin/authors.el (authors-renamed-files-alist): Add .rc.in files.
... for detecting MinGW-w64. _W64 is not specific of MinGW-w64, it is
defined for compatibility with MS VC++.
* nt/inc/ms-w32.h: Define MINGW_W64.
* admin/CPP-DEFINES: Mention MINGW_W64.
* nt/addpm.c: Use it.
* nt/addsection.c: Use it.
* nt/preprep.c: Use it.
* src/w32.c: Use MINGW_W64 instead of _W64
* src/w32term.c: Likewise.
admin: Changes in several documents.
autogen.sh: Neutralize language specific to a repository type.
doc/misc/efaq-w32.texi: Neutralized language specific to a repository type.
doc/misc/gnus-coding.txt: Neutralized language specific to a repository type.
lisp/Makefile.in: Change some production names so they're neutral
about the repository type.
src/w32proc.c (create_child): If calling a quoted batch file,
pass NULL for exe.
nt/cmdproxy.c (batch_file_p): New function.
(spawn): If calling a quoted batch file pass NULL for progname.
test/automated/process-tests.el (process-test-quoted-batfile): New test.
README: Bump version to 25.0.50.
configure.ac (AC_INIT): Bump version to 25.0.50.
nt/makefile.w32-in (VERSION): Bump version to 25.0.50.
nt/emacsclient.rc: Bump version to 25.0.50.
nt/emacs.rc: Bump version to 25.0.50.
nt/config.nt (VERSION): Bump version to 25.0.50.
msdos/sed2v2.inp: Bump version to 25.0.50.
etc/refcards/ru-refcard.tex: Bump version to 25.0.50.
etc/refcards/emacsver.tex: Bump version to 25.0.50.
src/msdos.c (internal_terminal_init): Bump version to 25.
doc/man/emacs.1: Bump version to 25.0.50.
doc/emacs/emacsver.texi (EMACSVER): Bump to 20.0.50.
* nt/inc/ms-w32.h (POLL_FOR_INPUT): Likewise.
* src/keyboard.c, src/process.c: Do not define POLL_FOR_INPUT here
because it will be defined in generated config.h if needed.
src/Makefile.in (C_HEAP_SWITCH): Get the predefined heap size from
configure.
(ADDSECTION, MINGW_TEMACS_POST_LINK): Remove, no longer used.
src/lisp.h (NONPOINTER_BITS): Modify the condition to define to zero
for MinGW, since it no longer uses gmalloc.
src/buffer.c: Do not define mmap allocations functions for Windows.
Remove mmap_find which is unused. Remove mmap_set_vars which does
nothing useful.
[WINDOWSNT]: Include w32heap.h.
(init_buffer): Always allocate new memory for buffers.
src/emacs.c: Remove mmap_set_vars calls.
src/image.c (free_image): Undef free for Windows because it is
redirected to our private version.
src/unexw32.c (COPY_PROC_CHUNK): Use %p format for 64bits
compatibility.
(copy_executable_and_dump_data): Remove dumping the heap section.
(unexec): Restore using_dynamic_heap after dumping.
src/w32heap.c (dumped_data_commit, malloc_after_dump)
(malloc_before_dump, realloc_after_dump, realloc_before_dump)
(free_after_dump, free_before_dump, mmap_alloc, mmap_realloc)
(mmap_free): New functions.
src/w32heap.h: Declare dumped_data and mmap_* function prototypes.
nt/inc/ms-w32.h: Switch to the system heap allocation scheme
instead of GNU malloc and ralloc.
nt/inc/sys/mman.h: New file.
nt/INSTALL: Update for the new build requirements.
etc/NEWS: Mention build changes on MS-Windows.
configure.ac (C_HEAP_SWITCH) define for different values of
dumped heap size depending on 32/64bits arch on Windows.
Don't check for pthreads.h on MinGW32/64, it gets in the way.
Use mmap(2) for buffers and system malloc for MinGW32/64.
* INSTALL: Prefer './configure FOO=BAR' to 'FOO=BAR ./configure'.
* INSTALL.REPO: pkg-config is no longer required to build from
the repository.
* autogen.sh: Don't check for pkg-config.
(progs): Remove pkg-config.
(pkg_config_min, AUTORECONF_ENV, env_space, ACLOCAL_PATH):
Remove. All uses removed.
* m4/pkg.m4: New file, built by admin/merge-pkg-config.
* configure.ac: Remove unnecessary m4_pattern_forbid of ^PKG_ and
an AC_ARG_VAR of PKG_CONFIG_PATH. pkg.m4 does that for us.
(EMACS_CHECK_MODULES): Remove workaround for old pkg-config bug,
as we use pkg.m4 from a newer pkg-config.
* admin/merge-pkg-config: New script.
* admin/notes/copyright: Update for m4/*.m4, in particular m4/pkg.m4.
* etc/NEWS: Prefer './configure FOO=BAR' to 'FOO=BAR ./configure'.
* etc/PROBLEMS (Build-time-problems): Remove pkg-config problem
that is no longer an issue.
* nt/INSTALL: Remove no-longer-needed notes about pkg-config.
src/w32.c (maybe_load_unicows_dll): New function.
src/emacs.c (main) [WINDOWSNT]: Call maybe_load_unicows_dll early
on, to make sure we can convert file names to and from UTF-8 on
Windows 9X. This fixes a failure to start up because Emacs cannot
find term/w32-win.el. Reported by oslsachem <oslsachem@gmail.com>.
src/w32font.c [WINDOWSNT]: Include w32.h.
(w32_load_unicows_or_gdi32): Call maybe_load_unicows_dll, instead
of implementing the same stuff.
Remove now unused g_b_init_is_windows_9x.
src/w32.h (maybe_load_unicows_dll): Add prototype.
nt/runemacs.c (ensure_unicows_dll): Don't tell in the message box
that "emacs -nw" can do without UNICOWS.DLL on Windows 9X. See
w32.c:maybe_load_unicows_dll and its callers for the reason.
configure.ac: Read $srcdir/nt/mingw-cfg.site when $MSYSTEM is
"MINGW64" as well.
nt/inc/ms-w32.h (pthread_sigmask): Undefine if defined, for MinGW64.
src/unexw32.c (_start) [__MINGW64__]: Define to __start.
* mail/unrmail.el (unrmail-mbox-format): Choice is mboxo, not mboxro.
* woman.el (woman-mark-horizontal-position):
Rename from woman-mark-horizonal-position. Use changed.
configure.ac (canonical, C_SWITCH_SYSTEM): Support a 64-bit
MinGW64 build on MS-Windows.
nt/inc/ms-w32.h (sys_kill): Fix prototype.
src/w32term.c (w32_initialize): Use LCID and LOWORD.
src/w32proc.c (create_child): Use pid_t for 5th argument.
(IsValidLocale): Don't provide prototype for MinGW64.
(Fw32_get_valid_keyboard_layouts, Fw32_get_keyboard_layout)
(Fw32_set_keyboard_layout): Use HKL and HIWORD/LOWORD.
src/w32heap.c (allocate_heap) [_WIN64]: Use "ull", not "i64", which
MinGW64 doesn't support.
src/lisp.h (EMACS_INT) [_WIN64]: Define for the MinGW64 build.
nt/emacs-x64.manifest:
nt/emacs-x86.manifest: Declare that we target Windows 8.1 as well
as earlier versions. This is so GetVersion and GetVersionEx APIs
used for bug reporting and other purposes return accurate version
number on Windows 8.1. See the discussion on MSDN
http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx
for more details.
src/w32.c (get_file_security, set_file_security)
(create_symbolic_link): Separate pointers and boolean flags for
ANSI and Unicode APIs. Use the latter if w32_unicode_filenames is
non-zero, else the former.
(codepage_for_filenames, filename_to_utf16, )
(filename_from_utf16, filename_to_ansi, filename_from_ansi): New
functions.
(init_user_info): Allow $HOME and $SHELL to include non-ANSI
characters.
(normalize_filename): Lose the DBCS code, now works on UTF-8.
Accept only one argument; all callers changed.
(dostounix_filename): Remove the second argument, now works in
UTF-8. All callers changed.
(parse_root): Lose DBCS code.
(get_long_basename, w32_get_short_filename, init_environment)
(GetCachedVolumeInformation, sys_readdir, open_unc_volume)
(read_unc_volume, logon_network_drive, faccessat, sys_chdir)
(sys_chmod, sys_creat, sys_fopen, sys_link, sys_mkdir, sys_open)
(sys_rename_replace, sys_rmdir, sys_unlink, stat_worker, utime)
(is_symlink, readlink, chase_symlinks, w32_delayed_load): Work in
Unicode mode if w32_unicode_filenames is non-zero, in ANSI mode
otherwise.
(ansi_encode_filename): New function.
(get_emacs_configuration, get_emacs_configuration_options):
Functions deleted.
(add_volume_info, GetCachedVolumeInformation): Run the input file
name through unixtodos_filename, to ensure it is stored and
referenced in canonical form.
(get_volume_info): Lose the DBCS code, now works in UTF-8.
(logon_network_drive, sys_link, utime): Improve error handling.
(sys_access): New function.
(hashval, generate_inode_val): Unused functions deleted.
(symlink, readlink, readlinkat): Lose DBCS code, now works in UTF-8.
(check_windows_init_file): Convert error message from UTF-8 to
ANSI codepage, for display in the message box.
(globals_of_w32): Set w32_unicode_filenames according to the OS
version.
src/w32term.c (construct_drag_n_drop): Work in Unicode mode when
w32_unicode_filenames is non-zero, ANSI mode otherwise.
(syms_of_w32term): Declare w32-unicode-filenames.
src/w32proc.c (new_child, delete_child): Remove code that handled
unused pending_deletion and input_file members of the child struct.
(create_child, sys_spawnve): Convert all file names to ANSI
codepage. Use ANSI APIs explicitly; forcibly fail if any file
name cannot be encoded in ANSI codepage. Don't use
unixtodos_filename, mirror slashes by hand.
(record_infile, record_pending_deletion): Functions deleted.
(Fw32_short_file_name): Call w32_get_short_filename instead of
GetShortPathName.
src/w32notify.c (add_watch): Work in Unicode mode when
w32_unicode_filenames is non-zero, ANSI mode otherwise.
(Fw32notify_add_watch): Rewrite to avoid using GetFullPathName;
instead, do the same with Lisp primitives.
src/w32fns.c (file_dialog_callback, Fx_file_dialog)
(Fsystem_move_file_to_trash, Fw32_shell_execute)
(Ffile_system_info, Fdefault_printer_name): Work in Unicode mode
when w32_unicode_filenames is non-zero, ANSI mode otherwise.
(Fw32_shell_execute): Improve error reporting.
(Fdefault_printer_name): Ifdef away for Cygwin.
src/w32.h (struct _child_process): Remove input_file and
pending_deletion members that are no longer used.
(dostounix_filename, w32_get_short_filename, filename_from_ansi)
(filename_to_ansi, filename_from_utf16, filename_to_utf16)
(ansi_encode_filename): New and updated prototypes.
src/unexw32.c (open_input_file, open_output_file, unexec): Use ANSI
APIs explicitly.
(unexec): Don't use dostounix_filename, it expects a file name in
UTF-8. Instead, mirror backslashes by hand. Convert NEW_NAME to
ANSI encoding.
src/fileio.c (Ffile_name_directory, file_name_as_directory)
(directory_file_name, Fexpand_file_name)
(Fsubstitute_in_file_name) [WINDOWSNT]: Adapt to the change in
arguments of dostounix_filename.
(Fexpand_file_name) [WINDOWSNT]: Convert value of $HOME to UTF-8.
use MAX_UTF8_PATH for size of file-name strings.
(emacs_readlinkat): Build an explicitly unibyte string for file
names.
(syms_of_fileio) <file-name-coding-system>
default-file-name-coding-system>: Mention MS-Windows peculiarities.
src/emacs.c (init_cmdargs) [WINDOWSNT]: Convert argv[0] to UTF-8.
(main) [WINDOWSNT]: Convert the argv[] elements that are files or
directories to UTF-8.
(decode_env_path) [WINDOWSNT]: Convert file names taken from the
environment, and each element of the input PATH, to UTF-8.
src/dired.c (file_attributes): Use build_unibyte_string explicitly
to make Lisp strings from user and group names.
src/coding.h (ENCODE_FILE, DECODE_FILE): Just call encode_file and
decode_file.
src/coding.c (decode_file_name, encode_file_name): New functions.
src/termcap.c (tgetent): Adapt to the change in arguments of
dostounix_filename.
src/sysdep.c (sys_subshell) [WINDOWSNT]: Use MAX_UTF8_PATH for file
names.
src/msdos.c (dostounix_filename, init_environment): Adapt to the
change in arguments of dostounix_filename.
src/image.c (xpm_load, tiff_load, gif_load, imagemagick_load)
[WINDOWSNT]: Encode file names passed to the image libraries in
ANSI codepage.
src/gnutls.c (Fgnutls_boot): Encode all file names passed to GnuTLS.
[WINDOWSNT]: Convert file names to the current ANSI codepage.
src/filelock.c (lock_file) [WINDOWSNT]: Adapt to the change in
arguments of dostounix_filename.
nt/inc/ms-w32.h (MAX_UTF8_PATH): New macro.
(opendir, closedir, readdir, seekdir): Redirect to replacement
functions.
nt/inc/dirent.h: Make d_name[] be MAXNAMELEN*4 characters long.
lisp/term/w32-win.el (w32-handle-dropped-file):
lisp/startup.el (normal-top-level):
lisp/net/browse-url.el (browse-url-file-url):
lisp/dnd.el (dnd-get-local-file-name): On MS-Windows, encode and
decode file names using 'utf-8' rather than
file-name-coding-system.
doc/emacs/mule.texi (File Name Coding): Document file-name encoding
peculiarities on MS-Windows.
doc/lispref/nonascii.texi (Encoding and I/O): Document file-name encoding
peculiarities on MS-Windows.
etc/NEWS: Mention support on MS-Windows of file names outside of the
current locale.
Fixes: debbugs:7100
This allows us to reuse much of the lisp build and installation machinery,
rather than duplicating it.
* Makefile.in (abs_builddir, leimdir): Remove.
(buildlisppath, SUBDIR, COPYDIR, COPYDESTS): No more leim directory.
(epaths-force-w32): No longer set BLD.
(leim): Remove.
(install-arch-indep): No longer run or install leim.
(mostlyclean, clean): No longer run leim rule.
(bootstrap-clean): Change leim target.
(maintainer-clean): Add leim.
(check-declare): Remove leim.
* README: Update for leim changes.
* configure.ac (leimdir): Remove.
(standardlisppath): No more leimdir.
* make-dist: Update for files from leim/ now being in lisp/leim/.
* doc/lispref/loading.texi (Library Search):
* doc/lispref/os.texi (Startup Summary): No more leim directory.
* leim/Makefile.in (leimdir): New variable.
(TIT_GB, TIT_BIG5, MISC, changed.tit, changed.misc)
(${leimdir}/leim-list.el, ${leimdir}/ja-dic/ja-dic.el):
Generate in $leimdir.
(all): Remove compilation, add ja-dic.
(leim-list.el): Now PHONY.
(setwins, compile-targets, compile-main, clean, mostlyclean)
(extraclean): Remove.
(bootstrap-clean): Delete all generated files.
* leim/README: Update for moved leim/ directory.
* leim/leim-ext.el (ucs-input-activate, hangul-input-method-activate):
Remove manual autoloads; now in loaddefs.el.
Disable byte-compile, version-control, autoloads in the output.
* lisp/Makefile.in (setwins_for_subdirs): Skip leim/ directory.
(compile-main): Depend on lisp/leim rule.
(leim): New rule.
* lisp/loadup.el: Move leim-list.el to leim/ subdirectory.
* lisp/startup.el (normal-top-level): No more leim directory.
* lisp/international/ja-dic-cnv.el (skkdic-convert):
Disable version-control and autoloads in output files.
* lisp/international/titdic-cnv.el (titdic-convert, miscdic-convert):
Disable version-control and autoloads in output files.
* lisp/leim/quail: Move here from ../leim.
* lisp/leim/quail/hangul.el (hangul-input-method-activate):
Add autoload cookie.
(generated-autoload-load-name): Set file-local value.
* lisp/leim/quail/uni-input.el (ucs-input-activate): Add autoload cookie.
(generated-autoload-load-name): Set file-local value.
* nt/README.W32:
* nt/addpm.c (env_vars):
* nt/epaths.nt (PATH_LOADSEARCH, PATH_DUMPLOADSEARCH):
* nt/paths.h (PATH_LOADSEARCH): No more leim directory.
* src/Makefile.in (leimdir): Now in lisp source directory.
($(leimdir)/leim-list.el): Just use ../leim .
* src/epaths.in (PATH_DUMPLOADSEARCH):
* src/lread.c (load_path_default):
* src/nsterm.m (ns_load_path): No more leim directory.
* .bzrignore: Update for relocated leim files.
Ref: http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00806.html
* autogen: Remove directory. Move update_autogen to admin/.
* autogen.sh: Remove reference to copy_autogen.
* GNUmakefile (configure):
* Makefile.in (bootstrap): Do not try to run copy_autogen.
* config.bat: Use msdos/autogen rather than autogen.
* admin/update_autogen: Move here from ../autogen.
(usage): Update. Remove -l, add -A.
(autogendir): New variable.
(ldefs_flag): Default to set.
(genfiles): Reduce to only ms-dos relevant files.
(main): Make checking autogen sources optional.
Make copying of autogen files optional.
* msdos/autogen/config.in:
* msdos/autogen/Makefile.in: Move here from ../autogen.
* nt/INSTALL: Remove reference to copy_autogen.
* nt/config.nt: Comment.
nt/inc/mingw_time.h: New file.
nt/inc/ms-w32.h: Include mingw_time.h instead of doing its job.
src/w32proc.c: Include mingw_time.h.
src/w32.c: Include mingw_time.h.
nt/inc/dirent.h (struct dirent) [__MINGW_MAJOR_VERSION >= 4]: Make
the layout of 'struct dirent' be compatible with MinGW32 runtime
versions 4.0 and later.
nt/inc/ms-w32.h (__MINGW_MAJOR_VERSION, __MINGW_MINOR_VERSION)
(__MINGW_PATCHLEVEL) [!__MINGW64_VERSION_MAJOR]: Define, if not
defined, but not for MinGW64.
(_USE_32BIT_TIME_T) [__MINGW64_VERSION_MAJOR]: Define, to force
use of 32-bit time_t type.
Do this by using the Gnulib modules for this.
This should generate faster code on non-GCC, non-MSC platforms,
and make the code a bit more portable, at least in theory.
* admin/merge-gnulib (GNULIB_MODULES): Add count-one-bits
and count-trailing-zeros.
* lib/count-one-bits.c, lib/count-one-bits.h:
* lib/count-trailing-zeros.c, lib/count-trailing-zeros.h:
* m4/count-one-bits.m4, m4/count-trailing-zeros.m4:
New files, copied from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* nt/gnulib.mk: Merge changes from lib/gnulib.mk.
* src/data.c: Include <count-one-bits.h>, <count-trailing-zeros.h>.
(USE_MSC_POPCOUNT, POPCOUNT_STATIC_INLINE)
(NEED_GENERIC_POPCOUNT, popcount_size_t_generic)
(popcount_size_t_msc, popcount_size_t_gcc):
Remove; now done by Gnulib.
(popcount_size_t): Now a macro that defers to Gnulib.
(count_trailing_zero_bits): Return int, for consistency with
Gnulib and because Emacs prefers signed to unsigned int.
Don't assume that size_t is either unsigned int or unsigned long
or unsigned long long.
(size_t_to_host_endian): Do not assume that size_t is either
exactly 32 or exactly 64 bits wide.
* src/lisp.h (BITS_PER_SIZE_T): Define consistently with BITS_PER_LONG
etc., so that it's now an enum constant, not a macro.
No need to assume that it's either 32 or 64.
Fixes: debbugs:15550
* nt/INSTALL: Rename from INSTALL.MSYS.
* nt/INSTALL.OLD: Rename from INSTALL.
* nt/configure.bat: Update for INSTALL name changes.
* make-dist: Update for nt/INSTALL* changes.
src/callproc.c:
src/emacs.c:
src/filelock.c:
src/process.c:
src/sysdep.c:
src/w32.c: Reshuffle Windows-specific headers to avoid errors with
redefinition of fd_set etc.
src/process.c: Don't use num_pending_connects when
NON_BLOCKING_CONNECT is not defined.
src/sysselect.h: Move definitions of FD_* macros and of SELECT_TYPE
here from w32.h.
src/w32proc.c (sys_select): Adjust the argument types to what
thread.h expects.
nt/inc/sys/socket.h: Include stdint.h. Include sysselect.h instead
of w32.h.
nt/mingw-cfg.site (ac_cv_func_mkostemp): New var with value of "yes".
nt/inc/ms-w32.h (mkostemp): Declare prototype.
nt/config.nt (HAVE_MKOSTEMP): Define to 1.
src/w32.c (mkostemp): New function.
(mktemp): Remove, no longer used. Most of the code reused in mkostemp.
Fixes: debbugs:15015
This simplifies Emacs a bit, since it no longer needs to worry
about closing file descriptors by hand in some cases.
It also fixes some unlikely races. Not all such races, as
libraries often open files internally without setting
close-on-exec, but it's an improvement.
* admin/merge-gnulib (GNULIB_MODULES): Add fcntl, pipe2.
(GNULIB_TOOL_FLAGS): Avoid binary-io, close. Do not avoid fcntl.
* configure.ac (mkostemp): New function to check for.
(PTY_OPEN): Pass O_CLOEXEC to posix_openpt.
* lib/fcntl.c, lib/getdtablesize.c, lib/pipe2.c, m4/fcntl.m4:
* m4/getdtablesize.m4, m4/pipe2.m4: New files, taken from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* nt/gnulib.mk: Remove empty gl_GNULIB_ENABLED_verify section;
otherwise, gnulib-tool complains given close-on-exec changes.
* nt/inc/ms-w32.h (pipe): Remove.
* nt/mingw-cfg.site (ac_cv_func_fcntl, gl_cv_func_fcntl_f_dupfd_cloexec)
(gl_cv_func_fcntl_f_dupfd_works, ac_cv_func_pipe2): New vars.
* src/alloc.c (valid_pointer_p) [!WINDOWSNT]:
* src/callproc.c (Fcall_process) [!MSDOS]:
* src/emacs.c (main) [!DOS_NT]:
* src/nsterm.m (ns_term_init):
* src/process.c (create_process):
Use 'pipe2' with O_CLOEXEC instead of 'pipe'.
* src/emacs.c (Fcall_process_region) [HAVE_MKOSTEMP]:
* src/filelock.c (create_lock_file) [HAVE_MKOSTEMP]:
Prefer mkostemp with O_CLOEXEC to mkstemp.
* src/callproc.c (relocate_fd) [!WINDOWSNT]:
* src/emacs.c (main): Use F_DUPFD_CLOEXEC, not plain F_DUPFD.
No need to use fcntl (..., F_SETFD, FD_CLOEXEC), since we're
now using pipe2.
* src/filelock.c (create_lock_file) [! HAVE_MKOSTEMP]:
Make the resulting file descriptor close-on-exec.
* src/lisp.h, src/lread.c, src/process.c (close_load_descs, close_process_descs):
* src/lread.c (load_descriptor_list, load_descriptor_unwind):
Remove; no longer needed. All uses removed.
* src/process.c (SOCK_CLOEXEC): Define to 0 if not supplied by system.
(close_on_exec, accept4, process_socket) [!SOCK_CLOEXEC]:
New functions.
(socket) [!SOCK_CLOEXEC]: Supply a substitute.
(Fmake_network_process, Fnetwork_interface_list):
(Fnetwork_interface_info, server_accept_connection):
Make newly-created socket close-on-exec.
* src/sysdep.c (emacs_open, emacs_fopen):
Make new-created descriptor close-on-exec.
* src/w32.c (fcntl): Support F_DUPFD_CLOEXEC well enough for Emacs.
* src/w32.c, src/w32.h (pipe2): Rename from 'pipe', with new flags arg.
Fixes: debbugs:14803
nt/INSTALL.MSYS: mingw-get is not a GUI program (yet).
msys-automake is not suitable for MinGW builds. Mention the
--enable-locallisppath switch to msysconfig.sh. Suggested by
׃scar Fuentes <ofv@wanadoo.es>.
Makefile.in (msys_to_w32): Modify to support d:\foo file names.
(msys_lisppath_to_w32, msys_prefix_subst, msys_sed_sh_escape): New
variables.
(epaths-force-w32): Use them.
epaths.nt (PATH_SITELOADSEARCH): Fix commentary.
epaths.in: Fix commentary to PATH_SITELOADSEARCH.
lib/Makefile.am: If building for MS-Windows, include
nt/gnulib.mk instead of lib/gnulib.mk.
configure.ac: Adapt to MSYS build on MS-Windows.
Makefile.in (NTDIR): New variable, for the MSYS build on
MS-Windows.
(SUBDIR): Add $(NTDIR).
(.PHONY): Add epaths-force-w32.
(msys_to_w32): New variable.
(epaths-force-w32, install-nt, uninstall-nt): New targets.
(lib-src src): Add $(NTLIB) to prerequisites.
(lib lib-src lisp leim nt): Add 'nt'.
(config.status): Use $(CFG).
(.PHONY): Add install-$(NTDIR) and uninstall-$(NTDIR).
(install, install-arch-dep): Add install-$(NTDIR).
(uninstall): Depend on uninstall-$(NTDIR).
(mostlyclean, clean, distclean, bootstrap-clean): Add 'nt'.
* GNUmakefile (CFG): New variable, uses mingw-cfg.site as
CONFIG_SITE for the MSYS build on MS-Windows.
(Makefile): Use $(CFG).
.bzrignore: Ignore *.res, *.tmp, and *.map. Remove
src/emacs.res.
etc/NEWS: Advertise the MSYS build on MS-Windows.
leim/Makefile.in (leim-list.el, check-declare): Use reveal-filename.
lib-src/update-game-score.c [WINDOWSNT]: Include "ntlib.h".
lib-src/ntlib.h (sleep): Update prototype.
(geteuid): Add prototype.
lib-src/ntlib.c (sleep): Now returns an unsigned value.
(getgid): New function.
lib-src/Makefile.in (CLIENTW, LIB_WSOCK32, LIBS_ECLIENT, NTLIB)
(CLIENTRES, WINDRES, NTINC, NTDEPS): New variables.
(INSTALLABLES): Add $(CLIENTW).
(LIBS_MOVE): Use $(LIB_WSOCK32).
($(DESTDIR)${archlibdir}): Use $(EXEEXT) on update-game-score.
(test-distrib${EXEEXT}): Use $(EXEEXT) on test-distrib.
(etags${EXEEXT}, ebrowse${EXEEXT}, ctags${EXEEXT})
(profile${EXEEXT}, make-docfile${EXEEXT}, movemail${EXEEXT})
(emacsclient${EXEEXT}, hexl${EXEEXT}, update-game-score${EXEEXT}):
Add $(NTLIB) to prerequisites. Use $(EXEEXT).
(pop.o): Add pop.h to prerequisites.
(emacsclientw${EXEEXT}, ntlib.o): New targets.
(emacsclient.res): New target.
lisp/subr.el (reveal-filename): New function.
lisp/loadup.el: Compute Emacs executable versions on MS-Windows,
where executables have the .exe extension. Add a hard link
emacs-XX.YY.ZZ.exe on MS-Windows.
lisp/Makefile.in (XARGS_LIMIT): New variable.
(custom-deps, finder-data, autoloads)
($(MH_E_DIR)/mh-loaddefs.el, $(TRAMP_DIR)/tramp-loaddefs.el)
($(CAL_DIR)/cal-loaddefs.el, $(CAL_DIR)/diary-loaddefs.el)
($(CAL_DIR)/hol-loaddefs.el): Use reveal-filename.
(compile-main): Limit xargs according to $(XARGS_LIMIT).
nt/msysconfig.sh: New file.
nt/mingw-cfg.site: New file.
nt/makefile.w32-in (LOCAL_FLAGS): Add -DOLD_PATHS=1.
nt/inc/unistd.h: Include pwd.h and sys/types.h.
nt/inc/sys/time.h (_TIMEVAL_DEFINED, timerisset, timercmp)
(timerclear): Define.
(gettimeofday): Adjust signature to be Posix compatible, by using
the 'restrict' keyword.
nt/inc/sys/stat.h (UTIME_NOW, UTIME_OMIT): Define.
(struct _stat, struct _stati64): Define.
nt/inc/sys/socket.h (timeval): Define only for MSVC.
(FD_SET, FD_CLR, FD_ISSET, fd_set): Redefine only if
EMACS_CONFIG_H is defined.
(timeval): Undefine only for MSVC.
nt/inc/ms-w32.h (HAVE___BUILTIN_UNWIND_INIT, restrict)
(HAVE_WINDOW_SYSTEM, HAVE_MENUS, EMACS_CONFIGURATION)
(EMACS_CONFIG_OPTIONS, HAVE_LONG_LONG_INT)
(HAVE_UNSIGNED_LONG_LONG_INT): Define only if not already defined.
(fileno): Move definition after including stdio.h.
(sigset_t): Guard typedef by _W64.
nt/gnulib.mk: New file.
nt/epaths.nt: New file.
nt/addpm.c [!OLD_PATHS]: Include src/epaths.h, instead of having a
copy of the file names there.
<env_vars> [!OLD_PATHS]: Use macros from epaths.h instead of
literal strings.
nt/Makefile.in: New file.
nt/INSTALL.MSYS: New file.
nt/INSTALL: Mention INSTALL.MSYS.
src/w32.c: Include epaths.h.
(init_environment): Use cmdproxy.exe without leading directories.
Support emacs.exe in src; point SHELL to cmdproxy in ../nt in that
case.
(gettimeofday): Adjust signature and return value to Posix
expectations.
src/unexw32.c (open_output_file): Delete the existing emacs.exe
before creating it, to break the hard link to the versioned
executable.
src/Makefile.in (EMACS_MANIFEST, CM_OBJ, TEMACS_POST_LINK)
(ADDSECTION, EMACS_HEAPSIZE, MINGW_TEMACS_POST_LINK)
(FIRSTFILE_OBJ): New variables.
(W32_RES): Rename to EMACSRES. All users changed.
(base_obj): Use $(CM_OBJ).
(ALLOBJS): Use $(FIRSTFILE_OBJ).
(emacs$(EXEEXT)): Depend on $(ADDSECTION).
(temacs$(EXEEXT)): Use $(TEMACS_POST_LINK), and move
$(W32_RES_LINK) before $(LIBES).
(emacs.res): Depend on $(EMACS_MANIFEST). Put emacs.rc in nt.
* lisp/loadup.el: Just use unversioned DOC.
* Makefile.in (install-doc): DOC file is not version specific any more.
* .bzrignore: Don't ignore DOC-* any more.
* admin/quick-install-emacs: Don't prune DOC-* files a any more.
* doc/lispref/loading.texi (Autoload):
* doc/lispref/help.texi (Documentation Basics, Accessing Documentation)
(Accessing Documentation, Accessing Documentation): DOC-* is now DOC.
* etc/.gitignore: Don't ignore DOC-* any more.
* lib-src/makefile.w32-in ($(DOC)): Use DOC rather than DOC-X.
* msdos/sed1x.inp: Don't rewrite DOC any more.
* nt/makefile.w32-in (clean, top-distclean): DOC-X doesn't exist any more.
* src/Makefile.in (bootstrap-clean): DOC-* doesn't exist any more.
* src/makefile.w32-in (DOC): Use just "DOC".
* configure.ac: Remove -with-acl option, since Gnulib does that for
us now.
(LIBACL_LIBS): Remove; no longer needed.
* lib/Makefile.am (CLEANFILES, SUFFIXES): New (empty) macros,
for the benefit of the new ACL implementation.
* lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/acl-errno-valid.$(O).
($(BLD)/acl-errno-valid.$(O)): New rule.
* lib/acl-errno-valid.c, lib/acl-internal.h, lib/acl.h:
* lib/acl_entries.c, lib/errno.in.h, lib/file-has-acl.c:
* lib/qcopy-acl.c, lib/qset-acl.c, m4/acl.m4, m4/errno_h.m4:
New files, taken from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Add qacl.
(GNULIB_TOOL_FLAGS): Do not avoid errno.
* etc/NEWS: Emacs is no longer limited to POSIX ACLs. --disable-acl,
not --without-acl, since we're now using Gnulib's implementation.
* nt/config.nt (HAVE_ACL_SET_FILE): Rename from HAVE_POSIX_ACL.
* nt/inc/ms-w32.h (EOPNOTSUPP): New macro.
* src/Makefile.in (LIB_ACL): New macro.
(LIBACL_LIBS): Remove.
(LIBES): Use LIB_ACL, not LIBACL_LIBS.
* src/fileio.c: Include <acl.h>.
Use HAVE_ACL_SET_FILE rather than HAVE_POSIX_ACL.
(ACL_NOT_WELL_SUPPORTED): Remove. All uses replaced by
!acl_errno_valid.
(Fcopy_file) [!WINDOWSNT]: Use qcopy_acl instead of rolling
it ourselves.
Fixes: debbugs:14295
* nt/emacs.rc: Use 64-bit manifest for 64-bit Cygwin build.
* configure.ac (W32_RES_LINK): Remove unnecessary linker directive
`-Wl,-bpe-i386', which is confusing in the 64-bit case.
Added emacsclient.res support to lib-src/.
Fixed temacs and dumping commands in src/Makefile.in.
Miscellaneous fixes all over the place.
Not tried to build yet.
nt/README: A better documentation of ddeclient.exe.
nt/README.W32: A better documentation of ddeclient.exe.
nt/paths.h (PATH_EXEC): Add nt/oo-spd/i386 and nt/oo/i386
subdirectories.
nt/makefile.w32-in (ALL): Depend on *.exe files, not on phony names
without the .exe suffix.
(addpm, ddeclient, cmdproxy, addsection, preprep): Remove phony
targets.
(.PHONY): Remove.
nt/addsection.c (_ANONYMOUS_UNION, _ANONYMOUS_STRUCT): Do not
define for MinGW64.
nt/preprep.c (_ANONYMOUS_UNION, _ANONYMOUS_STRUCT): Do not define
for MinGW64.
Reported by ׃scar Fuentes in
http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00733.html
nt/inc/ms-w32.h (_WIN32_WINNT) [!_W64]: Don't define for MinGW64.
nt/inc/sys/stat.h (chmod): Remove _CRTIMP from prototype.
src/w32.c (_PROCESS_MEMORY_COUNTERS_EX) [_WIN32_WINNT < 0x0500]:
Define only for _WIN32_WINNT less than 0x0500.
Reported by ׃scar Fuentes in
http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00699.html
and in
http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00707.html.
nt/inc/ms-w32.h (USE_NO_MINGW_SETJMP_TWO_ARGS) [_W64]: Define to 1.
For MinGW64, include sys/types.h and time.h.
nt/inc/sys/time.h (struct timeval) [!_W64]: Guard definition with _W64.
(struct timezone) [!_TIMEZONE_DEFINED]: Guard definition with
_TIMEZONE_DEFINED.
nt/addpm.c (_WIN32_IE) [_W64]: For MinGW64, don't define to 0x400.
nt/inc/sys/stat.h: Remove _CRTIMP from prototypes of fstat, stat,
lstat, and fstatat.
lib-src/ntlib.c (struct timespec) [!_TIMEZONE_DEFINED]: Define the
struct only if _TIMEZONE_DEFINED is not defined.
src/w32term.c (WCRANGE, GLYPHSET): Don't define if _W64 is defined.
src/w32.c (REPARSE_DATA_BUFFER): Guard with
MAXIMUM_REPARSE_DATA_BUFFER_SIZE being defined.
Problems were reported by ׃scar Fuentes in
http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00611.html.
nt/inc/ms-w32.h (struct timespec): Don't define if
_TIMESPEC_DEFINED is already defined.
(sigset_t) [!_POSIX]: Typedef for MinGW64.
(_WIN32_WINNT, WIN32_LEAN_AND_MEAN): Move definitions before
including the first system header, to avoid redefinition if some
system header defines a default value.
nt/inc/sys/time.h (struct itimerval): Don't define if
_TIMESPEC_DEFINED is already defined.
* admin/CPP-DEFINES (BSD_SYSTEM, HAVE_FSYNC): Remove.
* admin/merge-gnulib (GNULIB_MODULES): Add fsync, fdatasync.
* configure.ac (BSD_SYSTEM, BSD_SYSTEM_AHB): Remove; no longer needed.
(fsync): Remove check; now done by gnulib.
* lib/fdatasync.c, lib/fsync.c, m4/fdatasync.m4, m4/fsync.m4:
New files, from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib-src/Makefile.in (LIB_FDATASYNC): New macro.
(emacsclient${EXEEXT}): Use it.
* lib-src/emacsclient.c (main): Use fdatasync, not fsync, since we don't
care about metadata. Keep trying if interrupted.
* lib-src/movemail.c (main, popmail): Don't worry about BSD_SYSTEM, since
fsync is available everywhere (or there is a substitute). Don't
report an error if fsync returns EINVAL.
* nt/inc/ms-w32.h (fdatasync): New macro, suggested by Eli Zaretskii.
* src/Makefile.in (LIB_FDATASYNC): New macro.
(LIBES): Use it.
* src/conf_post.h (BSD_SYSTEM, BSD_SYSTEM_AHB): Remove; no longer needed.
* src/fileio.c (Fwrite_region, write_region_inhibit_fsync):
Don't worry about HAVE_FSYNC, since a substitute fsync is
available if the system lacks one.
(Fwrite_regin): Retry fsync if interrupted.
Fixes: debbugs:13944
* etc/NEWS: Document this.
* nt/inc/unistd.h (O_NOFOLLOW): New macro.
* src/filelock.c: Include <c-ctype.h>.
(MAX_LFINFO): New top-level constant.
(lock_info_type): Remove members pid, boot_time. Add members at,
dot, colon. Change user member to be the entire buffer, not a
pointer. This allows us to handle the case where a foreign
pid or boot time exceeds the local range. All uses changed.
(LINKS_MIGHT_NOT_WORK): New constant.
(FREE_LOCK_INFO): Remove, as the pieces no longer need freeing.
(defined_WINDOWSNT): Remove.
(MAKE_LOCK_NAME, file_in_lock_file_name):
Always use .#FILE (not .#-FILE) for the file lock,
even if it is a regular file.
(rename_lock_file): New function.
(create_lock_file): Use it.
(create_lock_file, read_lock_data):
Prefer a symbolic link for the lock file, falling back on a
regular file if symlinks don't work. Do not try to create
symlinks on MS-Windows, due to security hassles. Stick with
POSIXish functions (open, read, write, close, fchmod, readlink, symlink,
link, rename, unlink, mkstemp) when creating locks, as a GNUish
host may be using a Windowsish file system, and cannot use
MS-Windows-only system calls. Fall back on mktemp if mkstemp
doesn't work. Don't fail merely because of a symlink-contents
length limit in the current file system; fall back on regular
files. Increase the symlink contents length limit to 8 KiB, this
should be big enough for any real use and doesn't crunch the
stack.
(create_lock_file, lock_file_1, read_lock_data):
Simplify allocation of lock file buffers now that they fit in 8 KiB.
(lock_file_1): Return error number, not bool. All callers changed.
(ELOOP): New macro, if not already defined.
(read_lock_data): Return size of lock file contents, not Lisp object.
All callers changed. Handle a race condition if some other process
replaces a regular-file lock with a symlink lock or vice versa,
while we're trying to read the lock.
(current_lock_owner): Parse contents more carefully, to help avoid
confusing a regular-file lock with some other application's use
of the file. Check for lock file contents being too long, or
not parsing correctly.
(current_lock_owner, lock_file):
Allow foreign pid and boot times that exceed the local range.
(current_lock_owner, lock_if_free, lock_file):
Simplify allocation of lock file contents.
* src/w32.c (sys_rename_replace): New function, containing most of
the contents of the old sys_rename.
(sys_rename): Use it.
(fchmod): New dummy function.
* src/w32.h (sys_rename_replace, fchmod): New decls.
Fixes: debbugs:13807
src/filelock.c [WINDOWSNT]: Include w32.h.
(MAKE_LOCK_NAME): Don't use 'lock', it clashes with MS runtime
function of that name. Up-case the macro arguments.
(IS_LOCK_FILE): New macro.
(fill_in_lock_file_name): Use IS_LOCK_FILE instead of S_ISLNK.
(create_lock_file): New function, with body extracted from
lock_file_1.
[WINDOWSNT]: Implement lock files by writing a regular file with
the lock information as its contents.
(read_lock_data): New function, on Posix platforms just calls
emacs_readlinkat.
[WINDOWSNT]: Read the lock info from the file.
(current_lock_owner): Call read_lock_data instead of calling
emacs_readlinkat directly.
(lock_file) [WINDOWSNT]: Run the file name through
dostounix_filename.
src/w32proc.c (sys_kill): Support the case of SIG = 0, in which case
just check if the process by that PID exists.
src/w32.c (sys_open): Don't reset the _O_CREAT flag if _O_EXCL is
also present, as doing so will fail to error out if the file
already exists.
src/makefile.w32-in ($(BLD)/filelock.$(O)): Depend on src/w32.h.
nt/inc/ms-w32.h (BOOT_TIME_FILE): Define.
nt/config.nt (CLASH_DETECTION): Define to 1.
lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Reject files
that match "\`\.#", to avoid compiling lock files, even if they
are readable (as they are on MS-Windows).
doc/emacs/files.texi (Interlocking): Don't refer to symlinks as the
exclusive means of locking files.
etc/NEWS: Mention support for lock files on MS-Windows.
On my host, this speeds up directory-files-and-attributes by a
factor of 3, when applied to Emacs's src directory.
These functions are standardized by POSIX and are common these
days; fall back on a (slower) gnulib implementation if the host
is too old to supply them.
* .bzrignore: Add lib/dirent.h.
* lib/Makefile.am (libgnu_a_SOURCES): Add openat-die.c, save-cwd.c.
* lib/careadlinkat.c, lib/careadlinkat.h: Merge from gnulib,
incorporating: 2013-01-29 careadlinkat: do not provide careadlinkatcwd.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/dirent.in.h, lib/fdopendir.c, lib/fstatat.c, lib/openat-priv.h:
* lib/openat-proc.c, lib/openat.h, m4/dirent_h.m4, m4/fdopendir.m4:
* m4/fstatat.m4: New files, from gnulib.
* lib/openat-die.c, lib/save-cwd.c, lib/save-cwd.h: New files.
These last three are specific to Emacs and are not copied from gnulib.
They are simpler than the gnulib versions and are tuned for Emacs.
* admin/merge-gnulib (GNULIB_MODULES): Add fdopendir, fstatat, readlinkat.
(GNULIB_TOOL_FLAGS): Do not avoid at-internal, openat-h.
Avoid dup, open, opendir.
* nt/inc/sys/stat.h (fstatat):
* nt/inc/unistd.h (readlinkat): New decls.
* src/conf_post.h (GNULIB_SUPPORT_ONLY_AT_FDCWD): Remove.
* src/dired.c: Include <fcntl.h>.
(open_directory): New function, which uses open and fdopendir
rather than opendir. DOS_NT platforms still use opendir, though.
(directory_files_internal, file_name_completion): Use it.
(file_attributes): New function, with most of the old Ffile_attributes.
(directory_files_internal, Ffile_attributes): Use it.
(file_attributes, file_name_completion_stat): First arg is now fd,
not dir name. All uses changed. Use fstatat rather than lstat +
stat.
(file_attributes): Use emacs_readlinkat rather than Ffile_symlink_p.
* src/fileio.c: Include <allocator.h>, <careadlinkat.h>.
(emacs_readlinkat): New function, with much of the old
Ffile_symlink_p, but with an fd argument for speed.
It uses readlinkat rather than careadlinkatcwd, so that it
need not assume the working directory.
(Ffile_symlink_p): Use it.
* src/filelock.c (current_lock_owner): Use emacs_readlinkat
rather than emacs_readlink.
* src/lisp.h (emacs_readlinkat): New decl.
(READLINK_BUFSIZE, emacs_readlink): Remove.
* src/sysdep.c: Do not include <allocator.h>, <careadlinkat.h>.
(emacs_norealloc_allocator, emacs_readlink): Remove.
This stuff is moved to fileio.c.
* src/w32.c (fstatat, readlinkat): New functions.
(careadlinkat): Don't check that fd == AT_FDCWD.
(careadlinkatcwd): Remove; no longer needed.
Fixes: debbugs:13539
nt/inc/sys/stat.h (S_ISMPX): Define to zero, to accommodate changes
in lib/filemode.c that broke the MS-Windows build.
Suggested by Andy Moreton <andrewjmoreton@gmail.com>.
src/w32.c: Include sddl.h and sys/acl.h.
(SDDL_REVISION_1): Define if not already defined.
(g_b_init_get_security_descriptor_dacl)
(g_b_init_convert_sd_to_sddl, g_b_init_convert_sddl_to_sd)
(g_b_init_is_valid_security_descriptor)
(g_b_init_set_file_security): New static flags.
(globals_of_w32): Initialize them to zero.
(SetFileSecurity_Name): New string constant.
(SetFileSecurity_Proc, GetSecurityDescriptorDacl_Proc)
(ConvertStringSecurityDescriptorToSecurityDescriptor_Proc)
(ConvertSecurityDescriptorToStringSecurityDescriptor_Proc)
(IsValidSecurityDescriptor_Proc): New typedefs.
(get_file_security, get_security_descriptor_owner)
(get_security_descriptor_group): Set errno to ENOTSUP.
(set_file_security, get_security_descriptor_dacl)
(is_valid_security_descriptor, convert_sd_to_sddl)
(convert_sddl_to_sd, acl_valid, acl_to_text, acl_from_text)
(acl_free, acl_get_file, acl_set_file): New functions.
src/fileio.c (Fcopy_file) [WINDOWSNT]: Support copying ACLs.
nt/inc/sys/acl.h: New file.
nt/inc/ms-w32.h (ENOTSUP): Define if undefined.
nt/config.nt (HAVE_POSIX_ACL): Define.
doc/lispref/files.texi (File Attributes, Changing Files): Update to include
MS-Windows support for ACLs.
src/w32.h (_child_process): New members input_file and
pending_deletion.
(register_child): First argument is now pid_t.
(record_infile, record_pending_deletion): New prototypes.
src/w32proc.c (new_child): Initialize input_file and
pending_deletion members of the child.
(delete_child): Delete the child's temporary input file, if any,
that is pending deletion.
(register_child): First argument is now pid_t.
(record_infile, record_pending_deletion): New functions.
(reap_subprocess): Fix a typo in DebPrint string.
(sys_spawnve, sys_kill): Use pid_t for PID arguments.
src/fileio.c (internal_delete_file): Return an int again: non-zero
if delete-file succeeds, zero otherwise.
src/lisp.h (internal_delete_file): Adjust prototype.
src/callproc.c (Fcall_process): Don't overwrite infile with result
of DECODE_FILE.
[WINDOWSNT] If BUFFER is an integer, i.e. we are launching an
asynchronous subprocess, record the name of the input file name,
if any.
(delete_temp_file) [WINDOWSNT]: If internal_delete_file fails to
delete the file, record it as pending deletion when the subprocess
exits.
nt/inc/ms-w32.h (sys_unlink): Provide prototype.
src/w32.c (stat_worker): If w32_stat_get_owner_group is zero, do not
try to get accurate owner and group information from NT file
security APIs. This is to make most callers of 'stat' and
'lstat', which don't need that information, much faster.
src/dired.c (Ffile_attributes) [WINDOWSNT]: Set
w32_stat_get_owner_group to a non-zero value, to request accurate
owner and group information from 'lstat'.
nt/inc/sys/stat.h: Declare w32_stat_get_owner_group.