From f99c65e5743526a7fcc6352599b6f0efd3970202 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Tue, 13 Nov 2012 08:56:15 +0100 Subject: * nsterm.m (hold_event): Send SIGIO to make sure ns_read_socket is called. Fixes: debbugs:12834 --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index 494b2179516..d72091c0ed6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-11-13 Jan Djärv + + * nsterm.m (hold_event): Send SIGIO to make sure ns_read_socket is + called (Bug#12834). + 2012-11-12 Eli Zaretskii * xdisp.c (decode_mode_spec): Limit the value of WIDTH argument -- cgit v1.2.1 From 73dcdb9f30cb94a3183db54d9b463370c3978d4d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 13 Nov 2012 20:55:41 -0800 Subject: Use faccessat, not access, when checking file permissions. 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 ; 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 --- src/ChangeLog | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index 1d94cef6577..a6b42e8a58c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,70 @@ +2012-11-14 Paul Eggert + + Use faccessat, not access, when checking file permissions (Bug#12632). + 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. + * Makefile.in (LIB_EACCESS): New macro. + (LIBES): Use it. + * callproc.c (init_callproc): + * charset.c (init_charset): + * fileio.c (check_existing, check_executable, check_writable) + (Ffile_readable_p): + * lread.c (openp, load_path_check): + * process.c (allocate_pty): + * xrdb.c (file_p): + Use effective UID when checking permissions, not real UID. + * callproc.c (init_callproc): + * charset.c (init_charset): + * lread.c (load_path_check, init_lread): + Test whether directories are accessible, not merely whether they exist. + * conf_post.h (GNULIB_SUPPORT_ONLY_AT_FDCWD): New macro. + * 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. + * xrdb.c (file_p): Use file_directory_p. + * lisp.h (file_directory_p, file_accessible_directory_p): New decls. + * 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. + * nsterm.m (ns_term_init): Remove unnecessary call to file-readable + that merely introduced a race. + * process.c, sysdep.c, 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. + * w32.c (sys_faccessat): Rename from sys_access and switch to + faccessat's API. All uses changed. + * xrdb.c: Do not include ; 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. + 2012-11-13 Dmitry Antipov Omit glyphs initialization at startup. -- cgit v1.2.1 From 77731919f923a5fc81db60d19952776417a00037 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Wed, 14 Nov 2012 15:13:33 +0400 Subject: * xdisp.c (echo_area_display, redisplay_internal): Omit redundant check whether frame_garbaged is set. --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index a6b42e8a58c..99f3128b321 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-11-14 Dmitry Antipov + + * xdisp.c (echo_area_display, redisplay_internal): + Omit redundant check whether frame_garbaged is set. + 2012-11-14 Paul Eggert Use faccessat, not access, when checking file permissions (Bug#12632). -- cgit v1.2.1 From 730b2d8f6b5851dc462b79b8bd48068c1b9f1932 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 14 Nov 2012 18:41:43 +0200 Subject: Clean up w32 timer thread code in the hope of solving bug #12832. 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. --- src/ChangeLog | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index d72091c0ed6..9caa5113444 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2012-11-14 Eli Zaretskii + + * 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. + (Bug#12832) + 2012-11-13 Jan Djärv * nsterm.m (hold_event): Send SIGIO to make sure ns_read_socket is -- cgit v1.2.1 From 14f207289c224b3ad12fc8704c2183ef8fbcab28 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 14 Nov 2012 19:22:55 +0200 Subject: MS-Windows followup for 2012-11-14T04:55:41Z!eggert@cs.ucla.edu, regarding faccessat. 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 --- src/ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index 99f3128b321..ec8f7e219f7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-11-14 Eli Zaretskii + + * 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. + 2012-11-14 Dmitry Antipov * xdisp.c (echo_area_display, redisplay_internal): -- cgit v1.2.1 From bf20ea80f6331aaea18042a92928deb9db1b66f3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 14 Nov 2012 16:41:32 -0800 Subject: * eval.c (mark_backtrace) [BYTE_MARK_STACK]: Remove stray '*'. This follows up on the 2012-09-29 patch that removed indirection for the 'function' field. Reported by Sergey Vinokurov in . --- src/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index ec8f7e219f7..d309931e8e6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-11-15 Paul Eggert + + * eval.c (mark_backtrace) [BYTE_MARK_STACK]: Remove stray '*'. + This follows up on the 2012-09-29 patch that removed indirection + for the 'function' field. Reported by Sergey Vinokurov in + . + 2012-11-14 Eli Zaretskii * w32.c (faccessat): Rename from sys_faccessat. (No need to use a -- cgit v1.2.1 From b72c161c5bda1836b0a86ceba1bd968abd00ff1a Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 15 Nov 2012 17:21:50 +0100 Subject: src/makefile.w32-in: Update dependencies. --- src/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index d309931e8e6..8caaa2f68e0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-11-15 Juanma Barranquero + + * makefile.w32-in ($(BLD)/dispnew.$(O), $(BLD)/emacs.$(O)): + Update dependencies. + 2012-11-15 Paul Eggert * eval.c (mark_backtrace) [BYTE_MARK_STACK]: Remove stray '*'. -- cgit v1.2.1 From 5c2a71483b029100aabf5d64717120b31f4d6fa4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 15 Nov 2012 12:17:23 -0500 Subject: * src/eval.c (Finteractive_p): Revert lexbind-merge mishap. --- src/ChangeLog | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index 9caa5113444..d2e7a96f275 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-11-15 Stefan Monnier + + * eval.c (Finteractive_p): Revert lexbind-merge mishap. + 2012-11-14 Eli Zaretskii * w32proc.c (timer_loop): Make sure SuspendThread and ResumeThread @@ -28,16 +32,16 @@ * window.c (Fsplit_window_internal): Set combination limit of new parent window to t iff Vwindow_combination_limit is t; fixing a regression introduced with the change from 2012-09-22. - (Fwindow_combination_limit, Fset_window_combination_limit): Fix - doc-strings. + (Fwindow_combination_limit, Fset_window_combination_limit): + Fix doc-strings. 2012-11-06 Eli Zaretskii * xdisp.c (try_scrolling): Fix correction of aggressive-scroll amount when the scroll margins are too large. When scrolling backwards in the buffer, give up if cannot reach point or the - scroll margin within a reasonable number of screen lines. Fixes - point position in window under scroll-up/down-aggressively when + scroll margin within a reasonable number of screen lines. + Fixes point position in window under scroll-up/down-aggressively when point is positioned many lines beyond the window top/bottom. (Bug#12811) @@ -118,8 +122,8 @@ 2012-10-29 Daniel Colascione - * cygw32.h, cygw32.c (Qutf_16le, from_unicode, to_unicode): In - preparation for fixing bug#12739, move these functions from + * cygw32.h, cygw32.c (Qutf_16le, from_unicode, to_unicode): + In preparation for fixing bug#12739, move these functions from here... * coding.h, coding.c: ... to here, and compile them only when -- cgit v1.2.1 From d56f2e49b2353336e853025219440c3e1572524e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 15 Nov 2012 21:40:54 -0500 Subject: * src/editfns.c (Fmessage): Mention message-log-max. (Bug#12849) --- src/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index d2e7a96f275..b218e42b3f2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-11-16 Glenn Morris + + * editfns.c (Fmessage): Mention message-log-max. (Bug#12849) + 2012-11-15 Stefan Monnier * eval.c (Finteractive_p): Revert lexbind-merge mishap. -- cgit v1.2.1 From 3d082a269ece18058ed82957f8a056822b39789e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 16 Nov 2012 07:29:22 -0800 Subject: Remove no-longer-used pty_max_bytes variable. * configure.ac (fpathconf): Remove unnecessary check. * admin/CPP-DEFINES (HAVE_FPATHCONF): Remove. * src/process.c (pty_max_bytes): Remove; unused. (send_process): Do not set it. --- src/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index 8caaa2f68e0..c9c754f8677 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-11-16 Paul Eggert + + Remove no-longer-used pty_max_bytes variable. + * process.c (pty_max_bytes): Remove; unused. + (send_process): Do not set it. + 2012-11-15 Juanma Barranquero * makefile.w32-in ($(BLD)/dispnew.$(O), $(BLD)/emacs.$(O)): -- cgit v1.2.1 From a631d0e04747884855aa460cb903d1fd2ff106f4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 17 Nov 2012 07:15:49 -0800 Subject: Fix problems in ns port found by static checking. * nsterm.m: Include , 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. --- src/ChangeLog | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index 695fbab5813..1194fe099fa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2012-11-17 Paul Eggert + + Fix problems in ns port found by static checking. + * nsterm.m: Include , 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. + 2012-11-16 Glenn Morris * editfns.c (Fmessage): Mention message-log-max. (Bug#12849) -- cgit v1.2.1 From 22bae83fa8c432780fe20202a660aa8c84f3087a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 17 Nov 2012 18:46:45 +0200 Subject: Fix bug #12829 with aborts on MS-Windows when several child processes die. 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. --- src/ChangeLog | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index 1194fe099fa..45d48ba41cc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,23 @@ +2012-11-17 Eli Zaretskii + + * 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. + + * sysdep.c (wait_for_termination_1): Remove the WINDOWSNT portion, + as it is no longer needed. + + * 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. + 2012-11-17 Paul Eggert Fix problems in ns port found by static checking. -- cgit v1.2.1 From 6ad30855c02908fdd99d9b11943719e185e65ee3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 17 Nov 2012 18:52:48 +0200 Subject: Fix MS-Windows emulation of 'faccessat' wrt directories. src/w32.c (faccessat): Pretend that directories have the execute bit set. Emacs expects that, e.g., in files.el:cd-absolute. --- src/ChangeLog | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ChangeLog') diff --git a/src/ChangeLog b/src/ChangeLog index 45d48ba41cc..df8bf602afe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2012-11-17 Eli Zaretskii + * w32.c (faccessat): Pretend that directories have the execute bit + set. Emacs expects that, e.g., in files.el:cd-absolute. + * 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. -- cgit v1.2.1