1. 22 Nov, 2012 2 commits
  2. 21 Nov, 2012 2 commits
    • Paul Eggert's avatar
      Assume POSIX 1003.1-1988 or later for unistd.h. · 9239d970
      Paul Eggert authored
      * admin/CPP-DEFINES (BROKEN_GETWD, HAVE_GETCWD, HAVE_GETWD, HAVE_SIZE_T)
      (HAVE_UNISTD_H): Remove.
      * configure.ac: Do not check for getcwd or getwd.
      * lib-src/emacsclient.c (getcwd): Remove decl.
      (get_current_dir_name): Assume getcwd exists.
      * lib-src/etags.c (HAVE_GETCWD): Remove.
      (getcwd): Remove decl.
      (NO_LONG_OPTIONS): Remove this.  All uses removed.
      Emacs always has GNU getopt.
      (etags_getcwd): Assume getcwd exists.
      * lib-src/movemail.c (F_OK, X_OK, W_OK, R_OK): Remove.
      * nt/config.nt (HAVE_GETCWD): Remove.
      * src/alloc.c: Assume unistd.h exists.
      * src/fileio.c (Fexpand_file_name) [DOS_NT]: Use getcwd, not getwd.
      * src/sysdep.c (get_current_dir_name): Assume getcwd exists.
      (getwd) [USG]: Remove; no longer needed.
      (sys_subshell) [DOS_NT]: Use getcwd, not getwd.
      * src/w32.c (getcwd): Rename from getwd, and switch to getcwd's API.
      * src/w32.h (getcwd): Remove decl.
      
      Fixes: debbugs:12945
      9239d970
    • Stefan Monnier's avatar
      * src/xdisp.c (fast_set_selected_frame): Rename from update_tool_bar_unwind. · 954bba56
      Stefan Monnier authored
      Make it set selected_window as well.
      (update_tool_bar): Use it.
      954bba56
  3. 20 Nov, 2012 7 commits
  4. 19 Nov, 2012 2 commits
  5. 18 Nov, 2012 3 commits
  6. 17 Nov, 2012 8 commits
    • Juanma Barranquero's avatar
      lib-src/makefile.w32-in, src/makefile.w32-in: Update dependencies. · a75ce9d3
      Juanma Barranquero authored
      * lib-src/makefile.w32-in (SYSWAIT_H): New macro.
      ($(BLD)/movemail.$(O)): Update dependencies.
      
      * src/makefile.w32-in (SYSWAIT_H): New macro.
      ($(BLD)/callproc.$(O), $(BLD)/w32proc.$(O), $(BLD)/process.$(O))
      ($(BLD)/sysdep.$(O)): Update dependencies.
      a75ce9d3
    • Paul Eggert's avatar
      Assume POSIX 1003.1-1988 or later for fcntl.h. · 49cdacda
      Paul Eggert authored
      * admin/CPP-DEFINES (O_RDONLY, O_RDWR, HAVE_FCNTL_H): Remove.
      * admin/merge-gnulib (GNULIB_MODULES): Add fcntl-h.
      * configure.ac: Do not check for fcntl.h.
      * lib/gnulib.mk: Regenerate.
      * lib-src/movemail.c, lib-src/update-game-score.c: Assume <fcntl.h> exists.
      * nt/inc/sys/socket.h (O_NONBLOCK): Rename from O_NDELAY, since the
      POSIX name for this flag is O_NONBLOCK.  All uses changed.
      * nt/inc/unistd.h (O_RDWR, O_NOCTTY): New macros.  Like AT_FDCWD etc.
      these really should be moved to a replacement <fcntl.h> if and
      when that gets implemented.  In the meantime, include <fcntl.h>
      to make sure we don't override its definitions.
      * src/callproc.c (relocate_fd): Assume F_DUPFD.
      * src/emacs.c, src/term.c (O_RDWR): Remove.
      * src/keyboard.c (tty_read_avail_input): Use O_NONBLOCK rather than
      O_NDELAY, since O_NONBLOCK is the standard name for this flag.
      * src/nsterm.m: Assume <fcntl.h> exists.
      * src/process.c (NON_BLOCKING_CONNECT, allocate_pty, create_process)
      (create_pty, Fmake_network_process, server_accept_connection)
      (wait_reading_process_output, init_process_emacs):
      Assume O_NONBLOCK.
      (wait_reading_process_output): Put in a special case for WINDOWSNT
      to mimick the older behavior where it had O_NDELAY but not O_NONBLOCK.
      It's not clear this is needed, but it's a more-conservative change.
      (create_process): Assume FD_CLOEXEC.
      (create_process, create_pty): Assume O_NOCTTY.
      * src/sysdep.c (init_sys_modes, reset_sys_modes): Assume F_SETFL.
      (reset_sys_modes): Use O_NONBLOCK rather than O_NDELAY.
      Omit if not DOS_NT, since F_GETFL is not defined there.
      (serial_open): Assume O_NONBLOCK and O_NOCTTY.
      * src/term.c: Include <fcntl.h>, for flags like O_NOCTTY.
      (O_NOCTTY): Remove.
      (init_tty): Assume O_IGNORE_CTTY is defined to 0 on platforms that
      lack it, since gnulib guarantees this.
      * src/w32.c (fcntl): Test for O_NONBLOCK rather than O_NDELAY.
      
      Fixes: debbugs:12881
      49cdacda
    • Eli Zaretskii's avatar
      Fix bug #12878 with compilation failure with Visual C++ 11.0. · d8715cdf
      Eli Zaretskii authored
       src/w32select.c: Include w32common.h before w32term.h, so that
       windows.h gets included before w32term.h uses some of its
       features, see below.
       src/w32term.h (LOCALE_ENUMPROCA, LOCALE_ENUMPROCW) [_MSC_VER]: New
       typedefs.
       (EnumSystemLocalesA, EnumSystemLocalesW) [_MSC_VER]: New
       prototypes.
       (EnumSystemLocales) [_MSC_VER]: Define if undefined.
      d8715cdf
    • Paul Eggert's avatar
      Update comment to match recent change. · 9fa3ccd9
      Paul Eggert authored
      9fa3ccd9
    • Eli Zaretskii's avatar
      Fix MS-Windows emulation of 'faccessat' wrt directories. · 6ad30855
      Eli Zaretskii authored
       src/w32.c (faccessat): Pretend that directories have the execute bit
       set.  Emacs expects that, e.g., in files.el:cd-absolute.
      6ad30855
    • Eli Zaretskii's avatar
      Fix bug #12829 with aborts on MS-Windows when several child processes die. · 22bae83f
      Eli Zaretskii authored
       nt/inc/sys/wait.h: New file, with prototype of waitpid and
       definitions of macros it needs.
       nt/inc/ms-w32.h (wait): Don't define, 'wait' is not used anymore.
       (sys_wait): Remove prototype.
       nt/config.nt (HAVE_SYS_WAIT_H): Define to 1.
      
       src/w32proc.c (create_child): Don't clip the PID of the child
       process to fit into an Emacs integer, as this is no longer a
       restriction.
       (waitpid): Rename from sys_wait.  Emulate a Posix 'waitpid' by
       reaping only the process specified by PID argument, if that is
       positive.  Use PID instead of dead_child to know which process to
       reap.  Wait for the child to die only if WNOHANG is not in
       OPTIONS.
       (sys_select): Don't set dead_child.
       src/sysdep.c (wait_for_termination_1): Remove the WINDOWSNT portion,
       as it is no longer needed.
       src/process.c (waitpid, WUNTRACED) [!WNOHANG]: Remove definitions,
       no longer needed.
       (record_child_status_change): Remove the setting of
       record_at_most_one_child for the !WNOHANG case.
      22bae83f
    • Jan Djärv's avatar
      * nsterm.m (hold_event): Set send_appdefined to YES. · 7436fc63
      Jan Djärv authored
      (ns_select): Return at once if events are held (Bug#12834).
      7436fc63
    • Paul Eggert's avatar
      Fix problems in ns port found by static checking. · a631d0e0
      Paul Eggert authored
      * nsterm.m: Include <pthread.h>, for pthread_mutex_lock etc.
      (hold_event, setPosition:portion:whole:): Send SIGIO only to self,
      not to process group.
      (ns_select): Use emacs_write, not write, as that's more robust
      in the presence of signals.
      (fd_handler:): Check for read errors.
      a631d0e0
  7. 16 Nov, 2012 3 commits
  8. 15 Nov, 2012 4 commits
  9. 14 Nov, 2012 4 commits
    • Eli Zaretskii's avatar
      MS-Windows followup for 2012-11-14T04:55:41Z!eggert@cs.ucla.edu, regarding faccessat. · 14f20728
      Eli Zaretskii authored
       nt/inc/unistd.h (faccessat): Add prototype.
       (AT_FDCWD, AT_EACCESS, AT_SYMLINK_NOFOLLOW): New macros; the first
       2 moved from ms-w32.h.
       nt/inc/ms-w32.h (AT_FDCWD, AT_EACCESS, faccessat): Remove macros.
      
       src/w32.c (faccessat): Rename from sys_faccessat.  (No need to use a
       different name, as the MS runtime does not have such a function,
       and probably never will.)  All callers changed.  Ignore DIRFD
       value if PATH is an absolute file name, to match Posix spec
       better.  If AT_SYMLINK_NOFOLLOW is set in FLAGS, don't resolve
       symlinks.
      
      Fixes: debbugs:12632
      14f20728
    • Eli Zaretskii's avatar
      Clean up w32 timer thread code in the hope of solving bug #12832. · 730b2d8f
      Eli Zaretskii authored
       src/w32proc.c (timer_loop): Make sure SuspendThread and ResumeThread
       use the same value of thread handle.
       (start_timer_thread): If the timer thread exited (due to error),
       clean up by closing the two handles it used.  Duplicate the caller
       thread's handle here, so it gets duplicated only once, when
       launching the timer thread.  Set priority of the timer thread, not
       the caller thread.
       (getitimer): Don't duplicate the caller thread's handle here.
      730b2d8f
    • Dmitry Antipov's avatar
      * xdisp.c (echo_area_display, redisplay_internal): · 77731919
      Dmitry Antipov authored
      Omit redundant check whether frame_garbaged is set.
      77731919
    • Paul Eggert's avatar
      Use faccessat, not access, when checking file permissions. · 73dcdb9f
      Paul Eggert authored
      This fixes a bug that has been present in Emacs since its creation.
      It was reported by Chris Torek in 1983 even before GNU Emacs existed,
      which must set some sort of record.  (Torek's bug report was against
      a predecessor of GNU Emacs, but GNU Emacs happened to have the
      same common flaw.)  See Torek's Usenet posting
      "setuid/setgid programs & Emacs" Article-I.D.: sri-arpa.858
      Posted: Fri Apr  8 14:18:56 1983.
      * .bzrignore: Add lib/fcntl.h.
      * configure.ac (euidaccess): Remove check; gnulib does this for us now.
      (gl_FCNTL_O_FLAGS): Define a dummy version.
      * lib/at-func.c, lib/euidaccess.c, lib/faccessat.c, lib/fcntl.in.h:
      * lib/getgroups.c, lib/group-member.c, lib/root-uid.h:
      * lib/xalloc-oversized.h, m4/euidaccess.m4, m4/faccessat.m4:
      * m4/fcntl_h.m4, m4/getgroups.m4, m4/group-member.m4:
      New files, from gnulib.
      * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
      * admin/merge-gnulib (GNULIB_MODULES): Add faccessat.
      (GNULIB_TOOL_FLAGS): Avoid at-internal, fchdir, malloc-posix,
      openat-die, openat-h, save-cwd.  Do not avoid fcntl-h.
      Omit gnulib's m4/fcntl-o.m4.
      * nt/inc/ms-w32.h (AT_FDCWD, AT_EACCESS): New symbols.
      (access): Remove.
      (faccessat): New macro.
      * src/Makefile.in (LIB_EACCESS): New macro.
      (LIBES): Use it.
      * src/callproc.c (init_callproc):
      * src/charset.c (init_charset):
      * src/fileio.c (check_existing, check_executable, check_writable)
      (Ffile_readable_p):
      * src/lread.c (openp, load_path_check):
      * src/process.c (allocate_pty):
      * src/xrdb.c (file_p):
      Use effective UID when checking permissions, not real UID.
      * src/callproc.c (init_callproc):
      * src/charset.c (init_charset):
      * src/lread.c (load_path_check, init_lread):
      Test whether directories are accessible, not merely whether they exist.
      * src/conf_post.h (GNULIB_SUPPORT_ONLY_AT_FDCWD): New macro.
      * src/fileio.c (check_existing, check_executable, check_writable)
      (Ffile_readable_p):
      Use symbolic names instead of integers for the flags, as they're
      portable now.
      (check_writable): New arg AMODE.  All uses changed.
      Set errno on failure.
      (Ffile_readable_p): Use faccessat, not stat + open + close.
      (Ffile_writable_p): No need to call check_existing + check_writable.
      Just call check_writable and then look at errno.  This saves a syscall.
      dir should never be nil; replace an unnecessary runtime check
      with an eassert.  When checking the parent directory of a nonexistent
      file, check that the directory is searchable as well as writable, as
      we can't create files in unsearchable directories.
      (file_directory_p): New function, which uses 'stat' on most platforms
      but faccessat with D_OK (for efficiency) if WINDOWSNT.
      (Ffile_directory_p, Fset_file_times): Use it.
      (file_accessible_directory_p): New function, which uses a single
      syscall for efficiency.
      (Ffile_accessible_directory_p): Use it.
      * src/xrdb.c (file_p): Use file_directory_p.
      * src/lisp.h (file_directory_p, file_accessible_directory_p): New decls.
      * src/lread.c (openp): When opening a file, use fstat rather than
      stat, as that avoids a permissions race.  When not opening a file,
      use file_directory_p rather than stat.
      (dir_warning): First arg is now a usage string, not a format.
      Use errno.  All uses changed.
      * src/nsterm.m (ns_term_init): Remove unnecessary call to file-readable
      that merely introduced a race.
      * src/process.c, src/sysdep.c, src/term.c: All uses of '#ifdef O_NONBLOCK'
      changed to '#if O_NONBLOCK', to accommodate gnulib O_* style,
      and similarly for the other O_* flags.
      * src/w32.c (sys_faccessat): Rename from sys_access and switch to
      faccessat's API.  All uses changed.
      * src/xrdb.c: Do not include <sys/stat.h>; no longer needed.
      (magic_db): Rename from magic_file_p.
      (magic_db, search_magic_path): Return an XrmDatabase rather than a
      char *, so that we don't have to test for file existence
      separately from opening the file for reading.  This removes a race
      fixes a permission-checking problem, and simplifies the code.
      All uses changed.
      (file_p): Remove; no longer needed.
      
      Fixes: debbugs:12632
      73dcdb9f
  10. 13 Nov, 2012 4 commits
    • Eli Zaretskii's avatar
      Fix a typo in src/ChangeLog. · c7085245
      Eli Zaretskii authored
      c7085245
    • Jan Djärv's avatar
      * nsterm.m (hold_event): Send SIGIO to make sure ns_read_socket is · f99c65e5
      Jan Djärv authored
      called.
      
      Fixes: debbugs:12834
      f99c65e5
    • Dmitry Antipov's avatar
      Omit glyphs initialization at startup. · 2a14f83b
      Dmitry Antipov authored
      * dispnew.c (glyphs_initialized_initially_p): Remove.
      (adjust_frame_glyphs_initially): Likewise.  Adjust users.
      (Fredraw_frame): Move actual code from here...
      (redraw_here): ...to here.  Add eassert.  Adjust comment.
      (Fredraw_display): Use redraw_frame.
      * xdisp.c (clear_garbaged_frames): Likewise.
      2a14f83b
    • Paul Eggert's avatar
      Fix a race with verify-visited-file-modtime. · b95a9c0c
      Paul Eggert authored
      Since at least 1991 Emacs has ignored an mtime difference of no
      more than one second, but my guess is that this was to work around
      file system bugs that were fixed long ago.  Since the race is
      causing problems now, let's remove that code.
      * fileio.c (Fverify_visited_file_modtime): Do not accept a file
      whose time stamp is off by no more than a second.  Insist that the
      file time stamps match exactly.
      
      Fixes: debbugs:12863
      b95a9c0c
  11. 12 Nov, 2012 1 commit