1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00
Commit Graph

1811 Commits

Author SHA1 Message Date
Glenn Morris
a4b0cca119 Merge from emacs-24; up to 2012-12-01T13:25:13Z!cyd@gnu.org 2012-12-21 11:32:43 -08:00
Akinori MUSHA
018246572c * Makefile.in (install-arch-dep): Ignore chmod errors (tiny change)
Fixes: debbugs:13233
2012-12-19 23:56:56 -08:00
Romain Francoise
7c3d167f48 Add support for preserving ACL entries of files.
* configure.ac (acl): New option.
	(HAVE_POSIX_ACL): Test for POSIX ACL support.  This is typically
	provided by libacl on GNU/Linux.

	* fileio.c (Ffile_acl, Fset_file_acl): New functions.
	(Fcopy_file): Change last arg to `preserve_extended_attributes'
	and copy ACL entries of file in addition to SELinux context if
	set.
	(syms_of_fileio): Add `file-acl' and `set-file-acl'.

	* Makefile.in (LIBACL_LIBS): New macro.
	(LIBES): Use it.

	* files.el (file-extended-attributes)
	(set-file-extended-attributes): New functions.
	(backup-buffer): Use them to handle both SELinux context and ACL
	entries.
	(backup-buffer-copy): Work with an alist of extended attributes,
	rather than an SELinux context.
	(basic-save-buffer-2): Ditto.

	* files.texi (File Attributes): Document ACL support and new
	`file-acl' function.
	(Changing Files): Mention argument name change of `copy-file' and
	document new function `set-file-acl'.
2012-12-16 19:22:27 +01:00
Paul Eggert
97976f9f3f Fix permissions bugs with setgid directories etc.
* configure.ac (BSD4_2): Remove; no longer needed.
* admin/CPP-DEFINES (BSD4_2): Remove.
* doc/lispintro/emacs-lisp-intro.texi (Files List):
directory-files-and-attributes now outputs t for attribute that's
now a placeholder.
* doc/lispref/files.texi (Testing Accessibility): Document GROUP arg
of file-ownership-preserved-p.
(File Attributes): Document that 9th element is now
just a placeholder.
* doc/lispref/os.texi (User Identification): Document new functions group-gid,
group-real-gid.
* etc/NEWS: Document changes to file-attributes,
file-ownership-preserved-p.
Mention new functions group-gid, group-real-gid.
* lisp/files.el (backup-buffer): Don't rely on 9th output of
file-attributes, as it's now a placeholder.  Instead, use the new
optional arg of file-ownership-preserved-p.
(file-ownership-preserved-p): New optional arg GROUP.
Fix mishandling of setuid directories that would cause this
function to return t when it should have returned nil.
Document what happens if the file does not exist, and when
it's not known whether the ownership will be preserved.
* lisp/net/tramp-sh.el (tramp-sh-handle-file-ownership-preserved-p):
Likewise.
(tramp-get-local-gid): Use group-gid for integer, as that's
faster and more reliable.
* src/dired.c (Ffile_attributes): Return t as the 9th attribute,
to mark it as a placeholder.  The old value was often wrong.
The only user of this attribute has been changed to use
file-ownership-preserved-p instead, with its new group arg.
* src/editfns.c (Fgroup_gid, Fgroup_real_gid): New functions.

Fixes: debbugs:13125
2012-12-14 10:59:00 -08:00
Glenn Morris
727f973937 Merge from emacs-24; up to 2012-11-30T04:44:52Z!cyd@gnu.org 2012-12-12 21:29:15 -08:00
Glenn Morris
bfe6ffb652 Add wisent manual to build process
* doc/misc/wisent.texi: Small edits.  Set copyright to FSF, update license to
GFDL 1.3+.

* doc/misc/Makefile.in (INFO_TARGETS, DVI_TARGETS, PDF_TARGETS): Add wisent.
(wisent, $(buildinfodir)/wisent$(INFO_EXT), wisent.dvi, wisent.pdf):
New targets.

* doc/misc/makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add wisent.
($(infodir)/wisent$(INFO_EXT), wisent.dvi): New targets.

* info/dir: wisent.
2012-12-12 20:47:14 -08:00
Glenn Morris
98c94021a1 Add bovine manual to build process
* doc/misc/bovine.texi: Small edits.  Set copyright to FSF, update license to
GFDL 1.3+, remove empty index.

* doc/misc/Makefile.in (INFO_TARGETS, DVI_TARGETS, PDF_TARGETS): Add bovine.
(bovine, $(buildinfodir)/bovine$(INFO_EXT), bovine.dvi, bovine.pdf):
New targets.

* doc/misc/makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add bovine.
($(infodir)/bovine$(INFO_EXT), bovine.dvi): New targets.

* info/dir: Add bovine.
2012-12-12 20:25:50 -08:00
Andreas Schwab
0f59daafb7 * Makefile.in (install-info): Use `${MAKE} -s' for echo-info.
(uninstall): Likewise.
2012-12-12 18:52:01 +01:00
Glenn Morris
4c2dd4eeff Add srecode manual to build process
* doc/misc/srecode.texi: Small edits.  Set copyright to FSF, add explicit
GFDL 1.3+ license, fix up index.

* doc/misc/Makefile.in (INFO_TARGETS, DVI_TARGETS, PDF_TARGETS): Add srecode.
(srecode, $(buildinfodir)/srecode$(INFO_EXT), srecode.dvi)
(srecode.pdf): New targets.

* doc/misc/makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add srecode.
($(infodir)/srecode$(INFO_EXT), srecode.dvi): New targets.

* info/dir: Add srecode.
2012-12-12 09:19:20 -08:00
Nicolas Avrutin
02925206eb Fix for install-info in non-English locales (tiny change)
* Makefile.in (install-info, uninstall):
Ensure make's messages about changing directories are in English.

Fixes: debbugs:13142
2012-12-11 13:37:53 -05:00
Paul Eggert
904dd565a0 Merge from gnulib for 'inline', incorporating:
2012-12-11 extern-inline: avoid incompatibility with Darwin Libc
* m4/extern-inline.m4: Update from gnulib.

Fixes: debbugs:13040
2012-12-11 10:18:13 -08:00
Juanma Barranquero
0eeb69fe15 (lib-src,src,lib)/makefile.w32-in: Update dependencies. 2012-12-11 03:06:53 +01:00
Daniel Colascione
5b55e0b70f Merge from private trunk
Daniel Colascione 2012-12-10 Add emacs.res to .bzrignore
Daniel Colascione 2012-12-10 Fix cygw32 build break
2012-12-10 12:55:02 -08:00
Daniel Colascione
9ca3e73ac3 Add emacs.res to .bzrignore 2012-12-10 12:47:57 -08:00
Paul Eggert
7e77303ee5 * configure.ac (HAVE_INOTIFY): Speed up configure-time test.
There's no need to test for any of three inotify functions,
since we use all three.  Check for just the first one.
2012-12-10 12:27:33 -08:00
Daniel Colascione
78f9ea875a Move fix for bug#12993 to trunk 2012-12-10 09:55:03 -08:00
Daniel Colascione
743fa5cbdd Move fix for cygw32 icon issue from emacs-24 branch to trunk as Stefan Monnier requests 2012-12-10 09:52:35 -08:00
Rüdiger Sonderfeld
81606b1050 Support filesystem notification through inotify on GNU/Linux.
configure.ac (inotify): New option.
 (HAVE_INOTIFY): Test for inotify.

 src/termhooks.h (enum event_kind) [HAVE_INOTIFY]: Add
 FILE_NOTIFY_EVENT.
 src/lisp.h (syms_of_inotify) [HAVE_INOTIFY]: Add prototype.
 src/keyboard.c (Qfile_inotify) [HAVE_INOTIFY]: New variable.
 (syms_of_keyboard): DEFSYM it.
 (kbd_buffer_get_event) [HAVE_INOTIFY]: Generate FILE_NOTIFY_EVENT.
 (make_lispy_event): Support FILE_NOTIFY_EVENT by generating
 Qfile_inotify events.
 (keys_of_keyboard) [HAVE_INOTIFY]: Bind file-inotify events in
 special-event-map to inotify-handle-event.
 src/emacs.c (main) [HAVE_INOTIFY]: Call syms_of_inotify.
 src/Makefile.in (base_obj): Add inotify.o.
 src/inotify.c: New file.

 lisp/subr.el (inotify-event-p, inotify-handle-event): New functions.

 test/automated/inotify-test.el: New test.
2012-12-10 06:17:21 -05:00
Daniel Colascione
1cf1bbd51e Compile Windows resources into cygw32 Emacs 2012-12-09 23:11:21 -08:00
Andreas Schwab
75d7aa242d * configure.ac: Fix source command in .gdbinit.
Don't quote $MAKEINFO.
2012-12-09 09:37:01 +01:00
Paul Eggert
3cc53d6024 Allow spaces in some configuration vars (Bug#13078).
* configure.ac (srcdir): Don't assume $PWD lacks spaces.
(srcdir, MAKEINFO, PKG_CONFIG, PKG_CONFIG_MIN_VERSION):
All uses quoted, to allow spaces in these vars.
2012-12-08 18:22:39 -08:00
Paul Eggert
5745a7df2b Use putenv+unsetenv instead of modifying environ directly.
* admin/merge-gnulib (GNULIB_MODULES): Add putenv, unsetenv.
* lib/putenv.c, lib/unsetenv.c, m4/putenv.m4, m4/setenv.m4:
New files, copied automatically from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* src/alloc.c (xputenv): New function.
* src/dbusbind.c (Fdbus_init_bus):
* src/emacs.c (main):
* src/xterm.c (x_term_init):
Use xputenv instead of setenv or putenv, to detect memory exhaustion.
* src/editfns.c (initial_tz): Move static var decl up.
(tzvalbuf_in_environ): New static var.
(init_editfns):	Initialize these two static vars.
(Fencode_time): Don't assume arbitrary limit on EMACS_INT width.
Save old TZ value on stack, if it's small.
(Fencode_time, set_time_zone_rule): Don't modify 'environ' directly;
instead, use xputenv+unsetenv to set and restore TZ.
(environbuf): Remove static var.  All uses removed.
(Fset_time_zone_rule): Do not save TZ and environ;
no longer needed here.
(set_time_zone_rule_tz1, set_time_zone_rule_tz2) [LOCALTIME_CACHE]:
Move to inside set_time_zone_rule; they don't need file scope any more.
(set_time_zone_rule): Maintain the TZ=value string separately.
(syms_of_editfns): Don't initialize initial_tz;
init_editfns now does it.
* src/emacs.c (dump_tz) [HAVE_TZSET]: Now const.
* src/lisp.h (xputenv): New decl.

Fixes: debbugs:13070
2012-12-08 09:19:51 -08:00
Eli Zaretskii
63999a7dbe Windows followup to 2012-12-08T02:30:51Z!eggert@cs.ucla.edu.
lib/makefile.w32-in ($(BLD)/sig2str.$(O)): New dependency.
 Remove a stray character at the beginning of the file.

Fixes: debbugs:13026
2012-12-08 11:57:43 +02:00
Paul Eggert
7be78020e3 Simplify get_lim_data.
* admin/CPP-DEFINES (ULIMIT_BREAK_VALUE): Remove.
* configure.ac (ULIMIT_BREAK_VALUE): Remove.
* src/vm-limit.c (get_lim_data): Combine RLIMIT_AS and RLIMIT_DATA methods.
Remove USG and vlimit methods; no longer used these days.
Add #error catchall just in case.
2012-12-07 22:56:26 -08:00
Paul Eggert
d983a10b9a Assume POSIX 1003.1-1988 or later for signal.h.
Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN,
SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these.
* admin/CPP-DEFINES (SIGALRM, SIGCHLD, SIGHUP, SIGKILL, SIGPIPE, SIGQUIT):
Remove.
(SIGTRAP): Remove this one too, as config.h no longer defines it.
* admin/merge-gnulib (GNULIB_MODULES): Add sig2str.
* configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF):
Use SIGCHLD rather than SIGCLD.
* lib/sig2str.c, lib/sig2str.h, m4/sig2str.m4: New files, from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/makefile.w32-in (GNULIBOBJS): Add $(BUILD)/sig2str.$(O).
* src/process.c [subprocesses]: Include <c-ctype.h>, <sig2str.h>.
(deleted_pid_list, Fdelete_process, create_process)
(record_child_status_change, handle_child_signal, deliver_child_signal)
(init_process_emacs, syms_of_process):
Assume SIGCHLD is defined.
(parse_signal): Remove.  All uses removed.
(abbr_to_signal): New static function.
(Fsignal_process): Use it to convert signal names to ints.
* src/sysdep.c (sys_suspend) [!DOS_NT]: Use kill (0, ...) rather than
kill (getpgrp (), ...).
(emacs_sigaction_init): Assume SIGCHLD is defined.
(init_signals): Assume SIGALRM, SIGCHLD, SIGHUP, SIGKILL,
SIGPIPE, and SIGQUIT are defined.  Do not worry about SIGCLD any more.
* src/syssignal.h (EMACS_KILLPG): Remove.
All uses replaced by 'kill' with a negative pid.
(SIGCHLD): Remove definition, as we now assume SIGCHLD.
* src/w32proc.c (sys_kill): Support negative pids compatibly with POSIX.

Fixes: debbugs:13026
2012-12-07 18:30:51 -08:00
Glenn Morris
d8ad4d3ff9 Merge from emacs-24; up to 2012-11-24T16:58:43Z!cyd@gnu.org 2012-12-05 22:17:10 -08:00
Glenn Morris
82d384f014 Revert dumb change 2012-12-04 20:05:57 -08:00
Glenn Morris
0b2224850b * configure.ac (MAKEINFO, EGREP, CC): Quote, in case of spaces in file names. 2012-12-04 21:17:03 -05:00
Glenn Morris
de0e31edcc * configure.ac: Handle info/ files with or without ".info" extension. 2012-12-04 21:13:40 -05:00
Paul Eggert
f64898abf4 Merge from gnulib for 'inline'.
2012-11-29 snippet/warn-on-use: no 'static inline'
2012-11-29 ftruncate, fts, lstat, openat, raise: no 'static inline'
2012-11-29 arctwo, md4, md5, sha1, sha256, sha512: no 'static inline'
2012-11-29 fflush, stat: no 'static inline'
2012-11-29 stdio: better 'inline'
2012-11-29 sys_stat: no 'static inline'
2012-11-29 unistd: better 'inline'
2012-11-29 c-strtod, memcoll, readutmp: no 'static inline'
2012-11-29 extern-inline: no 'static inline'
2012-11-29 sys_socket: better 'inline'
* lib/stdio.c, lib/unistd.c: New files, from gnulib.
* build-aux/snippet/warn-on-use.h, lib/gnulib.mk, lib/lstat.c:
* lib/md5.c, lib/sha1.c, lib/sha256.c, lib/sha512.c, lib/stat.c:
* lib/stdio.in.h, lib/sys_stat.in.h, lib/unistd.in.h, m4/c-strtod.m4:
* m4/extern-inline.m4, m4/gnulib-comp.m4, m4/lstat.m4, m4/md5.m4:
* m4/sha1.m4, m4/sha256.m4, m4/sha512.m4, m4/stat.m4, m4/stdio_h.m4:
* m4/sys_socket_h.m4, m4/sys_stat_h.m4, m4/unistd_h.m4:
Update from gnulib.

Fixes: debbugs:13040
2012-11-30 10:25:59 -08:00
Glenn Morris
5c9cf0a3f9 Merge from emacs-24; up to 2012-11-20T20:06:17Z!monnier@iro.umontreal.ca 2012-11-26 19:10:32 -08:00
Ken Brown
bcd77a2ba0 Remove HAVE_MOUSE; see https://lists.gnu.org/archive/html/emacs-devel/2012-10/msg00403.html.
* configure.ac (HAVE_MOUSE): Remove.
* admin/CPP-DEFINES (HAVE_MOUSE): Remove.
* msdos/sed2v2.inp (HAVE_MOUSE): Remove.
* nt/config.nt (HAVE_MOUSE): Remove.
* src/keyboard.c (HAVE_MOUSE):
* src/frame.c (HAVE_MOUSE): Remove, and rewrite code as if HAVE_MOUSE
were always defined.
2012-11-24 12:20:49 -05:00
Eli Zaretskii
50a60e0257 Fix the MS-Windows build broken by absence of the *.manifest files.
make-dist (nt): Adjust to changes in names of the *.manifest files.
2012-11-24 18:58:28 +02:00
Paul Eggert
95ef7787fb Assume POSIX 1003.1-1988 or later for dirent.h.
* admin/CPP-DEFINES (HAVE_CLOSEDIR, HAVE_DIRENT_H): Remove.
* admin/notes/copyright: Adjust to src/ndir.h -> nt/inc/dirent.h renaming.
* configure.ac: Do not check for dirent.h or closdir.
* nt/inc/dirent.h: Rename from ../src/ndir.h, with these changes:
(struct dirent): Rename from struct direct.  All uses changed.
* nt/inc/sys/dir.h: Remove.
* src/dired.c: Assume HAVE_DIRENT_H.
(NAMLEN): Remove, replacing with ...
(dirent_namelen): New function.  All uses changed.  Use the GNU macro
_D_EXACT_NAMELEN if available, as it's faster than strlen.
(DIRENTRY): Remove, replacing all uses with 'struct dirent'.
(DIRENTRY_NONEMPTY): Remove.  All callers now assume it's nonzero.
* src/makefile.w32-in (DIR_H): Remove.  All uses replaced with
$(NT_INC)/dirent.h.
($(BLD)/w32.$(O)): Do not depend on $(SRC)/ndir.h.
* src/ndir.h: Rename to ../nt/inc/dirent.h.
* src/sysdep.h (closedir) [!HAVE_CLOSEDIR]: Remove.
Do not include <dirent.h>; no longer needed.
* src/w32.c: Include <dirent.h> rather than "ndir.h".

Fixes: debbugs:12958
2012-11-22 23:48:43 -08:00
Paul Eggert
9239d97052 Assume POSIX 1003.1-1988 or later for unistd.h.
* 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
2012-11-21 13:06:52 -08:00
Glenn Morris
6ef2e5ef52 Merge from emacs-24; up to 2012-11-17T22:12:47Z!eggert@cs.ucla.edu 2012-11-20 20:47:55 -08:00
Glenn Morris
1b3b7caa0c * configure.ac (--enable-profiling): Doc fix. 2012-11-20 20:22:09 -05:00
Paul Eggert
d7fcbbfe4a Omit -Wstrict-overflow as it does not play well with --enable-checking. 2012-11-20 00:29:04 -08:00
Paul Eggert
8ea5c4de2a Improve static checking of integer overflow and stack smashing.
* configure.ac (WARN_CFLAGS): Add -Wstack-protector and
-Wstrict-overflow if using GCC 4.7.2 or later on a platform with
at least 64-bit long int.  This improves static checking on these
platforms, when configured with --enable-gcc-warnings.
2012-11-19 15:39:28 -08:00
Paul Eggert
49cdacdad3 Assume POSIX 1003.1-1988 or later for fcntl.h.
* 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
2012-11-17 14:12:47 -08:00
Paul Eggert
3d082a269e 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.
2012-11-16 07:29:22 -08:00
Paul Eggert
73dcdb9f30 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 <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
2012-11-13 20:55:41 -08:00
Paul Eggert
dd0333b615 Assume at least POSIX.1-1988 for getpgrp, setpgid, setsid.
This removes code that has been obsolete since around 1990.
* admin/CPP-DEFINES (HAVE_SETPGID, HAVE_SETSID, SETPGRP_RELEASES_CTTY):
Remove; obsolete.
* configure.ac (setpgid, setsid): Assume their existence.
(AC_FUNC_GETPGRP, SETPGRP_RELEASES_CTTY): Remove; obsolete.
* src/callproc.c (Fcall_process):
* src/emacs.c (main):
* src/process.c (create_process):
* src/term.c (dissociate_if_controlling_tty):
Assume setsid exists.
* src/callproc.c (child_setup): Assume setpgid exists and behaves as
per POSIX.1-1988 or later.
* src/conf_post.h (setpgid) [!HAVE_SETPGID]: Remove.
* src/emacs.c (shut_down_emacs):
* src/sysdep.c (sys_suspend, init_foreground_group):
Assume getpgrp behaves as per POSIX.1-1998 or later.
* src/msdos.c (setpgrp): Remove.
(tcgetpgrp, setpgid, setsid): New functions.
* src/systty.h (EMACS_GETPGRP): Remove.  All callers now use getpgrp.
* src/term.c (no_controlling_tty): Remove; unused.
* src/w32proc.c (setpgrp): Remove.
(setsid, tcgetpgrp): New functions.

Fixes: debbugs:12800
2012-11-04 19:18:32 -08:00
Paul Eggert
8148369cfb Simplify by assuming __fpending.
Now that Emacs is using the gnulib fpending module,
there's no need for Emacs to have a separate implementation.
* configure.ac (stdio_ext.h, __fpending): Remove now-duplicate checks.
(PENDING_OUTPUT_COUNT, DISPNEW_NEEDS_STDIO_EXT): Remove.
* admin/CPP-DEFINES (PENDING_OUTPUT_COUNT): Remove.
* src/dispnew.c: Include <fpending.h>, not <stdio_ext.h>.
(update_frame_1): Use __fpending, not PENDING_OUTPUT_COUNT.
Do not assume that __fpending's result fits in int.
2012-11-04 17:59:00 -08:00
Eli Zaretskii
3478f4b5c4 Fix order of entries in ChangeLog files. 2012-11-03 22:48:03 +02:00
Eli Zaretskii
3a7089c180 Fix Windows build as fallout from 2012-11-03T18:54:17Z!eggert@cs.ucla.edu.
nt/config.nt (PENDING_OUTPUT_N_BYTES): Define.

 lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/fpending.$(O) and
 $(BLD)/close-stream.$(O).
 ($(BLD)/close-stream.$(O)):
 ($(BLD)/fpending.$(O)): New dependencies.

Fixes: debbugs:9574
2012-11-03 22:43:29 +02:00
Glenn Morris
f58542e151 Merge from emacs-24; up to 2012-11-03T05:11:34Z!dmantipov@yandex.ru 2012-11-03 12:14:22 -07:00
Paul Eggert
7ccfb720b4 Fix data-loss with --batch.
* admin/merge-gnulib (GNULIB_MODULES): Add close-stream.
* lib/close-stream.c, lib/close-stream.h, lib/fpending.c
* lib/fpending.h, m4/close-stream.m4, m4/fpending.m4:
New files, from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* src/emacs.c: Include <close-stream.h>.
(close_output_streams): New function.
(main): Pass it to atexit, so that Emacs closes stdout and stderr
and handles errors appropriately.
(Fkill_emacs): Don't worry about flushing, as close_output_stream
does that now.

Fixes: debbugs:9574
2012-11-03 11:54:17 -07:00
Eli Zaretskii
b3cf17f695 Adapt the MSDOS build to the latest changes on mainline. 2012-11-03 15:48:33 +02:00
Glenn Morris
d036bcdffe Allow choice of icon style at install time
This feature is intentionally not advertised
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12536#40

* Makefile.in (EMACS_ICON): New variable.
(install-etc): Use EMACS_ICON to allow choice of icon.
2012-11-02 18:22:11 -04:00