This patch is from upstream and shouldn't be needed in the next release. https://github.com/philj56/tofi/commit/667075f0920da3c2b353fbce54b6430c195ef031.patch From 667075f0920da3c2b353fbce54b6430c195ef031 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Sun, 30 Apr 2023 20:08:57 +0100 Subject: [PATCH] Replace `strto[u]l` with `strto[u]ll`. On 32-bit systems, using `strtoul` was causing negative values for unsigned options to be treated as valid, as the value was being parsed as a 32-bit unsigned int, then cast to a 64-bit signed int, which remained positive. --- src/color.c | 8 ++++---- src/config.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/color.c b/src/color.c index 4b6b356..b1d5e90 100644 --- a/src/color.c +++ b/src/color.c @@ -22,7 +22,7 @@ struct color hex_to_color(const char *hex) hex[2], hex[2], '\0'}; char *endptr; - tmp = strtol(str, &endptr, 16); + tmp = strtoll(str, &endptr, 16); if (errno || *endptr != '\0' || tmp < 0) { return (struct color) { -1, -1, -1, -1 }; } @@ -37,14 +37,14 @@ struct color hex_to_color(const char *hex) hex[3], hex[3], '\0'}; char *endptr; - tmp = strtol(str, &endptr, 16); + tmp = strtoll(str, &endptr, 16); if (errno || *endptr != '\0' || tmp < 0) { return (struct color) { -1, -1, -1, -1 }; } val = tmp; } else if (len == 6) { char *endptr; - tmp = strtol(hex, &endptr, 16); + tmp = strtoll(hex, &endptr, 16); if (errno || *endptr != '\0' || tmp < 0) { return (struct color) { -1, -1, -1, -1 }; } @@ -53,7 +53,7 @@ struct color hex_to_color(const char *hex) val |= 0xFFu; } else if (len == 8) { char *endptr; - tmp = strtol(hex, &endptr, 16); + tmp = strtoll(hex, &endptr, 16); if (errno || *endptr != '\0' || tmp < 0) { return (struct color) { -1, -1, -1, -1 }; } diff --git a/src/config.c b/src/config.c index 2b85028..556199d 100644 --- a/src/config.c +++ b/src/config.c @@ -1027,7 +1027,7 @@ uint32_t parse_uint32(const char *filename, size_t lineno, const char *str, bool { errno = 0; char *endptr; - int64_t ret = strtoul(str, &endptr, 0); + int64_t ret = strtoull(str, &endptr, 0); if (endptr == str || *endptr != '\0') { PARSE_ERROR(filename, lineno, "Failed to parse \"%s\" as unsigned int.\n", str); if (err) { @@ -1046,7 +1046,7 @@ int32_t parse_int32(const char *filename, size_t lineno, const char *str, bool * { errno = 0; char *endptr; - int64_t ret = strtol(str, &endptr, 0); + int64_t ret = strtoll(str, &endptr, 0); if (endptr == str || *endptr != '\0') { PARSE_ERROR(filename, lineno, "Failed to parse \"%s\" as int.\n", str); if (err) { @@ -1065,7 +1065,7 @@ struct uint32_percent parse_uint32_percent(const char *filename, size_t lineno, { errno = 0; char *endptr; - int64_t val = strtoul(str, &endptr, 0); + int64_t val = strtoull(str, &endptr, 0); bool percent = false; if (endptr == str || (*endptr != '\0' && *endptr != '%')) { PARSE_ERROR(filename, lineno, "Failed to parse \"%s\" as unsigned int.\n", str); t;https://issues.guix.gnu.org/44428>. * gnu/installer/newt.scm (init): Print screen size. * gnu/installer/newt/page.scm (default-listbox-height): New variable. (run-listbox-selection-page): Use it. * gnu/installer/newt/wifi.scm (wifi-listbox-height): Ditto. * gnu/installer/newt/network.scm (run-technology-page): Set the maximum listbox height to 5. * gnu/installer/newt/ethernet.scm (run-ethernet-page): Ditto. * gnu/installer/newt/final.scm (run-config-display-page): Change listbox height. * gnu/installer/newt/partition.scm (run-disk-page): Ditto. * gnu/installer/newt/welcome.scm (display-logo?): New procedure. (run-menu-page): Use it. * gnu/installer/steps.scm (%configuration-file-width): Remove it. Mathieu Othacehe 2020-04-06installer: Adapt to Guile-newt revision 2....* gnu/installer/newt/page.scm (run-input-page): Remove component argument that is not longer passed to the procedure passed to 'add-component-callback', (run-listbox-selection-page): ditto. * gnu/installer/newt/user.scm (run-user-add-page): Ditto, (run-user-add-page): ditto. Mathieu Othacehe 2020-03-05installer: Run commands without hopping through the shell....* gnu/installer/utils.scm (run-shell-command): Rename to... (run-command): Remove call to 'call-with-temporary-output-file' and hop through Bash. Expect COMMAND to be a list of strings rather than a string. * gnu/installer/final.scm (install-system): Turn INSTALL-COMMAND into a list of strings and pass it to 'run-command'. * gnu/installer/newt/page.scm (edit-file): Likewise. Ludovic Courtès 2020-03-05installer: Implement a dialog on /var/guix/installer-socket....This will allow us to automate testing of the installer. * gnu/installer/utils.scm (%client-socket-file) (current-server-socket, current-clients): New variables. (open-server-socket, call-with-server-socket): New procedure. (with-server-socket): New macro. (run-shell-command): Add call to 'send-to-clients'. Select on both current-input-port and current-clients. * gnu/installer/steps.scm (run-installer-steps): Wrap 'call-with-prompt' in 'with-socket-server'. Call 'sigaction' for SIGPIPE. * gnu/installer/newt/page.scm (watch-clients!, close-port-and-reuse-fd) (run-form-with-clients, send-to-clients): New procedures. (draw-info-page): Add call to 'run-form-with-clients'. (run-input-page): Likewise. Handle EXIT-REASON equal to 'exit-fd-ready. (run-confirmation-page): Likewise. (run-listbox-selection-page): Likewise. Define 'choice->item' and use it. (run-checkbox-tree-page): Likewise. (run-file-textbox-page): Add call to 'run-form-with-clients'. Handle 'exit-fd-ready'. * gnu/installer/newt/partition.scm (run-disk-page): Pass #:client-callback-procedure to 'run-listbox-selection-page'. * gnu/installer/newt/user.scm (run-user-page): Call 'run-form-with-clients'. Handle 'exit-fd-ready'. * gnu/installer/newt/welcome.scm (run-menu-page): Define 'choice->item' and use it. Call 'run-form-with-clients'. * gnu/installer/newt/final.scm (run-install-success-page) (run-install-failed-page): When (current-clients) is non-empty, call 'send-to-clients' without displaying a choice window. Ludovic Courtès