Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package tio for openSUSE:Factory checked in at 2022-12-29 13:09:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/tio (Old) and /work/SRC/openSUSE:Factory/.tio.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tio" Thu Dec 29 13:09:34 2022 rev:12 rq:1045647 version:2.5 Changes: -------- --- /work/SRC/openSUSE:Factory/tio/tio.changes 2022-12-05 18:00:54.084483644 +0100 +++ /work/SRC/openSUSE:Factory/.tio.new.1563/tio.changes 2022-12-29 13:09:36.777111912 +0100 @@ -1,0 +2,17 @@ +Wed Dec 28 12:38:35 UTC 2022 - Dirk Müller <dmuel...@suse.com> + +- update to 2.5: + * Update configuration file documentation + Rename .tiorc to .tioconfig, tiorc to config, etc. + * Add support for $HOME/.tioconfig + Replaces what used to be $HOME/.tiorc + * Fix double prefix key regression + * Better error checking in config file, rename the file + Accept "true", "enable", "on", "yes", "1" as true values, their + counterparts as false ones. Check integer values for errors and range. + Warn about ignored (e.g. misspelled) options. + Check getenv() return value for NULL. + Rename "tiorc" to "config", as it's a static INI file, not an executable + "run commands". + +------------------------------------------------------------------- Old: ---- tio-2.4.tar.xz New: ---- tio-2.5.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ tio.spec ++++++ --- /var/tmp/diff_new_pack.UJjudi/_old 2022-12-29 13:09:37.389115527 +0100 +++ /var/tmp/diff_new_pack.UJjudi/_new 2022-12-29 13:09:37.393115551 +0100 @@ -17,7 +17,7 @@ Name: tio -Version: 2.4 +Version: 2.5 Release: 0 Summary: Simple TTY terminal I/O application License: GPL-2.0-or-later ++++++ tio-2.4.tar.xz -> tio-2.5.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/AUTHORS new/tio-2.5/AUTHORS --- old/tio-2.4/AUTHORS 2022-12-02 13:05:00.000000000 +0100 +++ new/tio-2.5/AUTHORS 2022-12-17 17:11:22.000000000 +0100 @@ -41,5 +41,6 @@ Ralph Siemsen <ral...@netwinder.org> Victor Oliveira <rhapso...@gmail.com> Attila Veghelyi <aveghe...@dension.com> +Vyacheslav Patkov <sl...@patkov.ru> Thanks to everyone who has contributed to this project. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/NEWS new/tio-2.5/NEWS --- old/tio-2.4/NEWS 2022-12-02 13:05:00.000000000 +0100 +++ new/tio-2.5/NEWS 2022-12-17 17:11:22.000000000 +0100 @@ -1,5 +1,32 @@ -=== tio v2.4 === +=== tio v2.5 === + + + +Changes since tio v2.4: + + * Update configuration file documentation + + Rename .tiorc to .tioconfig, tiorc to config, etc. + + * Add support for $HOME/.tioconfig + + Replaces what used to be $HOME/.tiorc + + * Fix double prefix key regression + +Vyacheslav Patkov: + + * Better error checking in config file, rename the file + + Accept "true", "enable", "on", "yes", "1" as true values, their + counterparts as false ones. Check integer values for errors and range. + Warn about ignored (e.g. misspelled) options. + + Check getenv() return value for NULL. + + Rename "tiorc" to "config", as it's a static INI file, not an executable + "run commands". diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/README.md new/tio-2.5/README.md --- old/tio-2.4/README.md 2022-12-02 13:05:00.000000000 +0100 +++ new/tio-2.5/README.md 2022-12-17 17:11:22.000000000 +0100 @@ -198,9 +198,9 @@ Options can be set via the configuration file first found in any of the following locations in the order listed: - - $XDG_CONFIG_HOME/tio/tiorc - - $HOME/.config/tio/tiorc - - $HOME/.tiorc + - $XDG_CONFIG_HOME/tio/config + - $HOME/.config/tio/config + - $HOME/.tioconfig The configuration file supports sub-configurations using named sections which can be activated via the command-line by name or pattern. A sub-configuration @@ -240,7 +240,7 @@ $ tio usb12 ``` -Another more elaborate configuration file example is available [here](example/tiorc). +Another more elaborate configuration file example is available [here](example/config). ## 4. Installation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/example/config new/tio-2.5/example/config --- old/tio-2.4/example/config 1970-01-01 01:00:00.000000000 +0100 +++ new/tio-2.5/example/config 2022-12-17 17:11:22.000000000 +0100 @@ -0,0 +1,64 @@ +############################### +# tio - https://tio.github.io # +############################### + +# Example tio configuration file +# +# Place file in any of the following locations: +# $XDG_CONFIG_HOME/tio/config +# $HOME/.config/tio/config +# $HOME/.tioconfig + +# Defaults +baudrate = 115200 +databits = 8 +flow = none +stopbits = 1 +parity = none +prefix-ctrl-key = t +output-delay = 0 +output-line-delay = 0 +no-autoconnect = disable +hexadecimal = disable +timestamp = disable +log = disable +log-strip = disable +local-echo = disable +color = bold +rs-485 = disable +response-wait = disable +alert = none + +# Sub-configuraions + +[rpi3] +baudrate = 115200 +device = /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A6009HU3-if00-port0 +socket = unix:/tmp/tio-socket-0 +color = 9 + +[am64-evm] +baudrate = 115200 +device = /dev/serial/by-id/usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_01093176-if01-port0 +line-pulse-duration = DTR=200,RTS=300,RI=50 +alert = bell +color = 10 + +[tincan] +baudrate = 9600 +device = /dev/serial/by-id/usb-TinCanTools_Flyswatter2_FS20000-if00-port0 +log = enable +log-file = tincan.log +log-strip = enable +color = 11 + +[usb] +pattern = usb([0-9]*) +device = /dev/ttyUSB%s +color = 12 + +[rs-485-device] +device = /dev/ttyUSB0 +rs-485 = enable +rs-485-config = RTS_ON_SEND=1,RTS_AFTER_SEND=1,RTS_DELAY_BEFORE_SEND=60,RTS_DELAY_AFTER_SEND=80,RX_DURING_TX +color = 13 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/example/tiorc new/tio-2.5/example/tiorc --- old/tio-2.4/example/tiorc 2022-12-02 13:05:00.000000000 +0100 +++ new/tio-2.5/example/tiorc 1970-01-01 01:00:00.000000000 +0100 @@ -1,59 +0,0 @@ -############################### -# tio - https://tio.github.io # -############################### - -# Example configuration file - -# Defaults -baudrate = 115200 -databits = 8 -flow = none -stopbits = 1 -parity = none -prefix-ctrl-key = t -output-delay = 0 -output-line-delay = 0 -no-autoconnect = disable -hexadecimal = disable -timestamp = disable -log = disable -log-strip = disable -local-echo = disable -color = bold -rs-485 = disable -response-wait = disable -alert = none - -# Sub-configuraions - -[rpi3] -baudrate = 115200 -device = /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A6009HU3-if00-port0 -socket = unix:/tmp/tio-socket-0 -color = 9 - -[am64-evm] -baudrate = 115200 -device = /dev/serial/by-id/usb-Silicon_Labs_CP2105_Dual_USB_to_UART_Bridge_Controller_01093176-if01-port0 -line-pulse-duration = DTR=200,RTS=300,RI=50 -alert = bell -color = 10 - -[tincan] -baudrate = 9600 -device = /dev/serial/by-id/usb-TinCanTools_Flyswatter2_FS20000-if00-port0 -log = enable -log-file = tincan.log -log-strip = enable -color = 11 - -[usb] -pattern = usb([0-9]*) -device = /dev/ttyUSB%s -color = 12 - -[rs-485-device] -device = /dev/ttyUSB0 -rs-485 = enable -rs-485-config = RTS_ON_SEND=1,RTS_AFTER_SEND=1,RTS_DELAY_BEFORE_SEND=60,RTS_DELAY_AFTER_SEND=80,RX_DURING_TX -color = 13 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/man/tio.1.in new/tio-2.5/man/tio.1.in --- old/tio-2.4/man/tio.1.in 2022-12-02 13:05:00.000000000 +0100 +++ new/tio-2.5/man/tio.1.in 2022-12-17 17:11:22.000000000 +0100 @@ -332,11 +332,11 @@ listed: .PP -.I $XDG_CONFIG_HOME/tio/tiorc +.I $XDG_CONFIG_HOME/tio/config .PP -.I $HOME/.config/tio/tiorc +.I $HOME/.config/tio/config .PP -.I $HOME/.tiorc +.I $HOME/.tioconfig .PP Labels can be used to group settings into named sub-configurations which can be diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/man/tio.1.txt new/tio-2.5/man/tio.1.txt --- old/tio-2.4/man/tio.1.txt 2022-12-02 13:05:00.000000000 +0100 +++ new/tio-2.5/man/tio.1.txt 2022-12-17 17:11:22.000000000 +0100 @@ -1,4 +1,4 @@ -tio(1) User Commands tio(1) +tio(1) User Commands tio(1) NAME tio - a simple serial device I/O tool @@ -66,7 +66,8 @@ Disable automatic connect. - By default tio automatically connects to the provided device if present. If the device is not present, it will wait for it to appear and then connect. If the connection is lost (eg. device disconnects), it will wait for the device to reappear and then reconnect. + By default tio automatically connects to the provided device if present. If the device is not present, it will wait for it to appear and then connect. If the connection is lost (eg. device disconnects), it will wait for the device to + reappear and then reconnect. However, if the --no-autoconnect option is provided, tio will exit if the device is not present or an established connection is lost. @@ -150,8 +151,8 @@ Redirect I/O to socket. - Any input from clients connected to the socket is sent on the serial port as if entered at the terminal where tio is running (except that ctrl-t sequences are not recognized), and any input from the serial port is multiplexed to the terminal and all connected - clients. + Any input from clients connected to the socket is sent on the serial port as if entered at the terminal where tio is running (except that ctrl-t sequences are not recognized), and any input from the serial port is multiplexed to the + terminal and all connected clients. Sockets remain open while the serial port is disconnected, and writes will block. @@ -258,11 +259,11 @@ CONFIGURATION FILE Options can be set via configuration file using the INI format. tio uses the configuration file first found in the following locations in the order listed: - $XDG_CONFIG_HOME/tio/tiorc + $XDG_CONFIG_HOME/tio/config - $HOME/.config/tio/tiorc + $HOME/.config/tio/config - $HOME/.tiorc + $HOME/.tioconfig Labels can be used to group settings into named sub-configurations which can be activated from the command-line when starting tio. @@ -443,4 +444,4 @@ AUTHOR Created by Martin Lund <martin.l...@keep-it-simple.com>. -tio 2.4 2022-11-02 tio(1) +tio 2.5 2022-11-02 tio(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/meson.build new/tio-2.5/meson.build --- old/tio-2.4/meson.build 2022-12-02 13:05:00.000000000 +0100 +++ new/tio-2.5/meson.build 2022-12-17 17:11:22.000000000 +0100 @@ -1,12 +1,12 @@ project('tio', 'c', - version : '2.4', + version : '2.5', license : [ 'GPL-2'], meson_version : '>= 0.53.2', default_options : [ 'warning_level=2', 'buildtype=release', 'c_std=gnu99' ] ) # The tag date of the project_version(), update when the version bumps. -version_date = '2022-11-02' +version_date = '2022-12-17' # Test for dynamic baudrate configuration interface compiler = meson.get_compiler('c') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/src/configfile.c new/tio-2.5/src/configfile.c --- old/tio-2.4/src/configfile.c 2022-12-02 13:05:00.000000000 +0100 +++ new/tio-2.5/src/configfile.c 2022-12-17 17:11:22.000000000 +0100 @@ -98,6 +98,40 @@ return len; } +static bool read_boolean(const char *value, const char *name) +{ + const char *true_values[] = { "true", "enable", "on", "yes", "1", NULL }; + const char *false_values[] = { "false", "disable", "off", "no", "0", NULL }; + + for (int i = 0; true_values[i] != NULL; i++) + if (strcmp(value, true_values[i]) == 0) + return true; + + for (int i = 0; false_values[i] != NULL; i++) + if (strcmp(value, false_values[i]) == 0) + return false; + + tio_error_printf("Invalid value '%s' for option '%s' in configuration file", + value, name); + exit(EXIT_FAILURE); +} + +static long read_integer(const char *value, const char *name, long min_value, long max_value) +{ + errno = 0; + char *endptr; + long result = strtol(value, &endptr, 10); + + if (errno || endptr == value || *endptr != '\0' || result < min_value || result > max_value) + { + tio_error_printf("Invalid value '%s' for option '%s' in configuration file", + value, name); + exit(EXIT_FAILURE); + } + + return result; +} + /** * data_handler() - walk config file to load parameters matching user input * @@ -119,11 +153,11 @@ } else if (!strcmp(name, "baudrate")) { - option.baudrate = string_to_long((char *)value); + option.baudrate = read_integer(value, name, 0, LONG_MAX); } else if (!strcmp(name, "databits")) { - option.databits = atoi(value); + option.databits = read_integer(value, name, 5, 8); } else if (!strcmp(name, "flow")) { @@ -132,7 +166,7 @@ } else if (!strcmp(name, "stopbits")) { - option.stopbits = atoi(value); + option.stopbits = read_integer(value, name, 1, 2); } else if (!strcmp(name, "parity")) { @@ -141,11 +175,11 @@ } else if (!strcmp(name, "output-delay")) { - option.output_delay = atoi(value); + option.output_delay = read_integer(value, name, 0, LONG_MAX); } else if (!strcmp(name, "output-line-delay")) { - option.output_line_delay = atoi(value); + option.output_line_delay = read_integer(value, name, 0, LONG_MAX); } else if (!strcmp(name, "line-pulse-duration")) { @@ -153,25 +187,11 @@ } else if (!strcmp(name, "no-autoconnect")) { - if (!strcmp(value, "enable")) - { - option.no_autoconnect = true; - } - else if (!strcmp(value, "disable")) - { - option.no_autoconnect = false; - } + option.no_autoconnect = read_boolean(value, name); } else if (!strcmp(name, "log")) { - if (!strcmp(value, "enable")) - { - option.log = true; - } - else if (!strcmp(value, "disable")) - { - option.log = false; - } + option.log = read_boolean(value, name); } else if (!strcmp(name, "log-file")) { @@ -180,47 +200,20 @@ } else if (!strcmp(name, "log-strip")) { - if (!strcmp(value, "enable")) - { - option.log_strip = true; - } - else if (!strcmp(value, "disable")) - { - option.log_strip = false; - } + option.log_strip = read_boolean(value, name); } else if (!strcmp(name, "local-echo")) { - if (!strcmp(value, "enable")) - { - option.local_echo = true; - } - else if (!strcmp(value, "disable")) - { - option.local_echo = false; - } + option.local_echo = read_boolean(value, name); } else if (!strcmp(name, "hexadecimal")) { - if (!strcmp(value, "enable")) - { - option.hex_mode = true; - } - else if (!strcmp(value, "disable")) - { - option.hex_mode = false; - } + option.hex_mode = read_boolean(value, name); } else if (!strcmp(name, "timestamp")) { - if (!strcmp(value, "enable")) - { - option.timestamp = TIMESTAMP_24HOUR; - } - else if (!strcmp(value, "disable")) - { - option.timestamp = TIMESTAMP_NONE; - } + option.timestamp = read_boolean(value, name) ? + TIMESTAMP_24HOUR : TIMESTAMP_NONE; } else if (!strcmp(name, "timestamp-format")) { @@ -270,29 +263,15 @@ } else if (!strcmp(name, "response-wait")) { - if (!strcmp(value, "enable")) - { - option.response_wait = true; - } - else if (!strcmp(value, "disable")) - { - option.response_wait = false; - } + option.response_wait = read_boolean(value, name); } else if (!strcmp(name, "response-timeout")) { - option.response_timeout = atoi(value); + option.response_timeout = read_integer(value, name, 0, LONG_MAX); } else if (!strcmp(name, "rs-485")) { - if (!strcmp(value, "enable")) - { - option.rs485 = true; - } - else if (!strcmp(value, "disable")) - { - option.rs485 = false; - } + option.rs485 = read_boolean(value, name); } else if (!strcmp(name, "rs-485-config")) { @@ -304,14 +283,11 @@ } else if (!strcmp(name, "mute")) { - if (!strcmp(value, "enable")) - { - option.mute = true; - } - else if (!strcmp(value, "disable")) - { - option.mute = false; - } + option.mute = read_boolean(value, name); + } + else + { + tio_warning_printf("Unknown option '%s' in configuration file, ignored", name); } } @@ -389,32 +365,36 @@ static int resolve_config_file(void) { - asprintf(&c.path, "%s/tio/tiorc", getenv("XDG_CONFIG_HOME")); - if (!access(c.path, F_OK)) + char *xdg = getenv("XDG_CONFIG_HOME"); + if (xdg) { - return 0; + asprintf(&c.path, "%s/tio/config", xdg); + if (access(c.path, F_OK) == 0) + { + return 0; + } + free(c.path); } - free(c.path); - - asprintf(&c.path, "%s/.config/tio/tiorc", getenv("HOME")); - if (!access(c.path, F_OK)) + char *home = getenv("HOME"); + if (home) { - return 0; - } - - free(c.path); + asprintf(&c.path, "%s/.config/tio/config", home); + if (access(c.path, F_OK) == 0) + { + return 0; + } + free(c.path); - asprintf(&c.path, "%s/.tiorc", getenv("HOME")); - if (!access(c.path, F_OK)) - { - return 0; + asprintf(&c.path, "%s/.tioconfig", home); + if (access(c.path, F_OK) == 0) + { + return 0; + } + free(c.path); } - free(c.path); - c.path = NULL; - return -EINVAL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tio-2.4/src/tty.c new/tio-2.5/src/tty.c --- old/tio-2.4/src/tty.c 2022-12-02 13:05:00.000000000 +0100 +++ new/tio-2.5/src/tty.c 2022-12-17 17:11:22.000000000 +0100 @@ -306,10 +306,16 @@ if (previous_char == option.prefix_code) { + if (input_char == option.prefix_code) + { + previous_char = 0; + continue; + } + switch (input_char) { case KEY_Q: - exit(EXIT_FAILURE); + exit(EXIT_SUCCESS); break; case KEY_SHIFT_F: tio_printf("Flushed data I/O channels")