1. 18 Nov, 2012 1 commit
  2. 14 Nov, 2012 2 commits
    • 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
  3. 13 Nov, 2012 4 commits
  4. 12 Nov, 2012 5 commits
    • Dmitry Antipov's avatar
      * frame.h (struct frame): Convert external_tool_bar member to · be49ba74
      Dmitry Antipov authored
      1-bit unsigned bitfield.
      * termhooks.h (struct terminal): Remove mouse_moved member since
      all users are long dead.  Adjust comment on mouse_position_hook.
      be49ba74
    • Eli Zaretskii's avatar
      Fix bug #12867 with crashes due to large field width in mode-line format. · 32520273
      Eli Zaretskii authored
       src/xdisp.c (decode_mode_spec): Limit the value of WIDTH argument
       passed to pint2str and pint2hrstr to be at most the size of the
       frame's decode_mode_spec_buffer.  This avoids crashes with very
       large values of FIELD_WIDTH argument to decode_mode_spec.
      32520273
    • Dmitry Antipov's avatar
      Simplify by using FOR_EACH_FRAME here and there. · 5b04e9f9
      Dmitry Antipov authored
      * frame.c (next_frame, prev_frame, other_visible_frames)
      (delete_frame, visible-frame-list): Use FOR_EACH_FRAME.
      * w32term.c (x_window_to_scroll_bar): Likewise.
      * window.c (window_list): Likewise.
      * xdisp.c (x_consider_frame_title): Likewise.
      * xfaces.c ( Fdisplay_supports_face_attributes_p): Likewise.
      * xfns.c (x_window_to_frame, x_any_window_to_frame)
      (x_menubar_window_to_frame, x_top_window_to_frame): Likewise.
      * xmenu.c (menubar_id_to_frame): Likewise.
      * xselect.c (frame_for_x_selection): Likewise.
      * xterm.c (x_frame_of_widget, x_window_to_scroll_bar)
      (x_window_to_menu_bar): Likewise.
      * w32fns.c (x_window_to_frame): Likewise.  Adjust comment.
      5b04e9f9
    • Paul Eggert's avatar
      12cc4337
    • Paul Eggert's avatar
      Another tweak to vectorlike_header change. · 76ae24d7
      Paul Eggert authored
      * alloc.c (struct Lisp_Vectorlike_Free, NEXT_IN_FREE_LIST):
      Remove, and replace all uses with ...
      (next_in_free_list, set_next_in_free_list):
      New functions, which respect C's aliasing rules better.
      76ae24d7
  5. 11 Nov, 2012 2 commits
  6. 09 Nov, 2012 8 commits
  7. 08 Nov, 2012 9 commits
    • Stefan Monnier's avatar
      * src/lisp.h (XHASH): Redefine to be imperfect and fit in a Lisp int. · 61ddb1b9
      Stefan Monnier authored
      * src/fns.c (hashfn_eq, hashfn_eql, sxhash):
      * src/profiler.c (hashfn_profiler): Don't use XUINT on non-integers.
      * src/buffer.c (compare_overlays): Use XLI rather than XHASH.
      61ddb1b9
    • Paul Eggert's avatar
      Use same hash function for hashfn_profiler as for hash_string etc. · 04a2d0d3
      Paul Eggert authored
      * fns.c (SXHASH_COMBINE): Remove.  All uses replaced by sxhash_combine.
      * lisp.h (sxhash_combine): New inline function, with the contents
      of the old SXHASH_COMBINE.
      * profiler.c (hashfn_profiler): Use it, instead of having a
      special hash function containing a comparison that always yields 1.
      04a2d0d3
    • Stefan Monnier's avatar
      * src/xfaces.c (Qultra_light, Qreverse_oblique, Qreverse_italic) · de5ef41a
      Stefan Monnier authored
      (Qultra_condensed, Qextra_condensed, Qcondensed, Qsemi_condensed)
      (Qsemi_expanded, Qextra_expanded, Qexpanded, Qultra_expanded):
      Remove unused vars.
      de5ef41a
    • Jan Djärv's avatar
      * image.c (xpm_make_color_table_h): Fix compiler error because · a23c4171
      Jan Djärv authored
      make_hash_table changed.
      a23c4171
    • Jan Djärv's avatar
    • Stefan Monnier's avatar
      Use ad-hoc comparison function for the profiler's hash-tables. · b7432bb2
      Stefan Monnier authored
      * src/profiler.c (Qprofiler_backtrace_equal, hashtest_profiler): New vars.
      (make_log): Use them.
      (handle_profiler_signal): Don't inhibit quit any longer since we don't
      call Fequal any more.
      (Ffunction_equal): New function.
      (cmpfn_profiler, hashfn_profiler): New functions.
      (syms_of_profiler): Initialize them.
      * src/lisp.h (struct hash_table_test): New struct.
      (struct Lisp_Hash_Table): Use it.
      * src/alloc.c (mark_object): Mark hash_table_test fields of hash tables.
      * src/fns.c (make_hash_table): Take a struct to describe the test.
      (cmpfn_eql, cmpfn_equal, cmpfn_user_defined, hashfn_eq, hashfn_eql)
      (hashfn_equal, hashfn_user_defined): Adjust to new calling convention.
      (hash_lookup, hash_remove_from_table): Move assertion checking of
      hashfn result here.  Check hash-equality before calling cmpfn.
      (Fmake_hash_table): Adjust call to make_hash_table.
      (hashtest_eq, hashtest_eql, hashtest_equal): New structs.
      (syms_of_fns): Initialize them.
      * src/emacs.c (main): Move syms_of_fns earlier.
      * src/xterm.c (syms_of_xterm):
      * src/category.c (hash_get_category_set): Adjust call to make_hash_table.
      * src/print.c (print_object): Adjust to new hash-table struct.
      * src/composite.c (composition_gstring_put_cache): Adjust to new hashfn.
      b7432bb2
    • Eli Zaretskii's avatar
      More fixes for bug #12806. · 88002743
      Eli Zaretskii authored
       src/w32fns.c (modifier_set): Fix handling of Scroll Lock when the
       value of w32-scroll-lock-modifier is neither nil nor one of the
       known key modifiers.
      88002743
    • Dmitry Antipov's avatar
      Shrink struct vectorlike_header to the only size field. · 914adc42
      Dmitry Antipov authored
      * lisp.h (enum pvec_type): Avoid explicit enum member values.
      Adjust comment.
      (enum More_Lisp_Bits): Change PSEUDOVECTOR_SIZE_BITS and
      PVEC_TYPE_MASK to arrange new bitfield in the vector header.
      (PSEUDOVECTOR_REST_BITS, PSEUDOVECTOR_REST_MASK): New members.
      (PSEUDOVECTOR_AREA_BITS): New member used to extract subtype
      information from the vector header.  Adjust comment.
      (XSETPVECTYPE, XSETPVECTYPESIZE, XSETTYPED_PSEUDOVECTOR)
      (PSEUDOVECTOR_TYPEP, DEFUN): Adjust to match new vector header
      layout.
      (XSETSUBR, SUBRP): Adjust to match new Lisp_Subr layout.
      (struct vectorlike_header): Remove next member.  Adjust comment.
      (struct Lisp_Subr): Add convenient header.  Adjust comment.
      (allocate_pseudovector): Adjust prototype.
      * alloc.c (mark_glyph_matrix, mark_face_cache, allocate_string)
      (sweep_string, lisp_malloc): Remove useless prototypes.
      (enum mem_type): Adjust comment.
      (NEXT_IN_FREE_LIST): New macro.
      (SETUP_ON_FREE_LIST): Adjust XSETPVECTYPESIZE usage.
      (Fmake_bool_vector): Likewise.
      (struct large_vector): New type to represent allocation unit for
      the vectors with the memory footprint more than VBLOOCK_BYTES_MAX.
      (large_vectors): Change type to struct large_vector.
      (allocate_vector_from_block): Simplify.
      (PSEUDOVECTOR_NBYTES): Replace with...
      (vector_nbytes): ...new function.  Adjust users.
      (sweep_vectors): Adjust processing of large vectors.
      (allocate_vectorlike): Likewise.
      (allocate_pseudovector): Change type of 3rd arg to enum pvec_type.
      Add easserts.  Adjust XSETPVECTYPESIZE usage.
      (allocate_buffer): Use BUFFER_PVEC_INIT.
      (live_vector_p): Adjust to match large vector.
      * buffer.c (init_buffer_once): Use BUFFER_PVEC_INIT.
      * buffer.h (struct buffer): Add next member.
      (BUFFER_LISP_SIZE, BUFFER_REST_SIZE, BUFFER_PVEC_INIT):
      New macros.
      (FOR_EACH_BUFFER): Adjust to match struct buffer change.
      * fns.c (internal_equal): Adjust to match enum pvec_type change.
      (copy_hash_table): Adjust to match vector header change.
      * lread.c (defsubr): Use XSETPVECTYPE.
      * .gdbinit (xpr, xbacktrace): Adjust to match vector header change.
      (xvectype): Likewise.  Print PVEC_NORMAL_VECTOR for regular vectors.
      (xvecsize): New command.
      914adc42
    • Dmitry Antipov's avatar
      * keyboard.c (event_to_kboard): Do not dereference · c66f21ea
      Dmitry Antipov authored
      frame_or_window field of SELECTION_REQUEST_EVENT
      and SELECTION_CLEAR_EVENT events (Bug#12814).
      * xterm.h (struct selection_input_event): Adjust comment.
      c66f21ea
  8. 07 Nov, 2012 6 commits
  9. 06 Nov, 2012 3 commits