Hello community, here is the log from the commit of package sway for openSUSE:Factory checked in at 2017-12-29 18:52:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sway (Old) and /work/SRC/openSUSE:Factory/.sway.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sway" Fri Dec 29 18:52:06 2017 rev:12 rq:560253 version:0.15.1 Changes: -------- --- /work/SRC/openSUSE:Factory/sway/sway.changes 2017-12-14 10:56:45.269725564 +0100 +++ /work/SRC/openSUSE:Factory/.sway.new/sway.changes 2017-12-29 18:52:17.777000015 +0100 @@ -1,0 +2,16 @@ +Thu Dec 28 05:09:52 UTC 2017 - avin...@opensuse.org + +- bump to 0.15.1 + - Update to json-c 0.13 + - Documentation corrections + - Portability fixes + - Output scale now preserved upon reloads/hotplugs + - Closing fullscreen windows in nested containers no longer + crashes + - swaygrab more gracefully handles errors + - Fixes to some minor tray issues + - Fix security grants for swaylock -f + - Clear password buffer after checking it in swaylock +- partial cleanup with spec-cleaner + +------------------------------------------------------------------- Old: ---- sway-0.15.0.tar.gz sway-0.15.0.tar.gz.sig New: ---- sway-0.15.1.tar.gz sway-0.15.1.tar.gz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sway.spec ++++++ --- /var/tmp/diff_new_pack.535LKk/_old 2017-12-29 18:52:18.620757680 +0100 +++ /var/tmp/diff_new_pack.535LKk/_new 2017-12-29 18:52:18.620757680 +0100 @@ -16,7 +16,7 @@ # -%define basever 0.15.0 +%define basever 0.15.1 #%define prerelease rc1 %if 0%{?prerelease:0} @@ -83,7 +83,6 @@ %cmake_install %files -%defattr(-,root,root) %doc LICENSE README.md CONTRIBUTING.md %{_bindir}/%{name}* %dir %{_sysconfdir}/sway ++++++ sway-0.15.0.tar.gz -> sway-0.15.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/CMakeLists.txt new/sway-0.15.1/CMakeLists.txt --- old/sway-0.15.0/CMakeLists.txt 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/CMakeLists.txt 2017-12-17 21:53:22.000000000 +0100 @@ -48,7 +48,7 @@ add_definitions(-D_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}") endif() -find_package(JsonC 0.12.1 REQUIRED) +find_package(JsonC REQUIRED) find_package(PCRE REQUIRED) find_package(WLC REQUIRED) find_package(Wayland REQUIRED) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/README.de.md new/sway-0.15.1/README.de.md --- old/sway-0.15.0/README.de.md 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/README.de.md 2017-12-17 21:53:22.000000000 +0100 @@ -60,7 +60,7 @@ * libcap * asciidoc * pcre -* json-c <= 0.12.1 +* json-c * pango * cairo * gdk-pixbuf2 * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/README.el.md new/sway-0.15.1/README.el.md --- old/sway-0.15.0/README.el.md 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/README.el.md 2017-12-17 21:53:22.000000000 +0100 @@ -53,7 +53,7 @@ * libcap * asciidoc * pcre -* json-c <= 0.12.1 +* json-c * pango * cairo * gdk-pixbuf2 * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/README.fr.md new/sway-0.15.1/README.fr.md --- old/sway-0.15.0/README.fr.md 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/README.fr.md 2017-12-17 21:53:22.000000000 +0100 @@ -55,7 +55,7 @@ * libcap * asciidoc * pcre -* json-c <= 0.12.1 +* json-c * pango * cairo * gdk-pixbuf2 * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/README.it.md new/sway-0.15.1/README.it.md --- old/sway-0.15.0/README.it.md 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/README.it.md 2017-12-17 21:53:22.000000000 +0100 @@ -56,7 +56,7 @@ * libcap * asciidoc * pcre -* json-c <= 0.12.1 +* json-c * pango * cairo * gdk-pixbuf2 * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/README.ja.md new/sway-0.15.1/README.ja.md --- old/sway-0.15.0/README.ja.md 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/README.ja.md 2017-12-17 21:53:22.000000000 +0100 @@ -46,7 +46,7 @@ * libcap * asciidoc * pcre -* json-c <= 0.12.1 +* json-c * pango * cairo * gdk-pixbuf2 * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/README.md new/sway-0.15.1/README.md --- old/sway-0.15.0/README.md 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/README.md 2017-12-17 21:53:22.000000000 +0100 @@ -61,7 +61,7 @@ * libcap * asciidoc * pcre -* json-c <= 0.12.1 +* json-c * pango * cairo * gdk-pixbuf2 * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/README.pt.md new/sway-0.15.1/README.pt.md --- old/sway-0.15.0/README.pt.md 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/README.pt.md 2017-12-17 21:53:22.000000000 +0100 @@ -62,7 +62,7 @@ * libcap * asciidoc * pcre -* json-c <= 0.12.1 +* json-c * pango * cairo * gdk-pixbuf2 * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/README.ru.md new/sway-0.15.1/README.ru.md --- old/sway-0.15.0/README.ru.md 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/README.ru.md 2017-12-17 21:53:22.000000000 +0100 @@ -55,7 +55,7 @@ * libcap * asciidoc * pcre -* json-c <= 0.12.1 +* json-c * pango * cairo * gdk-pixbuf2 * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/README.uk.md new/sway-0.15.1/README.uk.md --- old/sway-0.15.0/README.uk.md 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/README.uk.md 2017-12-17 21:53:22.000000000 +0100 @@ -62,7 +62,7 @@ * libcap * asciidoc * pcre -* json-c <= 0.12.1 +* json-c * pango * cairo * gdk-pixbuf2 * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/include/sway_json_helper.h new/sway-0.15.1/include/sway_json_helper.h --- old/sway-0.15.0/include/sway_json_helper.h 1970-01-01 01:00:00.000000000 +0100 +++ new/sway-0.15.1/include/sway_json_helper.h 2017-12-17 21:53:22.000000000 +0100 @@ -0,0 +1,16 @@ +#ifndef _SWAY_JSON_HELPER_H +#define _SWAY_JSON_HELPER_H + +#include <json-c/json.h> + +// Macros for checking a specific version. +#define JSON_C_VERSION_013 (13 << 8) + +// json-c v0.13 uses size_t for array_list_length(). +#if defined(JSON_C_VERSION_NUM) && JSON_C_VERSION_NUM >= JSON_C_VERSION_013 +typedef size_t json_ar_len_t; +#else +typedef int json_ar_len_t; +#endif + +#endif // _SWAY_JSON_HELPER_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/include/swaygrab/json.h new/sway-0.15.1/include/swaygrab/json.h --- old/sway-0.15.0/include/swaygrab/json.h 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/include/swaygrab/json.h 2017-12-17 21:53:22.000000000 +0100 @@ -1,4 +1,4 @@ -#include <json-c/json.h> +#include "sway_json_helper.h" #include "wlc/wlc.h" void init_json_tree(int socketfd); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/sway/ipc-server.c new/sway-0.15.1/sway/ipc-server.c --- old/sway-0.15.0/sway/ipc-server.c 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/sway/ipc-server.c 2017-12-17 21:53:22.000000000 +0100 @@ -15,7 +15,6 @@ #include <stdlib.h> #include <sys/ioctl.h> #include <fcntl.h> -#include <json-c/json.h> #include <list.h> #include <libinput.h> #ifdef __linux__ @@ -25,6 +24,7 @@ gid_t gid; }; #endif +#include "sway_json_helper.h" #include "sway/ipc-json.h" #include "sway/ipc-server.h" #include "sway/security.h" @@ -724,7 +724,7 @@ } // parse requested event types - for (int i = 0; i < json_object_array_length(request); i++) { + for (json_ar_len_t i = 0; i < json_object_array_length(request); i++) { const char *event_type = json_object_get_string(json_object_array_get_idx(request, i)); if (strcmp(event_type, "workspace") == 0) { client->subscribed_events |= event_mask(IPC_EVENT_WORKSPACE); @@ -1126,7 +1126,8 @@ sway_log(L_DEBUG, "Sending binding::run event"); json_object *obj = json_object_new_object(); json_object_object_add(obj, "change", json_object_new_string("run")); - json_object_object_add(obj, "binding", sb_obj); + // sb_obj gets owned by the temporary json_object, too. + json_object_object_add(obj, "binding", json_object_get(sb_obj)); const char *json_string = json_object_to_json_string(obj); ipc_send_event(json_string, IPC_EVENT_BINDING); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/swaybar/status_line.c new/sway-0.15.1/swaybar/status_line.c --- old/sway-0.15.0/swaybar/status_line.c 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/swaybar/status_line.c 2017-12-17 21:53:22.000000000 +0100 @@ -2,8 +2,8 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <json-c/json.h> +#include "sway_json_helper.h" #include "swaybar/config.h" #include "swaybar/status_line.h" #include "log.h" @@ -70,8 +70,7 @@ bar->status->block_line = create_list(); - int i; - for (i = 0; i < json_object_array_length(results); ++i) { + for (json_ar_len_t i = 0; i < json_object_array_length(results); ++i) { json_object *full_text, *short_text, *color, *min_width, *align, *urgent; json_object *name, *instance, *separator, *separator_block_width; json_object *background, *border, *border_top, *border_bottom; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/swaygrab/json.c new/sway-0.15.1/swaygrab/json.c --- old/sway-0.15.0/swaygrab/json.c 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/swaygrab/json.c 2017-12-17 21:53:22.000000000 +0100 @@ -50,8 +50,7 @@ } else { json_object *nodes, *node, *child; json_object_object_get_ex(c, "nodes", &nodes); - int i; - for (i = 0; i < json_object_array_length(nodes); i++) { + for (json_ar_len_t i = 0; i < json_object_array_length(nodes); i++) { node = json_object_array_get_idx(nodes, i); if ((child = get_focused_container_r(node))) { @@ -60,7 +59,7 @@ } json_object_object_get_ex(c, "floating_nodes", &nodes); - for (i = 0; i < json_object_array_length(nodes); i++) { + for (json_ar_len_t i = 0; i < json_object_array_length(nodes); i++) { node = json_object_array_get_idx(nodes, i); if ((child = get_focused_container_r(node))) { @@ -83,7 +82,7 @@ if (!outputs) { sway_abort("Unabled to get focused output. No nodes in tree."); } - for (int i = 0; i < json_object_array_length(outputs); i++) { + for (json_ar_len_t i = 0; i < json_object_array_length(outputs); i++) { output = json_object_array_get_idx(outputs, i); if (get_focused_container_r(output)) { @@ -131,7 +130,7 @@ json_object *outputs, *json_output, *name; json_object_object_get_ex(tree, "nodes", &outputs); - for (int i = 0; i < json_object_array_length(outputs); i++) { + for (json_ar_len_t i = 0; i < json_object_array_length(outputs); i++) { json_output = json_object_array_get_idx(outputs, i); json_object_object_get_ex(json_output, "name", &name); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/swaylock/main.c new/sway-0.15.1/swaylock/main.c --- old/sway-0.15.0/swaylock/main.c 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/swaylock/main.c 2017-12-17 21:53:22.000000000 +0100 @@ -3,16 +3,17 @@ #include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon-names.h> #include <security/pam_appl.h> -#include <json-c/json.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <sys/mman.h> #include <sys/types.h> #include <pwd.h> #include <getopt.h> #include <signal.h> #include <stdbool.h> #include <unistd.h> +#include "sway_json_helper.h" #include "client/window.h" #include "client/registry.h" #include "client/cairo.h" @@ -56,8 +57,7 @@ exit(exit_code); } -char *password; -int password_size; +char password[1024]; enum line_source line_source = LINE_SOURCE_DEFAULT; struct lock_config *init_config() { @@ -115,7 +115,7 @@ switch (msg[i]->msg_style) { case PAM_PROMPT_ECHO_OFF: case PAM_PROMPT_ECHO_ON: - pam_reply[i].resp = password; + pam_reply[i].resp = strdup(password); // PAM clears and frees this break; case PAM_ERROR_MSG: @@ -127,9 +127,15 @@ return PAM_SUCCESS; } -/** - * Note: PAM will free() 'password' during the process - */ +void clear_password_buffer() { + // Use volatile keyword so so compiler can't optimize this out. + volatile char *pw = password; + volatile char zero = '\0'; + for (size_t i = 0; i < sizeof(password); ++i) { + pw[i] = zero; + } +} + bool verify_password() { struct passwd *passwd = getpwuid(getuid()); char *username = passwd->pw_name; @@ -151,8 +157,7 @@ void notify_key(enum wl_keyboard_key_state state, xkb_keysym_t sym, uint32_t code, uint32_t codepoint) { int redraw_screen = 0; - char *password_realloc; - int i; + size_t i; if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { switch (sym) { @@ -165,14 +170,14 @@ wl_dispatch_events(); if (verify_password()) { + clear_password_buffer(); exit(0); } render_data.auth_state = AUTH_STATE_INVALID; redraw_screen = 1; - password_size = 1024; - password = malloc(password_size); + clear_password_buffer(); password[0] = '\0'; break; case XKB_KEY_BackSpace: @@ -207,9 +212,7 @@ render_data.auth_state = AUTH_STATE_BACKSPACE; redraw_screen = 1; - password_size = 1024; - free(password); - password = malloc(password_size); + clear_password_buffer(); password[0] = '\0'; break; } @@ -218,22 +221,10 @@ render_data.auth_state = AUTH_STATE_INPUT; redraw_screen = 1; i = strlen(password); - if (i + 1 == password_size) { - password_size += 1024; - password_realloc = realloc(password, password_size); - // reset password if realloc fails. - if (password_realloc == NULL) { - password_size = 1024; - free(password); - password = malloc(password_size); - password[0] = '\0'; - break; - } else { - password = password_realloc; - } + if (i + 1 < sizeof(password)) { + password[i] = (char)codepoint; + password[i + 1] = '\0'; } - password[i] = (char)codepoint; - password[i + 1] = '\0'; break; } if (redraw_screen) { @@ -343,6 +334,7 @@ int main(int argc, char **argv) { const char *scaling_mode_str = "fit", *socket_path = NULL; + char *image_path = NULL; int i; void *images = NULL; config = init_config(); @@ -400,8 +392,6 @@ " For more information see `man swaylock`\n"; - registry = registry_poll(); - int c; while (1) { int option_index = 0; @@ -418,29 +408,7 @@ } case 'i': { - char *image_path = strchr(optarg, ':'); - if (image_path == NULL) { - if (render_data.num_images == 0) { - // Provided image without output - render_data.image = load_image(optarg); - render_data.num_images = -1; - } else { - sway_log(L_ERROR, "output must be defined for all --images or no --images"); - exit(EXIT_FAILURE); - } - } else { - // Provided image for all outputs - if (render_data.num_images == 0) { - images = calloc(registry->outputs->length, sizeof(char*) * 2); - } else if (render_data.num_images == -1) { - sway_log(L_ERROR, "output must be defined for all --images or no --images"); - exit(EXIT_FAILURE); - } - - image_path[0] = '\0'; - ((char**) images)[render_data.num_images * 2] = optarg; - ((char**) images)[render_data.num_images++ * 2 + 1] = ++image_path; - } + image_path = optarg; break; } case 't': @@ -519,6 +487,33 @@ exit(EXIT_FAILURE); } } + registry = registry_poll(); + + if (image_path) { + char *path = strchr(image_path, ':'); + if (path == NULL) { + if (render_data.num_images == 0) { + // Provided image without output + render_data.image = load_image(image_path); + render_data.num_images = -1; + } else { + sway_log(L_ERROR, "output must be defined for all --images or no --images"); + exit(EXIT_FAILURE); + } + } else { + // Provided image for all outputs + if (render_data.num_images == 0) { + images = calloc(registry->outputs->length, sizeof(char*) * 2); + } else if (render_data.num_images == -1) { + sway_log(L_ERROR, "output must be defined for all --images or no --images"); + exit(EXIT_FAILURE); + } + + path[0] = '\0'; + ((char**) images)[render_data.num_images * 2] = image_path; + ((char**) images)[render_data.num_images++ * 2 + 1] = ++path; + } + } render_data.scaling_mode = SCALING_MODE_STRETCH; if (strcmp(scaling_mode_str, "stretch") == 0) { @@ -535,8 +530,12 @@ sway_abort("Unsupported scaling mode: %s", scaling_mode_str); } - password_size = 1024; - password = malloc(password_size); +#ifdef __linux__ + // Most non-linux platforms require root to mlock() + if (mlock(password, sizeof(password)) != 0) { + sway_abort("Unable to mlock() password memory."); + } +#endif password[0] = '\0'; render_data.surfaces = create_list(); if (!socket_path) { @@ -584,7 +583,7 @@ for (i = 0; i < registry->outputs->length; ++i) { if (displays_paths[i * 2] != NULL) { - for (int j = 0;; ++j) { + for (json_ar_len_t j = 0;; ++j) { if (j >= json_object_array_length(json_outputs)) { sway_log(L_ERROR, "%s is not an extant output", displays_paths[i * 2]); exit(EXIT_FAILURE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sway-0.15.0/swaymsg/main.c new/sway-0.15.1/swaymsg/main.c --- old/sway-0.15.0/swaymsg/main.c 2017-11-07 00:16:22.000000000 +0100 +++ new/sway-0.15.1/swaymsg/main.c 2017-12-17 21:53:22.000000000 +0100 @@ -9,7 +9,7 @@ #include <sys/socket.h> #include <ctype.h> #include <unistd.h> -#include <json-c/json.h> +#include "sway_json_helper.h" #include "stringop.h" #include "ipc-client.h" #include "readline.h" @@ -149,7 +149,7 @@ static void pretty_print_clipboard(json_object *v) { if (success(v, true)) { if (json_object_is_type(v, json_type_array)) { - for (int i = 0; i < json_object_array_length(v); ++i) { + for (json_ar_len_t i = 0; i < json_object_array_length(v); ++i) { json_object *o = json_object_array_get_idx(v, i); printf("%s\n", json_object_get_string(o)); }