Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ipcalc for openSUSE:Factory checked in at 2023-07-03 17:43:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ipcalc (Old) and /work/SRC/openSUSE:Factory/.ipcalc.new.13546 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ipcalc" Mon Jul 3 17:43:30 2023 rev:8 rq:1096356 version:1.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/ipcalc/ipcalc.changes 2023-01-30 17:23:18.996518614 +0100 +++ /work/SRC/openSUSE:Factory/.ipcalc.new.13546/ipcalc.changes 2023-07-03 17:43:40.133030657 +0200 @@ -1,0 +2,8 @@ +Tue Jun 27 15:11:20 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 1.0.3: + * When --no-decorate is given the default output will + * include no colors + * Correctly split networks with /31 + +------------------------------------------------------------------- Old: ---- ipcalc-1.0.2.tar.bz2 New: ---- ipcalc-1.0.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ipcalc.spec ++++++ --- /var/tmp/diff_new_pack.HvkL7s/_old 2023-07-03 17:43:40.817034685 +0200 +++ /var/tmp/diff_new_pack.HvkL7s/_new 2023-07-03 17:43:40.825034731 +0200 @@ -17,7 +17,7 @@ Name: ipcalc -Version: 1.0.2 +Version: 1.0.3 Release: 0 Summary: IPv4/IPv6 tool assisting in network calculations on the command line License: GPL-2.0-or-later ++++++ ipcalc-1.0.2.tar.bz2 -> ipcalc-1.0.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/NEWS new/ipcalc-1.0.3/NEWS --- old/ipcalc-1.0.2/NEWS 2022-11-26 16:07:41.000000000 +0100 +++ new/ipcalc-1.0.3/NEWS 2023-06-07 15:43:14.000000000 +0200 @@ -1,3 +1,9 @@ +* Version 1.0.3 (released 2023-06-07) +- When --no-decorate is given the default output will + include no colors (#28) +- Correctly split networks with /31 (#25) + + * Version 1.0.2 (released 2022-11-26) - Fix ULA prefix generator to use only defined ULA range - Corrected manpage generation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/ipcalc.c new/ipcalc-1.0.3/ipcalc.c --- old/ipcalc-1.0.2/ipcalc.c 2022-11-26 16:07:41.000000000 +0100 +++ new/ipcalc-1.0.3/ipcalc.c 2023-06-07 15:43:14.000000000 +0200 @@ -1310,6 +1310,55 @@ return; } +/* Always prints "title: value", will not color if --no-decorate is given + */ +static void +__attribute__ ((format(printf, 4, 5))) +pretty_printf(unsigned * const jsonfirst, const char *title, const char *jsontitle, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + if (flags & FLAG_JSON) { + va_json_printf(jsonfirst, jsontitle, fmt, args); + } else if (flags & FLAG_NO_DECORATE) { + fputs(title, stdout); + vprintf(fmt, args); + fputs("\n", stdout); + } else { + va_color_printf(KBLUE, title, fmt, args); + } + va_end(args); + + return; +} + +/* Always prints "title: value", will not color if --no-decorate is given + * To be used for distinct values (e.g., a summary). + */ +static void +__attribute__ ((format(printf, 4, 5))) +pretty_dist_printf(unsigned * const jsonfirst, const char *title, const char *jsontitle, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + if (flags & FLAG_JSON) { + va_json_printf(jsonfirst, jsontitle, fmt, args); + } else if (flags & FLAG_NO_DECORATE) { + fputs(title, stdout); + vprintf(fmt, args); + fputs("\n", stdout); + } else { + va_color_printf(KMAG, title, fmt, args); + } + va_end(args); + + return; +} + +/* Prints "title: value", will only print value if --no-decorate is given + */ void __attribute__ ((format(printf, 4, 5))) default_printf(unsigned * const jsonfirst, const char *title, const char *jsontitle, const char *fmt, ...) @@ -1317,11 +1366,11 @@ va_list args; va_start(args, fmt); - if (flags & FLAG_NO_DECORATE) { + if (flags & FLAG_JSON) { + va_json_printf(jsonfirst, jsontitle, fmt, args); + } else if (flags & FLAG_NO_DECORATE) { vprintf(fmt, args); printf("\n"); - } else if (flags & FLAG_JSON) { - va_json_printf(jsonfirst, jsontitle, fmt, args); } else { va_color_printf(KBLUE, title, fmt, args); } @@ -1330,6 +1379,9 @@ return; } +/* Prints "title: value", will only print value if --no-decorate is given. It + * prints a distinct value (e.g., to be used for a summary). + */ void __attribute__ ((format(printf, 4, 5))) dist_printf(unsigned * const jsonfirst, const char *title, const char *jsontitle, const char *fmt, ...) @@ -1340,7 +1392,10 @@ if (flags & FLAG_JSON) { va_json_printf(jsonfirst, jsontitle, fmt, args); } - else { + else if (flags & FLAG_NO_DECORATE) { + vprintf(fmt, args); + printf("\n"); + } else { va_color_printf(KMAG, title, fmt, args); } va_end(args); @@ -1726,79 +1781,79 @@ if ((!randomStr || single_host) && (single_host || strcmp(info.network, info.ip) != 0)) { if (info.expanded_ip) { - default_printf(&jsonchain,"Full Address:\t", FULL_ADDRESS_NAME, "%s", info.expanded_ip); + pretty_printf(&jsonchain,"Full Address:\t", FULL_ADDRESS_NAME, "%s", info.expanded_ip); } - default_printf(&jsonchain, "Address:\t", ADDRESS_NAME, "%s", info.ip); + pretty_printf(&jsonchain, "Address:\t", ADDRESS_NAME, "%s", info.ip); } if (single_host && info.hostname) - default_printf(&jsonchain, "Hostname:\t", HOSTNAME_NAME, "%s", info.hostname); + pretty_printf(&jsonchain, "Hostname:\t", HOSTNAME_NAME, "%s", info.hostname); if (!single_host || (flags & FLAG_JSON)) { if (! (flags & FLAG_JSON)) { if (info.expanded_network) { - default_printf(&jsonchain, "Full Network:\t", FULL_NETWORK_NAME, "%s/%u", info.expanded_network, info.prefix); + pretty_printf(&jsonchain, "Full Network:\t", FULL_NETWORK_NAME, "%s/%u", info.expanded_network, info.prefix); } - default_printf(&jsonchain, "Network:\t", NETWORK_NAME, "%s/%u", info.network, info.prefix); - default_printf(&jsonchain, "Netmask:\t", NETMASK_NAME, "%s = %u", info.netmask, info.prefix); + pretty_printf(&jsonchain, "Network:\t", NETWORK_NAME, "%s/%u", info.network, info.prefix); + pretty_printf(&jsonchain, "Netmask:\t", NETMASK_NAME, "%s = %u", info.netmask, info.prefix); } else { if (info.expanded_network) { - default_printf(&jsonchain, "Full Network:\t", FULL_NETWORK_NAME, "%s", info.expanded_network); + pretty_printf(&jsonchain, "Full Network:\t", FULL_NETWORK_NAME, "%s", info.expanded_network); } - default_printf(&jsonchain, "Network:\t", NETWORK_NAME, "%s", info.network); - default_printf(&jsonchain, "Netmask:\t", NETMASK_NAME, "%s", info.netmask); - default_printf(&jsonchain, "Prefix:\t", PREFIX_NAME, "%u", info.prefix); + pretty_printf(&jsonchain, "Network:\t", NETWORK_NAME, "%s", info.network); + pretty_printf(&jsonchain, "Netmask:\t", NETMASK_NAME, "%s", info.netmask); + pretty_printf(&jsonchain, "Prefix:\t", PREFIX_NAME, "%u", info.prefix); } if (info.broadcast) - default_printf(&jsonchain, "Broadcast:\t", BROADCAST_NAME, "%s", info.broadcast); + pretty_printf(&jsonchain, "Broadcast:\t", BROADCAST_NAME, "%s", info.broadcast); } if ((flags & FLAG_SHOW_ALL_INFO) && info.reverse_dns) - default_printf(&jsonchain, "Reverse DNS:\t", REVERSEDNS_NAME, "%s", info.reverse_dns); + pretty_printf(&jsonchain, "Reverse DNS:\t", REVERSEDNS_NAME, "%s", info.reverse_dns); if (!single_host || (flags & FLAG_JSON)) { output_separate(&jsonchain); if (info.type) - dist_printf(&jsonchain, "Address space:\t", ADDRSPACE_NAME, "%s", info.type); + pretty_dist_printf(&jsonchain, "Address space:\t", ADDRSPACE_NAME, "%s", info.type); if ((flags & FLAG_SHOW_ALL_INFO) && info.class) - dist_printf(&jsonchain, "Address class:\t", ADDRCLASS_NAME, "%s", info.class); + pretty_dist_printf(&jsonchain, "Address class:\t", ADDRCLASS_NAME, "%s", info.class); if (info.hostmin) - default_printf(&jsonchain, "HostMin:\t", MINADDR_NAME, "%s", info.hostmin); + pretty_printf(&jsonchain, "HostMin:\t", MINADDR_NAME, "%s", info.hostmin); if (info.hostmax) - default_printf(&jsonchain, "HostMax:\t", MAXADDR_NAME, "%s", info.hostmax); + pretty_printf(&jsonchain, "HostMax:\t", MAXADDR_NAME, "%s", info.hostmax); if ((flags & FLAG_IPV6) && info.prefix < 112 && !(flags & FLAG_JSON)) - default_printf(&jsonchain, "Hosts/Net:\t", ADDRESSES_NAME, "2^(%u) = %s", 128-info.prefix, info.hosts); + pretty_printf(&jsonchain, "Hosts/Net:\t", ADDRESSES_NAME, "2^(%u) = %s", 128-info.prefix, info.hosts); else - default_printf(&jsonchain, "Hosts/Net:\t", ADDRESSES_NAME, "%s", info.hosts); + pretty_printf(&jsonchain, "Hosts/Net:\t", ADDRESSES_NAME, "%s", info.hosts); } else { if (info.type) - dist_printf(&jsonchain, "Address space:\t", ADDRSPACE_NAME, "%s", info.type); + pretty_dist_printf(&jsonchain, "Address space:\t", ADDRSPACE_NAME, "%s", info.type); if ((flags & FLAG_SHOW_ALL_INFO) && info.class) - dist_printf(&jsonchain, "Address class:\t", ADDRCLASS_NAME, "%s", info.class); + pretty_dist_printf(&jsonchain, "Address class:\t", ADDRCLASS_NAME, "%s", info.class); } if (info.geoip_country || info.geoip_city || info.geoip_coord) { output_separate(&jsonchain); if (info.geoip_ccode) - dist_printf(&jsonchain, "Country code:\t", COUNTRYCODE_NAME, "%s", info.geoip_ccode); + pretty_dist_printf(&jsonchain, "Country code:\t", COUNTRYCODE_NAME, "%s", info.geoip_ccode); if (info.geoip_country) - dist_printf(&jsonchain, "Country:\t", COUNTRY_NAME, "%s", info.geoip_country); + pretty_dist_printf(&jsonchain, "Country:\t", COUNTRY_NAME, "%s", info.geoip_country); if (info.geoip_city) - dist_printf(&jsonchain, "City:\t\t", CITY_NAME, "%s", info.geoip_city); + pretty_dist_printf(&jsonchain, "City:\t\t", CITY_NAME, "%s", info.geoip_city); if (info.geoip_coord) - dist_printf(&jsonchain, "Coordinates:\t", COORDINATES_NAME, "%s", info.geoip_coord); + pretty_dist_printf(&jsonchain, "Coordinates:\t", COORDINATES_NAME, "%s", info.geoip_coord); } output_stop(&jsonchain); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/meson.build new/ipcalc-1.0.3/meson.build --- old/ipcalc-1.0.2/meson.build 2022-11-26 16:07:41.000000000 +0100 +++ new/ipcalc-1.0.3/meson.build 2023-06-07 15:43:14.000000000 +0200 @@ -1,6 +1,6 @@ project('ipcalc', 'c', license : 'GPLv2', - version : '1.0.2' + version : '1.0.3' ) src = [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/netsplit.c new/ipcalc-1.0.3/netsplit.c --- old/ipcalc-1.0.2/netsplit.c 2022-11-26 16:07:41.000000000 +0100 +++ new/ipcalc-1.0.3/netsplit.c 2023-06-07 15:43:14.000000000 +0200 @@ -83,6 +83,10 @@ start = net.s_addr; end = net.s_addr + diff - 1; + /* broadcast here is used to get maximum hosts in network. Set it to start + 1 for /31. */ + if (info->prefix == 31) + broadcast.s_addr = start + 1; + /* Figure out max width of a network string. */ while (1) { size_t len; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/tests/meson.build new/ipcalc-1.0.3/tests/meson.build --- old/ipcalc-1.0.2/tests/meson.build 2022-11-26 16:07:41.000000000 +0100 +++ new/ipcalc-1.0.3/tests/meson.build 2023-06-07 15:43:14.000000000 +0200 @@ -1294,6 +1294,27 @@ files('deaggregate-fcd3:57d1:733:c18f:b498:25e1:788:f-fcd3:57d1:733:c18f:b498:25e1:789:ffa9') ] ) +test('StandardInfo', + testrunner, + args : [ '--test-outfile', + ipcalc.full_path() + ' 192.168.2.0/24', + files('standard-192.168.2.0-24') + ] +) +test('NoDecorateInfo', + testrunner, + args : [ '--test-outfile', + ipcalc.full_path() + ' --no-decorate 192.168.2.0/24', + files('no-decorate-192.168.2.0-24') + ] +) +test('NoDecorateAllInfo', + testrunner, + args : [ '--test-outfile', + ipcalc.full_path() + ' --all-info --no-decorate 192.168.2.0/24', + files('no-decorate-all-info-192.168.2.0-24') + ] +) # Test whether we can deaggregate a randomly generated network test('DeaggregateIPv6Random', find_program('ipcalc-delegate-ipv6-random.sh'), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/tests/no-decorate-192.168.2.0-24 new/ipcalc-1.0.3/tests/no-decorate-192.168.2.0-24 --- old/ipcalc-1.0.2/tests/no-decorate-192.168.2.0-24 1970-01-01 01:00:00.000000000 +0100 +++ new/ipcalc-1.0.3/tests/no-decorate-192.168.2.0-24 2023-06-07 15:43:14.000000000 +0200 @@ -0,0 +1,8 @@ +Network: 192.168.2.0/24 +Netmask: 255.255.255.0 = 24 +Broadcast: 192.168.2.255 + +Address space: Private Use +HostMin: 192.168.2.1 +HostMax: 192.168.2.254 +Hosts/Net: 254 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/tests/no-decorate-all-info-192.168.2.0-24 new/ipcalc-1.0.3/tests/no-decorate-all-info-192.168.2.0-24 --- old/ipcalc-1.0.2/tests/no-decorate-all-info-192.168.2.0-24 1970-01-01 01:00:00.000000000 +0100 +++ new/ipcalc-1.0.3/tests/no-decorate-all-info-192.168.2.0-24 2023-06-07 15:43:14.000000000 +0200 @@ -0,0 +1,10 @@ +Network: 192.168.2.0/24 +Netmask: 255.255.255.0 = 24 +Broadcast: 192.168.2.255 +Reverse DNS: 2.168.192.in-addr.arpa. + +Address space: Private Use +Address class: Class C +HostMin: 192.168.2.1 +HostMax: 192.168.2.254 +Hosts/Net: 254 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/tests/nsplit-192.168.5.0-31-32 new/ipcalc-1.0.3/tests/nsplit-192.168.5.0-31-32 --- old/ipcalc-1.0.2/tests/nsplit-192.168.5.0-31-32 1970-01-01 01:00:00.000000000 +0100 +++ new/ipcalc-1.0.3/tests/nsplit-192.168.5.0-31-32 2023-06-07 15:43:14.000000000 +0200 @@ -0,0 +1,2 @@ +192.168.5.0/32 +192.168.5.1/32 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/tests/split-192.168.5.0-31-32 new/ipcalc-1.0.3/tests/split-192.168.5.0-31-32 --- old/ipcalc-1.0.2/tests/split-192.168.5.0-31-32 1970-01-01 01:00:00.000000000 +0100 +++ new/ipcalc-1.0.3/tests/split-192.168.5.0-31-32 2023-06-07 15:43:14.000000000 +0200 @@ -0,0 +1,6 @@ +[Split networks] +Network: 192.168.5.0/32 +Network: 192.168.5.1/32 + +Total: 2 +Hosts/Net: 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ipcalc-1.0.2/tests/standard-192.168.2.0-24 new/ipcalc-1.0.3/tests/standard-192.168.2.0-24 --- old/ipcalc-1.0.2/tests/standard-192.168.2.0-24 1970-01-01 01:00:00.000000000 +0100 +++ new/ipcalc-1.0.3/tests/standard-192.168.2.0-24 2023-06-07 15:43:14.000000000 +0200 @@ -0,0 +1,8 @@ +Network: 192.168.2.0/24 +Netmask: 255.255.255.0 = 24 +Broadcast: 192.168.2.255 + +Address space: Private Use +HostMin: 192.168.2.1 +HostMax: 192.168.2.254 +Hosts/Net: 254