From 7cd15311ad942539c4168dda39dec92a977f9319 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:52:14 +0000 Subject: import plymouth-0.8.9-0.28.20140113.el7 --- diff --git a/SOURCES/0001-Revert-Make-boot.log-world-readable-by-default.patch b/SOURCES/0001-Revert-Make-boot.log-world-readable-by-default.patch new file mode 100644 index 0000000..d85ea20 --- /dev/null +++ b/SOURCES/0001-Revert-Make-boot.log-world-readable-by-default.patch @@ -0,0 +1,287 @@ +From a2c6a448d38a5150c593ca388eea8537ec0489ee Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Thu, 11 May 2017 11:10:36 -0400 +Subject: [PATCH] Revert "Make boot.log world readable by default" + +This reverts commit fc5cd88767db61805519fef53182386ba56c6405. +--- + src/libply/ply-logger.c | 16 ++-------------- + src/libply/ply-logger.h | 5 ++--- + src/libply/ply-terminal-session.c | 2 +- + 3 files changed, 5 insertions(+), 18 deletions(-) + +diff --git a/src/libply/ply-logger.c b/src/libply/ply-logger.c +index dfd5c0a..6f25801 100644 +--- a/src/libply/ply-logger.c ++++ b/src/libply/ply-logger.c +@@ -292,84 +292,72 @@ ply_logger_free_filters (ply_logger_t *logger) + next_node = ply_list_get_next_node (logger->filters, node); + free (filter); + node = next_node; + } + + ply_list_free (logger->filters); + } + + void + ply_logger_free (ply_logger_t *logger) + { + if (logger == NULL) + return; + + if (logger->output_fd >= 0) + { + if (ply_logger_is_logging (logger)) + ply_logger_flush (logger); + close (logger->output_fd); + } + + ply_logger_free_filters (logger); + + free (logger->filename); + free (logger->buffer); + free (logger); + } + + bool + ply_logger_open_file (ply_logger_t *logger, +- const char *filename, +- bool world_readable) ++ const char *filename) + { + int fd; +- mode_t mode; + + assert (logger != NULL); + assert (filename != NULL); + +- if (world_readable) +- mode = 0644; +- else +- mode = 0600; +- +- fd = open (filename, PLY_LOGGER_OPEN_FLAGS, mode); ++ fd = open (filename, PLY_LOGGER_OPEN_FLAGS, 0600); + + if (fd < 0) + return false; + +- if (fchmod (fd, mode) < 0) { +- close (fd); +- return false; +- } +- + ply_logger_set_output_fd (logger, fd); + + free (logger->filename); + + logger->filename = strdup (filename); + + return true; + } + + void + ply_logger_close_file (ply_logger_t *logger) + { + assert (logger != NULL); + + if (logger->output_fd < 0) + return; + + close (logger->output_fd); + ply_logger_set_output_fd (logger, -1); + } + + void + ply_logger_set_output_fd (ply_logger_t *logger, + int fd) + { + assert (logger != NULL); + + logger->output_fd = fd; + } + +diff --git a/src/libply/ply-logger.h b/src/libply/ply-logger.h +index 596bed5..fc25db9 100644 +--- a/src/libply/ply-logger.h ++++ b/src/libply/ply-logger.h +@@ -19,120 +19,119 @@ + */ + #ifndef PLY_LOGGER_H + #define PLY_LOGGER_H + + #include + #include + #include + #include + #include + #include + + typedef struct _ply_logger ply_logger_t; + + typedef enum + { + PLY_LOGGER_FLUSH_POLICY_WHEN_ASKED = 0, + PLY_LOGGER_FLUSH_POLICY_EVERY_TIME + } ply_logger_flush_policy_t; + + typedef void (* ply_logger_filter_handler_t) (void *user_data, + const void *in_bytes, + size_t in_size, + void **out_bytes, + size_t *out_size, + ply_logger_t *logger); + + #ifndef PLY_HIDE_FUNCTION_DECLARATIONS + ply_logger_t *ply_logger_new (void); + void ply_logger_free (ply_logger_t *logger); + bool ply_logger_open_file (ply_logger_t *logger, +- const char *filename, +- bool world_readable); ++ const char *filename); + void ply_logger_close_file (ply_logger_t *logger); + void ply_logger_set_output_fd (ply_logger_t *logger, + int fd); + int ply_logger_get_output_fd (ply_logger_t *logger); + bool ply_logger_flush (ply_logger_t *logger); + void ply_logger_set_flush_policy (ply_logger_t *logger, + ply_logger_flush_policy_t policy); + ply_logger_flush_policy_t ply_logger_get_flush_policy (ply_logger_t *logger); + void ply_logger_toggle_logging (ply_logger_t *logger); + bool ply_logger_is_logging (ply_logger_t *logger); + void ply_logger_inject_bytes (ply_logger_t *logger, + const void *bytes, + size_t number_of_bytes); + void ply_logger_add_filter (ply_logger_t *logger, + ply_logger_filter_handler_t filter_handler, + void *user_data); + #define ply_logger_inject(logger, format, args...) \ + ply_logger_inject_with_non_literal_format_string (logger, \ + format "", ##args) + __attribute__((__format__ (__printf__, 2, 3))) + void ply_logger_inject_with_non_literal_format_string (ply_logger_t *logger, + const char *format, ...); + + ply_logger_t *ply_logger_get_default (void); + ply_logger_t *ply_logger_get_error_default (void); + + /* tracing is a debugging facility that incurs a hefty performance hit on the + * program, so we conditionally compile support for it + */ + #ifdef PLY_ENABLE_TRACING + void ply_logger_toggle_tracing (ply_logger_t *logger); + bool ply_logger_is_tracing_enabled (ply_logger_t *logger); + + #define ply_logger_trace(logger, format, args...) \ + do \ + { \ + int _old_errno; \ + _old_errno = errno; \ + if (ply_logger_is_tracing_enabled (logger)) \ + { \ + ply_logger_flush (logger); \ + errno = _old_errno; \ + ply_logger_inject (logger, \ + "[%s:%d] %45.45s:" format "\r\n", \ + __FILE__, __LINE__, __func__, ##args); \ + ply_logger_flush (logger); \ + errno = _old_errno; \ + } \ + } \ + while (0) + #else + #define ply_logger_trace(logger, format, args...) + #define ply_logger_toggle_tracing(logger) + #define ply_logger_is_tracing_enabled(logger) (false) + #endif /* PLY_ENABLE_TRACING */ + + /* convenience macros + */ + #define ply_open_log_file(filename) \ +- ply_logger_open_file (ply_logger_get_default (), filename, false) ++ ply_logger_open_file (ply_logger_get_default (), filename) + #define ply_close_log_file() \ + ply_logger_close_file (ply_logger_get_default ()) + #define ply_flush_log() \ + ply_logger_flush (ply_logger_get_default ()) + #define ply_free_log() \ + ply_logger_free (ply_logger_get_default ()) + #define ply_log(format, args...) \ + ply_logger_inject (ply_logger_get_default (), format "\n", ##args) + #define ply_log_without_new_line(format, args...) \ + ply_logger_inject (ply_logger_get_default (), format, ##args) + #define ply_error(format, args...) \ + ply_logger_inject (ply_logger_get_error_default (), format "\n", ##args) + #define ply_error_without_new_line(format, args...) \ + ply_logger_inject (ply_logger_get_error_default (), format, ##args) + #define ply_free_error_log() \ + ply_logger_free (ply_logger_get_error_default ()) + + #define ply_toggle_tracing() \ + ply_logger_toggle_tracing (ply_logger_get_error_default ()) + #define ply_is_tracing() \ + ply_logger_is_tracing_enabled (ply_logger_get_error_default ()) + #define ply_trace(format, args...) \ + ply_logger_trace (ply_logger_get_error_default (), format, ##args) + + #endif + + #endif /* PLY_LOGGER_H */ + /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ +diff --git a/src/libply/ply-terminal-session.c b/src/libply/ply-terminal-session.c +index 143eed6..50ddd28 100644 +--- a/src/libply/ply-terminal-session.c ++++ b/src/libply/ply-terminal-session.c +@@ -542,48 +542,48 @@ ply_terminal_session_start_logging (ply_terminal_session_t *session) + } + + static void + ply_terminal_session_stop_logging (ply_terminal_session_t *session) + { + assert (session != NULL); + assert (session->logger != NULL); + + ply_trace ("stopping logging of incoming console messages"); + if (ply_logger_is_logging (session->logger)) + ply_logger_toggle_logging (session->logger); + + if (session->loop != NULL && + session->fd_watch != NULL) + ply_event_loop_stop_watching_fd (session->loop, + session->fd_watch); + session->fd_watch = NULL; + } + + bool + ply_terminal_session_open_log (ply_terminal_session_t *session, + const char *filename) + { + bool log_is_opened; + + assert (session != NULL); + assert (filename != NULL); + assert (session->logger != NULL); + + ply_save_errno (); +- log_is_opened = ply_logger_open_file (session->logger, filename, true); ++ log_is_opened = ply_logger_open_file (session->logger, filename); + if (log_is_opened) + ply_logger_flush (session->logger); + ply_restore_errno (); + + return log_is_opened; + } + + void + ply_terminal_session_close_log (ply_terminal_session_t *session) + { + assert (session != NULL); + assert (session->logger != NULL); + + return ply_logger_close_file (session->logger); + } + + /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ +-- +2.12.2 + diff --git a/SOURCES/0001-Revert-Recreate-boot-log-at-each-boot-instead-of-app.patch b/SOURCES/0001-Revert-Recreate-boot-log-at-each-boot-instead-of-app.patch new file mode 100644 index 0000000..b9c607e --- /dev/null +++ b/SOURCES/0001-Revert-Recreate-boot-log-at-each-boot-instead-of-app.patch @@ -0,0 +1,148 @@ +From 3edbaf6559eb81243326ebe79dc53b0759809a68 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Fri, 24 Mar 2017 15:31:51 -0400 +Subject: [PATCH] Revert "Recreate boot log at each boot instead of appending" + +This reverts commit 9abbd88835a181cda1427d61d92ef5685ad8a81b. +--- + src/libply/ply-logger.c | 2 +- + src/libply/ply-terminal-session.c | 5 ++--- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/libply/ply-logger.c b/src/libply/ply-logger.c +index 740c30e..dfd5c0a 100644 +--- a/src/libply/ply-logger.c ++++ b/src/libply/ply-logger.c +@@ -13,61 +13,61 @@ + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * Written by: Ray Strode + */ + #include "config.h" + #include "ply-logger.h" + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #include "ply-utils.h" + #include "ply-list.h" + + #ifndef PLY_LOGGER_OPEN_FLAGS +-#define PLY_LOGGER_OPEN_FLAGS (O_WRONLY | O_TRUNC | O_CREAT | O_NOFOLLOW | O_CLOEXEC) ++#define PLY_LOGGER_OPEN_FLAGS (O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW | O_CLOEXEC) + #endif + + #ifndef PLY_LOGGER_MAX_INJECTION_SIZE + #define PLY_LOGGER_MAX_INJECTION_SIZE 4096 + #endif + + #ifndef PLY_LOGGER_MAX_BUFFER_CAPACITY + #define PLY_LOGGER_MAX_BUFFER_CAPACITY (8 * 4096) + #endif + + typedef struct + { + ply_logger_filter_handler_t handler; + void *user_data; + } ply_logger_filter_t; + + struct _ply_logger + { + int output_fd; + char *filename; + + char *buffer; + size_t buffer_size; + size_t buffer_capacity; + + ply_logger_flush_policy_t flush_policy; + ply_list_t *filters; + + uint32_t is_enabled : 1; + uint32_t tracing_is_enabled : 1; +diff --git a/src/libply/ply-terminal-session.c b/src/libply/ply-terminal-session.c +index 379035c..143eed6 100644 +--- a/src/libply/ply-terminal-session.c ++++ b/src/libply/ply-terminal-session.c +@@ -531,60 +531,59 @@ ply_terminal_session_start_logging (ply_terminal_session_t *session) + + assert (session_fd >= 0); + + session->fd_watch = ply_event_loop_watch_fd (session->loop, + session_fd, + PLY_EVENT_LOOP_FD_STATUS_HAS_DATA, + (ply_event_handler_t) + ply_terminal_session_on_new_data, + (ply_event_handler_t) + ply_terminal_session_on_hangup, + session); + } + + static void + ply_terminal_session_stop_logging (ply_terminal_session_t *session) + { + assert (session != NULL); + assert (session->logger != NULL); + + ply_trace ("stopping logging of incoming console messages"); + if (ply_logger_is_logging (session->logger)) + ply_logger_toggle_logging (session->logger); + + if (session->loop != NULL && + session->fd_watch != NULL) + ply_event_loop_stop_watching_fd (session->loop, + session->fd_watch); + session->fd_watch = NULL; + } + +-bool ++bool + ply_terminal_session_open_log (ply_terminal_session_t *session, + const char *filename) + { + bool log_is_opened; + + assert (session != NULL); + assert (filename != NULL); + assert (session->logger != NULL); + + ply_save_errno (); +- unlink (filename); + log_is_opened = ply_logger_open_file (session->logger, filename, true); + if (log_is_opened) + ply_logger_flush (session->logger); + ply_restore_errno (); + + return log_is_opened; + } + +-void ++void + ply_terminal_session_close_log (ply_terminal_session_t *session) + { + assert (session != NULL); + assert (session->logger != NULL); + + return ply_logger_close_file (session->logger); + } + + /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ +-- +2.12.2 + diff --git a/SOURCES/bootlog b/SOURCES/bootlog new file mode 100644 index 0000000..a3f3207 --- /dev/null +++ b/SOURCES/bootlog @@ -0,0 +1,7 @@ +/var/log/boot.log +{ + missingok + daily + copytruncate + rotate 7 +} diff --git a/SPECS/plymouth.spec b/SPECS/plymouth.spec index 846a512..e767a80 100644 --- a/SPECS/plymouth.spec +++ b/SPECS/plymouth.spec @@ -7,13 +7,14 @@ Summary: Graphical Boot Animation and Logger Name: plymouth Version: 0.8.9 -Release: 0.26.20140113%{?dist} +Release: 0.28.20140113%{?dist} License: GPLv2+ Group: System Environment/Base Source0: http://freedesktop.org/software/plymouth/releases/%{name}-%{version}.tar.bz2 Source1: boot-duration Source2: charge.plymouth Source3: plymouth-update-initrd +Source4: bootlog URL: http://www.freedesktop.org/wiki/Software/Plymouth BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -55,6 +56,8 @@ Patch14: ensure-output-gets-terminal.patch Patch15: activate-new-renderers.patch Patch16: fix-progress-bar-colors.patch Patch17: fix-escape-key-for-media-check.patch +Patch18: 0001-Revert-Recreate-boot-log-at-each-boot-instead-of-app.patch +Patch19: 0001-Revert-Make-boot.log-world-readable-by-default.patch Patch99: colors.patch %description @@ -233,7 +236,7 @@ Provides: plymouth(system-theme) = %{version}-%{release} %description theme-charge This package contains the "charge" boot splash theme for -Plymouth. It is the default theme for CentOS Linux. +Plymouth. It is the default theme for Red Hat Enterprise Linux. %package plugin-script Summary: Plymouth "script" plugin @@ -289,6 +292,8 @@ Plymouth. It features a small spinner on a dark background. %patch15 -p1 -b .activate-new-renderers %patch16 -p1 -b .fix-progress-bar-colors %patch17 -p1 -b .fix-escape-key-for-media-check +%patch18 -p1 -b .dont-truncate-boot.log +%patch19 -p1 -b .dont-change-boot.log-file-mode %patch99 -p1 -b .colors # Change the default theme @@ -345,6 +350,9 @@ sed -i -e 's/tribar/text/' $RPM_BUILD_ROOT%{_datadir}/plymouth/themes/text/text. cp $RPM_SOURCE_DIR/plymouth-update-initrd $RPM_BUILD_ROOT%{_libexecdir}/plymouth/plymouth-update-initrd +install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d +install -p -m 644 $RPM_SOURCE_DIR/bootlog $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/bootlog + %clean rm -rf $RPM_BUILD_ROOT @@ -434,6 +442,7 @@ fi %dir %{_libdir}/plymouth/renderers %dir %{_sysconfdir}/plymouth %config(noreplace) %{_sysconfdir}/plymouth/plymouthd.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/bootlog %{plymouthdaemon_execdir}/plymouthd %{plymouthclient_execdir}/plymouth %{_bindir}/plymouth @@ -553,8 +562,16 @@ fi %defattr(-, root, root) %changelog -* Thu Nov 03 2016 CentOS Sources - 0.8.9-0.26.20140113.el7.centos -- Roll in Branding Change in the SPEC +* Thu May 11 2017 Ray Strode - 0.8.9-0.28.20140113 +- Don't change file mode of boot.log. Instead, remember what mode + the admin set it to. + Related: #916704 +- Don't unlink boot.log before opening it. + Related: #916704 + +* Fri Mar 24 2017 Ray Strode - 0.8.3-27.20140113 +- Don't truncate boot.log. Rely on logrotate.d to carve it up. + Resolves: #916704 * Fri Jul 01 2016 Ray Strode - 0.8.9-0.26.20140113 - Fix color of text progress bar