Commit 8832de4f authored by Michael Albinus's avatar Michael Albinus

Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs

parents b2497ef6 655badc3
Pipeline #539 failed with stage
in 51 minutes and 53 seconds
/* Hash inputs and generate C file with the digest. /* Hash inputs and generate C file with the digest.
Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2016 Free Software Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2016, 2018-2019
Foundation, Inc. Free Software Foundation, Inc.
This file is part of GNU Emacs. This file is part of GNU Emacs.
......
...@@ -488,8 +488,9 @@ lost after dumping"))) ...@@ -488,8 +488,9 @@ lost after dumping")))
;; same as invocation-directory. ;; same as invocation-directory.
(let (success) (let (success)
(unwind-protect (unwind-protect
(progn (let ((tmp-dump-mode dump-mode)
(if (member dump-mode '("pdump" "pbootstrap")) (dump-mode nil))
(if (member tmp-dump-mode '("pdump" "pbootstrap"))
(dump-emacs-portable (expand-file-name output invocation-directory)) (dump-emacs-portable (expand-file-name output invocation-directory))
(dump-emacs output "temacs") (dump-emacs output "temacs")
(message "%d pure bytes used" pure-bytes-used)) (message "%d pure bytes used" pure-bytes-used))
......
...@@ -472,7 +472,7 @@ echo "Making links to 'src'" ...@@ -472,7 +472,7 @@ echo "Making links to 'src'"
(cd src && (cd src &&
ln [a-zA-Z]*.[chm] ../${tempdir}/src && ln [a-zA-Z]*.[chm] ../${tempdir}/src &&
ln [a-zA-Z]*.in ../${tempdir}/src && ln [a-zA-Z]*.in ../${tempdir}/src &&
ln deps.mk ../${tempdir}/src && ln deps.mk dmpstruct.awk ../${tempdir}/src &&
ln README ChangeLog.*[0-9] ../${tempdir}/src && ln README ChangeLog.*[0-9] ../${tempdir}/src &&
ln .gdbinit .dbxinit ../${tempdir}/src && ln .gdbinit .dbxinit ../${tempdir}/src &&
cd ../${tempdir}/src && cd ../${tempdir}/src &&
......
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
#
# This file is part of GNU Emacs.
#
# GNU Emacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
BEGIN { BEGIN {
print "/* Generated by dmpstruct.awk */" print "/* Generated by dmpstruct.awk */"
print "#ifndef EMACS_DMPSTRUCT_H" print "#ifndef EMACS_DMPSTRUCT_H"
......
/* Dummy fingerprint /* Dummy fingerprint
Copyright (C) 2016 Free Software Foundation, Copyright (C) 2016, 2018-2019 Free Software Foundation, Inc.
Inc.
This file is part of GNU Emacs. This file is part of GNU Emacs.
......
/* Header file for the Emacs build fingerprint. /* Header file for the Emacs build fingerprint.
Copyright (C) 2016 Free Software Foundation, Copyright (C) 2016, 2018-2019 Free Software Foundation, Inc.
Inc.
This file is part of GNU Emacs. This file is part of GNU Emacs.
......
...@@ -72,7 +72,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ ...@@ -72,7 +72,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
# include "w32.h" # include "w32.h"
# endif # endif
static bool emacs_gnutls_handle_error (gnutls_session_t, int); static int emacs_gnutls_handle_error (gnutls_session_t, int);
static bool gnutls_global_initialized; static bool gnutls_global_initialized;
...@@ -579,15 +579,17 @@ gnutls_try_handshake (struct Lisp_Process *proc) ...@@ -579,15 +579,17 @@ gnutls_try_handshake (struct Lisp_Process *proc)
if (non_blocking) if (non_blocking)
proc->gnutls_p = true; proc->gnutls_p = true;
do while ((ret = gnutls_handshake (state)) < 0)
{ {
do
ret = gnutls_handshake (state); ret = gnutls_handshake (state);
emacs_gnutls_handle_error (state, ret); while (ret == GNUTLS_E_INTERRUPTED);
if (0 <= ret || emacs_gnutls_handle_error (state, ret) == 0
|| non_blocking)
break;
maybe_quit (); maybe_quit ();
} }
while (ret < 0
&& gnutls_error_is_fatal (ret) == 0
&& ! non_blocking);
proc->gnutls_initstage = GNUTLS_STAGE_HANDSHAKE_TRIED; proc->gnutls_initstage = GNUTLS_STAGE_HANDSHAKE_TRIED;
...@@ -682,8 +684,6 @@ emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) ...@@ -682,8 +684,6 @@ emacs_gnutls_transport_set_errno (gnutls_session_t state, int err)
ptrdiff_t ptrdiff_t
emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte)
{ {
ssize_t rtnval = 0;
ptrdiff_t bytes_written;
gnutls_session_t state = proc->gnutls_state; gnutls_session_t state = proc->gnutls_state;
if (proc->gnutls_initstage != GNUTLS_STAGE_READY) if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
...@@ -692,40 +692,32 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) ...@@ -692,40 +692,32 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte)
return 0; return 0;
} }
bytes_written = 0; ptrdiff_t bytes_written = 0;
while (nbyte > 0) while (nbyte > 0)
{ {
ssize_t rtnval;
do
rtnval = gnutls_record_send (state, buf, nbyte); rtnval = gnutls_record_send (state, buf, nbyte);
while (rtnval == GNUTLS_E_INTERRUPTED);
if (rtnval < 0) if (rtnval < 0)
{ {
if (rtnval == GNUTLS_E_INTERRUPTED) emacs_gnutls_handle_error (state, rtnval);
continue;
else
{
/* If we get GNUTLS_E_AGAIN, then set errno
appropriately so that send_process retries the
correct way instead of erroring out. */
if (rtnval == GNUTLS_E_AGAIN)
errno = EAGAIN;
break; break;
} }
}
buf += rtnval; buf += rtnval;
nbyte -= rtnval; nbyte -= rtnval;
bytes_written += rtnval; bytes_written += rtnval;
} }
emacs_gnutls_handle_error (state, rtnval);
return (bytes_written); return (bytes_written);
} }
ptrdiff_t ptrdiff_t
emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte) emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
{ {
ssize_t rtnval;
gnutls_session_t state = proc->gnutls_state; gnutls_session_t state = proc->gnutls_state;
if (proc->gnutls_initstage != GNUTLS_STAGE_READY) if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
...@@ -734,19 +726,18 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte) ...@@ -734,19 +726,18 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
return -1; return -1;
} }
ssize_t rtnval;
do
rtnval = gnutls_record_recv (state, buf, nbyte); rtnval = gnutls_record_recv (state, buf, nbyte);
while (rtnval == GNUTLS_E_INTERRUPTED);
if (rtnval >= 0) if (rtnval >= 0)
return rtnval; return rtnval;
else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH) else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH)
/* The peer closed the connection. */ /* The peer closed the connection. */
return 0; return 0;
else if (emacs_gnutls_handle_error (state, rtnval)) else
/* non-fatal error */ return emacs_gnutls_handle_error (state, rtnval);
return -1;
else {
/* a fatal error occurred */
return 0;
}
} }
static char const * static char const *
...@@ -757,25 +748,24 @@ emacs_gnutls_strerror (int err) ...@@ -757,25 +748,24 @@ emacs_gnutls_strerror (int err)
} }
/* Report a GnuTLS error to the user. /* Report a GnuTLS error to the user.
Return true if the error code was successfully handled. */ SESSION is the GnuTLS session, ERR is the (negative) GnuTLS error code.
static bool Return 0 if the error was fatal, -1 (setting errno) otherwise so
that the caller can notice the error and attempt a repair. */
static int
emacs_gnutls_handle_error (gnutls_session_t session, int err) emacs_gnutls_handle_error (gnutls_session_t session, int err)
{ {
int max_log_level = 0; int ret;
bool ret;
/* TODO: use a Lisp_Object generated by gnutls_make_error? */ /* TODO: use a Lisp_Object generated by gnutls_make_error? */
if (err >= 0)
return 1;
check_memory_full (err); check_memory_full (err);
max_log_level = global_gnutls_log_level; int max_log_level = global_gnutls_log_level;
/* TODO: use gnutls-error-fatalp and gnutls-error-string. */ /* TODO: use gnutls-error-fatalp and gnutls-error-string. */
char const *str = emacs_gnutls_strerror (err); char const *str = emacs_gnutls_strerror (err);
int errnum = EINVAL;
if (gnutls_error_is_fatal (err)) if (gnutls_error_is_fatal (err))
{ {
...@@ -789,11 +779,11 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err) ...@@ -789,11 +779,11 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
# endif # endif
GNUTLS_LOG2 (level, max_log_level, "fatal error:", str); GNUTLS_LOG2 (level, max_log_level, "fatal error:", str);
ret = false; ret = 0;
} }
else else
{ {
ret = true; ret = -1;
switch (err) switch (err)
{ {
...@@ -809,6 +799,26 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err) ...@@ -809,6 +799,26 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
"non-fatal error:", "non-fatal error:",
str); str);
} }
switch (err)
{
case GNUTLS_E_AGAIN:
errnum = EAGAIN;
break;
# ifdef EMSGSIZE
case GNUTLS_E_LARGE_PACKET:
case GNUTLS_E_PUSH_ERROR:
errnum = EMSGSIZE;
break;
# endif
# if defined HAVE_GNUTLS3 && defined ECONNRESET
case GNUTLS_E_PREMATURE_TERMINATION:
errnum = ECONNRESET;
break;
# endif
}
} }
if (err == GNUTLS_E_WARNING_ALERT_RECEIVED if (err == GNUTLS_E_WARNING_ALERT_RECEIVED
...@@ -822,6 +832,8 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err) ...@@ -822,6 +832,8 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
GNUTLS_LOG2 (level, max_log_level, "Received alert: ", str); GNUTLS_LOG2 (level, max_log_level, "Received alert: ", str);
} }
errno = errnum;
return ret; return ret;
} }
......
/* Copyright (C) 2018-2019 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h> #include <config.h>
#include <errno.h> #include <errno.h>
......
/* Header file for the portable dumper. /* Header file for the portable dumper.
Copyright (C) 2016 Free Software Foundation, Copyright (C) 2016, 2018-2019 Free Software Foundation, Inc.
Inc.
This file is part of GNU Emacs. This file is part of GNU Emacs.
......
...@@ -5840,7 +5840,8 @@ read_and_dispose_of_process_output (struct Lisp_Process *p, char *chars, ...@@ -5840,7 +5840,8 @@ read_and_dispose_of_process_output (struct Lisp_Process *p, char *chars,
/* Read pending output from the process channel, /* Read pending output from the process channel,
starting with our buffered-ahead character if we have one. starting with our buffered-ahead character if we have one.
Yield number of decoded characters read. Yield number of decoded characters read,
or -1 (setting errno) if there is a read error.
This function reads at most 4096 characters. This function reads at most 4096 characters.
If you want to read all available subprocess output, If you want to read all available subprocess output,
...@@ -5870,8 +5871,10 @@ read_process_output (Lisp_Object proc, int channel) ...@@ -5870,8 +5871,10 @@ read_process_output (Lisp_Object proc, int channel)
if (DATAGRAM_CHAN_P (channel)) if (DATAGRAM_CHAN_P (channel))
{ {
socklen_t len = datagram_address[channel].len; socklen_t len = datagram_address[channel].len;
do
nbytes = recvfrom (channel, chars + carryover, readmax, nbytes = recvfrom (channel, chars + carryover, readmax,
0, datagram_address[channel].sa, &len); 0, datagram_address[channel].sa, &len);
while (nbytes < 0 && errno == EINTR);
} }
else else
#endif #endif
...@@ -5921,8 +5924,6 @@ read_process_output (Lisp_Object proc, int channel) ...@@ -5921,8 +5924,6 @@ read_process_output (Lisp_Object proc, int channel)
p->decoding_carryover = 0; p->decoding_carryover = 0;
/* At this point, NBYTES holds number of bytes just received
(including the one in proc_buffered_char[channel]). */
if (nbytes <= 0) if (nbytes <= 0)
{ {
if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK) if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK)
...@@ -5930,6 +5931,9 @@ read_process_output (Lisp_Object proc, int channel) ...@@ -5930,6 +5931,9 @@ read_process_output (Lisp_Object proc, int channel)
coding->mode |= CODING_MODE_LAST_BLOCK; coding->mode |= CODING_MODE_LAST_BLOCK;
} }
/* At this point, NBYTES holds number of bytes just received
(including the one in proc_buffered_char[channel]). */
/* Ignore carryover, it's been added by a previous iteration already. */ /* Ignore carryover, it's been added by a previous iteration already. */
p->nbytes_read += nbytes; p->nbytes_read += nbytes;
...@@ -6372,9 +6376,17 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, ...@@ -6372,9 +6376,17 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
#ifdef DATAGRAM_SOCKETS #ifdef DATAGRAM_SOCKETS
if (DATAGRAM_CHAN_P (outfd)) if (DATAGRAM_CHAN_P (outfd))
{ {
rv = sendto (outfd, cur_buf, cur_len, while (true)
0, datagram_address[outfd].sa, {
rv = sendto (outfd, cur_buf, cur_len, 0,
datagram_address[outfd].sa,
datagram_address[outfd].len); datagram_address[outfd].len);
if (! (rv < 0 && errno == EINTR))
break;
if (pending_signals)
process_pending_signals ();
}
if (rv >= 0) if (rv >= 0)
written = rv; written = rv;
else if (errno == EMSGSIZE) else if (errno == EMSGSIZE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment