From 508fac528549a3e31c23948aaa57bc01a709863c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Mon, 22 Jan 2024 18:19:00 +0100 Subject: [PATCH] Fixed FTBFS with GCC 14 --- rrdtool-1.8.0-const-argv.patch | 1509 ++++++++++++++++++++++++++++++++ rrdtool.spec | 9 +- 2 files changed, 1517 insertions(+), 1 deletion(-) create mode 100644 rrdtool-1.8.0-const-argv.patch diff --git a/rrdtool-1.8.0-const-argv.patch b/rrdtool-1.8.0-const-argv.patch new file mode 100644 index 0000000..7401cde --- /dev/null +++ b/rrdtool-1.8.0-const-argv.patch @@ -0,0 +1,1509 @@ +diff --git a/bindings/lua/rrdlua.c b/bindings/lua/rrdlua.c +index d1a7006..2095c3b 100644 +--- a/bindings/lua/rrdlua.c ++++ b/bindings/lua/rrdlua.c +@@ -37,8 +37,8 @@ + extern void rrd_freemem(void *mem); + + extern int luaopen_rrd (lua_State * L); +-typedef int (*RRD_FUNCTION)(int, char **); +-typedef rrd_info_t *(RRD_FUNCTION_V)(int, char **); ++typedef int (*RRD_FUNCTION)(int, const char **); ++typedef rrd_info_t *(RRD_FUNCTION_V)(int, const char **); + + /**********************************************************/ + +@@ -49,9 +49,9 @@ static void reset_rrd_state(void) + rrd_clear_error(); + } + +-static char **make_argv(const char *cmd, lua_State * L) ++static const char **make_argv(const char *cmd, lua_State * L) + { +- char **argv; ++ const char **argv; + int i; + int argc = lua_gettop(L) + 1; + +@@ -60,13 +60,12 @@ static char **make_argv(const char *cmd, lua_State * L) + luaL_error(L, "Can't allocate memory for arguments array", cmd); + + /* fprintf(stderr, "Args:\n"); */ +- argv[0] = (char *) cmd; /* Dummy arg. Cast to (char *) because rrd */ +- /* functions don't expect (const * char) */ ++ argv[0] = cmd; + /* fprintf(stderr, "%s\n", argv[0]); */ + for (i=1; i + #include "../../src/rrd_tool.h" + #include "../../src/rrd_format.h" ++#include "../../src/unused.h" + + /* support pre-8.4 tcl */ + +@@ -41,47 +42,39 @@ extern int Tclrrd_SafeInit( + * Hence, we need to do some preparation before + * calling the rrd library functions. + */ +-static char **getopt_init( ++static const char **getopt_init( + int argc, + CONST84 char *argv[]) + { +- char **argv2; ++ const char **argv2; + int i; + + argv2 = calloc(argc, sizeof(char *)); + for (i = 0; i < argc; i++) { +- argv2[i] = strdup(argv[i]); ++ argv2[i] = argv[i]; + } + return argv2; + } + + static void getopt_cleanup( +- int argc, +- char **argv2) ++ int UNUSED(argc), ++ const char **argv2) + { +- int i; +- +- for (i = 0; i < argc; i++) { +- if (argv2[i] != NULL) { +- free(argv2[i]); +- } +- } +- free(argv2); ++ free((void *)argv2); + } + + static void getopt_free_element( +- char *argv2[], ++ const char *argv2[], + int argn) + { + if (argv2[argn] != NULL) { +- free(argv2[argn]); + argv2[argn] = NULL; + } + } + + static void getopt_squieeze( + int *argc, +- char *argv2[]) ++ const char *argv2[]) + { + int i, null_i = 0, argc_tmp = *argc; + +@@ -104,7 +97,7 @@ static int Rrd_Create( + CONST84 char *argv[]) + { + int argv_i; +- char **argv2; ++ const char **argv2; + char *parsetime_error = NULL; + time_t last_up = time(NULL) - 10; + long int long_tmp; +@@ -295,7 +288,7 @@ static int Rrd_Flushcached( + return TCL_ERROR; + } + +- rrd_flushcached(argc, (char**)argv); ++ rrd_flushcached(argc, argv); + + if (rrd_test_error()) { + Tcl_AppendResult(interp, "RRD Error: ", +@@ -380,7 +373,7 @@ static int Rrd_Update( + CONST84 char *argv[]) + { + int argv_i; +- char **argv2, *template = NULL; ++ const char **argv2, *template = NULL; + + argv2 = getopt_init(argc, argv); + +@@ -391,16 +384,10 @@ static int Rrd_Update( + Tcl_AppendResult(interp, "RRD Error: option '", + argv2[argv_i - 1], "' needs an argument", + (char *) NULL); +- if (template != NULL) { +- free(template); +- } + getopt_cleanup(argc, argv2); + return TCL_ERROR; + } +- if (template != NULL) { +- free(template); +- } +- template = strdup(argv2[argv_i]); ++ template = argv2[argv_i]; + getopt_free_element(argv2, argv_i - 1); + getopt_free_element(argv2, argv_i); + } else if (!strcmp(argv2[argv_i], "--")) { +@@ -409,9 +396,6 @@ static int Rrd_Update( + } else if (argv2[argv_i][0] == '-') { + Tcl_AppendResult(interp, "RRD Error: unknown option '", + argv2[argv_i], "'", (char *) NULL); +- if (template != NULL) { +- free(template); +- } + getopt_cleanup(argc, argv2); + return TCL_ERROR; + } +@@ -422,18 +406,12 @@ static int Rrd_Update( + if (argc < 2) { + Tcl_AppendResult(interp, "RRD Error: needs rrd filename", + (char *) NULL); +- if (template != NULL) { +- free(template); +- } + getopt_cleanup(argc, argv2); + return TCL_ERROR; + } + + rrd_update_r(argv2[1], template, argc - 2, (const char **)argv2 + 2); + +- if (template != NULL) { +- free(template); +- } + getopt_cleanup(argc, argv2); + + if (rrd_test_error()) { +@@ -454,7 +432,6 @@ static int Rrd_Info( + { + int status = TCL_OK; + rrd_info_t *data; +- char **argv2; + + /* TODO: support for rrdcached */ + if (argc != 2) { +@@ -463,9 +440,7 @@ static int Rrd_Info( + return TCL_ERROR; + } + +- argv2 = getopt_init(argc, argv); +- +- data = rrd_info_r(argv2[1]); ++ data = rrd_info_r(argv[1]); + + if (data) { + Tcl_SetObjResult(interp, convert_info(data)); +@@ -477,7 +452,6 @@ static int Rrd_Info( + status = TCL_ERROR; + } + +- getopt_cleanup(argc, argv2); + return status; + } + +@@ -488,7 +462,6 @@ static int Rrd_Lastupdate( + CONST84 char *argv[]) + { + time_t last_update; +- char **argv2; + char **ds_namv; + char **last_ds; + char s[30]; +@@ -502,8 +475,7 @@ static int Rrd_Lastupdate( + return TCL_ERROR; + } + +- argv2 = getopt_init(argc, argv); +- if (rrd_lastupdate_r(argv2[1], &last_update, ++ if (rrd_lastupdate_r(argv[1], &last_update, + &ds_cnt, &ds_namv, &last_ds) == 0) { + listPtr = Tcl_GetObjResult(interp); + for (i = 0; i < ds_cnt; i++) { +@@ -527,7 +499,6 @@ static int Rrd_Lastupdate( + free(ds_namv); + } + } +- getopt_cleanup(argc, argv2); + return TCL_OK; + } + +@@ -543,10 +514,8 @@ static int Rrd_Fetch( + char **ds_namv; + Tcl_Obj *listPtr; + char s[30]; +- char **argv2; + +- argv2 = getopt_init(argc, argv); +- if (rrd_fetch(argc, argv2, &start, &end, &step, ++ if (rrd_fetch(argc, argv, &start, &end, &step, + &ds_cnt, &ds_namv, &data) != -1) { + datai = data; + listPtr = Tcl_GetObjResult(interp); +@@ -562,7 +531,6 @@ static int Rrd_Fetch( + free(ds_namv); + free(data); + } +- getopt_cleanup(argc, argv2); + + if (rrd_test_error()) { + Tcl_AppendResult(interp, "RRD Error: ", +@@ -590,7 +558,7 @@ static int Rrd_Graph( + int rc, xsize, ysize; + double ymin, ymax; + char dimensions[50]; +- char **argv2; ++ const char **argv2; + CONST84 char *save; + + /* +@@ -692,11 +660,7 @@ static int Rrd_Tune( + int argc, + CONST84 char *argv[]) + { +- char **argv2; +- +- argv2 = getopt_init(argc, argv); +- rrd_tune(argc, argv2); +- getopt_cleanup(argc, argv2); ++ rrd_tune(argc, argv); + + if (rrd_test_error()) { + Tcl_AppendResult(interp, "RRD Error: ", +@@ -716,11 +680,7 @@ static int Rrd_Resize( + int argc, + CONST84 char *argv[]) + { +- char **argv2; +- +- argv2 = getopt_init(argc, argv); +- rrd_resize(argc, argv2); +- getopt_cleanup(argc, argv2); ++ rrd_resize(argc, argv); + + if (rrd_test_error()) { + Tcl_AppendResult(interp, "RRD Error: ", +@@ -740,11 +700,7 @@ static int Rrd_Restore( + int argc, + CONST84 char *argv[]) + { +- char **argv2; +- +- argv2 = getopt_init(argc, argv); +- rrd_restore(argc, argv2); +- getopt_cleanup(argc, argv2); ++ rrd_restore(argc, argv); + + if (rrd_test_error()) { + Tcl_AppendResult(interp, "RRD Error: ", +diff --git a/src/optparse.c b/src/optparse.c +index 9040ba8..79a3efe 100644 +--- a/src/optparse.c ++++ b/src/optparse.c +@@ -10,7 +10,7 @@ + #define options_argv(i) \ + ((i) < options->argc ? options->argv[i] : NULL) + +-void optparse_init(struct optparse *options, int argc, char **argv) ++void optparse_init(struct optparse *options, int argc, const char **argv) + { + options->argv = argv; + options->argc = argc; +@@ -42,7 +42,7 @@ is_longopt(const char *arg) + static void + permute(struct optparse *options, int index) + { +- char *nonoption = options->argv[index]; ++ const char *nonoption = options->argv[index]; + for (int i = index; i < options->optind - 1; i++) + options->argv[i] = options->argv[i + 1]; + options->argv[options->optind - 1] = nonoption; +@@ -67,7 +67,7 @@ int optparse(struct optparse *options, const char *optstring) + options->errmsg[0] = '\0'; + options->optopt = 0; + options->optarg = NULL; +- char *option = options_argv(options->optind); ++ const char *option = options_argv(options->optind); + if (option == NULL) { + return -1; + } else if (is_dashdash(option)) { +@@ -88,7 +88,7 @@ int optparse(struct optparse *options, const char *optstring) + option += options->subopt + 1; + options->optopt = option[0]; + int type = argtype(optstring, option[0]); +- char *next = options_argv(options->optind + 1); ++ const char *next = options_argv(options->optind + 1); + switch (type) { + case -1: + opterror(options, "invalid option -- '%c'", option[0]); +@@ -128,10 +128,10 @@ int optparse(struct optparse *options, const char *optstring) + return 0; + } + +-char *optparse_arg(struct optparse *options) ++const char *optparse_arg(struct optparse *options) + { + options->subopt = 0; +- char *option = options->argv[options->optind]; ++ const char *option = options->argv[options->optind]; + if (option != NULL) + options->optind++; + return option; +@@ -222,7 +222,7 @@ optparse_long(struct optparse *options, + int *longindex) + { + // printf("%i < %i\n",options->optind,options->argc); +- char *option = options_argv(options->optind); ++ const char *option = options_argv(options->optind); + if (option == NULL) { + return -1; + } else if (is_dashdash(option)) { +diff --git a/src/optparse.h b/src/optparse.h +index c4b0ec1..7a0bb38 100644 +--- a/src/optparse.h ++++ b/src/optparse.h +@@ -44,7 +44,7 @@ + */ + + struct optparse { +- char **argv; ++ const char **argv; + int argc; + int permute; + int optind; +@@ -65,7 +65,7 @@ struct optparse_long { + /** + * Initializes the parser state. + */ +-void optparse_init(struct optparse *options, int argc, char **argv); ++void optparse_init(struct optparse *options, int argc, const char **argv); + + /** + * Read the next option in the argv array. +@@ -98,6 +98,6 @@ optparse_long(struct optparse *options, + * subcommand returned by optparse_arg(). This function allows you to + * ignore the value of optind. + */ +-char *optparse_arg(struct optparse *options); ++const char *optparse_arg(struct optparse *options); + + #endif +diff --git a/src/rrd.h b/src/rrd.h +index 8439413..4f0e566 100644 +--- a/src/rrd.h ++++ b/src/rrd.h +@@ -155,10 +155,10 @@ extern "C" { + /* main function blocks */ + int rrd_create( + int, +- char **); ++ const char **); + rrd_info_t *rrd_info( + int, +- char **); ++ const char **); + rrd_info_t *rrd_info_push( + rrd_info_t *, + char *, +@@ -170,19 +170,19 @@ extern "C" { + rrd_info_t *); + char *rrd_list( + int, +- char **); ++ const char **); + char *rrd_list_r( + int, +- char *dirname); ++ const char *dirname); + int rrd_update( + int, +- char **); ++ const char **); + rrd_info_t *rrd_update_v( + int, +- char **); ++ const char **); + int rrd_graph( + int, +- char **, ++ const char **, + char ***, + int *, + int *, +@@ -191,11 +191,11 @@ extern "C" { + double *); + rrd_info_t *rrd_graph_v( + int, +- char **); ++ const char **); + + int rrd_fetch( + int, +- char **, ++ const char **, + time_t *, + time_t *, + unsigned long *, +@@ -204,32 +204,32 @@ extern "C" { + rrd_value_t **); + int rrd_restore( + int, +- char **); ++ const char **); + int rrd_dump( + int, +- char **); ++ const char **); + int rrd_tune( + int, +- char **); ++ const char **); + time_t rrd_last( + int, +- char **); ++ const char **); + int rrd_lastupdate( + int argc, +- char **argv); ++ const char **argv); + time_t rrd_first( + int, +- char **); ++ const char **); + int rrd_resize( + int, +- char **); ++ const char **); + char *rrd_strversion( + void); + double rrd_version( + void); + int rrd_xport( + int, +- char **, ++ const char **, + int *, + time_t *, + time_t *, +@@ -239,7 +239,7 @@ extern "C" { + rrd_value_t **); + int rrd_flushcached( + int argc, +- char **argv); ++ const char **argv); + + void rrd_freemem( + void *mem); +@@ -309,7 +309,7 @@ extern "C" { + const char **argv); + int rrd_dump_opt_r( + const char *filename, +- char *outname, ++ const char *outname, + int opt_noheader); + int rrd_dump_r( + const char *filename, +diff --git a/src/rrd_cgi.c b/src/rrd_cgi.c +index e7eb5be..bc007b2 100644 +--- a/src/rrd_cgi.c ++++ b/src/rrd_cgi.c +@@ -100,7 +100,7 @@ static char *rrdstrip( + static char *scanargs( + char *line, + int *argc, +- char ***args); ++ const char ***args); + + /* format at-time specified times using strftime */ + static char *printstrftime( +@@ -315,7 +315,7 @@ static const char *putvar( + } + + /* expand those RRD:* directives that can be used recursively */ +-static char *rrd_expand_vars( ++static const char *rrd_expand_vars( + char *buffer) + { + int i; +@@ -432,7 +432,7 @@ static int readfile( + + int main( + int argc, +- char *argv[]) ++ const char *argv[]) + { + char *buffer; + long i; +@@ -924,7 +924,7 @@ static char *drawgraph( + } + calfree(); + if (rrd_graph +- (argc + 1, (char **) args - 1, &calcpr, &xsize, &ysize, NULL, &ymin, ++ (argc + 1, args - 1, &calcpr, &xsize, &ysize, NULL, &ymin, + &ymax) != -1) { + return stralloc(calcpr[0]); + } else { +@@ -971,7 +971,7 @@ static char *printtimelast( + /* not raising argc in step with args - 1 since the last argument + will be used below for strftime */ + +- last = rrd_last(argc, (char **) args - 1); ++ last = rrd_last(argc, args - 1); + if (rrd_test_error()) { + char err[4096]; + +@@ -1025,7 +1025,7 @@ static char *printtimenow( + static char *scanargs( + char *line, + int *argument_count, +- char ***arguments) ++ const char ***arguments) + { + char *getP; /* read cursor */ + char *putP; /* write cursor */ +@@ -1037,8 +1037,8 @@ static char *scanargs( + + /* local array of arguments while parsing */ + int argc = 1; +- char **argv; +- char **argv_tmp; /* temp variable for realloc() */ ++ const char **argv; ++ const char **argv_tmp; /* temp variable for realloc() */ + + #ifdef DEBUG_PARSER + printf("<-- scanargs(%s) -->\n", line); +@@ -1049,7 +1049,7 @@ static char *scanargs( + + /* create initial argument array of char pointers */ + argsz = 32; +- argv = (char **) malloc(argsz * sizeof(char *)); ++ argv = malloc(argsz * sizeof(char *)); + if (!argv) { + return NULL; + } +@@ -1144,7 +1144,7 @@ static char *scanargs( + if (argc == argsz - 2) { + /* resize argument array */ + argsz *= 2; +- argv_tmp = (char **) rrd_realloc(argv, argsz * sizeof(char *)); ++ argv_tmp = rrd_realloc(argv, argsz * sizeof(char *)); + if (*argv_tmp == NULL) { + return NULL; + } +@@ -1211,7 +1211,7 @@ static int parse( + /* the name of the vairable ... */ + char *val; + long valln; +- char **args; ++ const char **args; + char *end; + long end_offset; + int argc; +@@ -1262,7 +1262,7 @@ static int parse( + /* make sure we do not shrink the mallocd block */ + size_t newbufsize = i + strlen(end) + valln + 1; + +- *buf = (char *) rrd_realloc(*buf, newbufsize); ++ *buf = rrd_realloc(*buf, newbufsize); + + if (*buf == NULL) { + perror("Realoc buf:"); +diff --git a/src/rrd_create.c b/src/rrd_create.c +index 0cb5b78..984c438 100644 +--- a/src/rrd_create.c ++++ b/src/rrd_create.c +@@ -76,7 +76,7 @@ static void parseGENERIC_DS( + + int rrd_create( + int argc, +- char **argv) ++ const char **argv) + { + struct optparse_long longopts[] = { + {"start", 'b', OPTPARSE_REQUIRED}, +diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c +index cf12547..5831c1b 100644 +--- a/src/rrd_daemon.c ++++ b/src/rrd_daemon.c +@@ -1796,7 +1796,7 @@ static int handle_request_tune( + HANDLER_PROTO) + { /* {{{ */ + int status; +- char** argv = NULL; ++ const char** argv = NULL; + int argc, argc_tmp; + char* i; + int rc; +@@ -1835,7 +1835,7 @@ static int handle_request_tune( + goto done; + } + +- if ((argv = (char **) malloc(argc * sizeof(char*))) == NULL) { ++ if ((argv = malloc(argc * sizeof(char*))) == NULL) { + rc = send_response(sock, RESP_ERR, "%s\n", rrd_strerror(ENOMEM)); + goto done; + } +@@ -1846,7 +1846,7 @@ static int handle_request_tune( + argc_tmp += 1; + } + +- status = rrd_tune_r(file, argc, (const char **)argv); ++ status = rrd_tune_r(file, argc, argv); + if (status != 0) { + rc = send_response(sock, RESP_ERR, "Got error %s\n", rrd_get_error()); + goto done; +@@ -1854,7 +1854,7 @@ static int handle_request_tune( + rc = send_response(sock, RESP_OK, "Success\n"); + done: + free(file); +- free(argv); ++ free((void *)argv); + return rc; + } + +@@ -4418,7 +4418,7 @@ static int cleanup( + + static int read_options( + int argc, +- char **argv) ++ const char **argv) + { /* {{{ */ + struct optparse_long longopts[] = { + {NULL, 'a', OPTPARSE_REQUIRED}, +@@ -4963,7 +4963,7 @@ static int read_options( + + int main( + int argc, +- char **argv) ++ const char **argv) + { + int status; + +diff --git a/src/rrd_dump.c b/src/rrd_dump.c +index 4f616fc..991cdcd 100644 +--- a/src/rrd_dump.c ++++ b/src/rrd_dump.c +@@ -472,7 +472,7 @@ static size_t rrd_dump_opt_cb_fileout( + + int rrd_dump_opt_r( + const char *filename, +- char *outname, ++ const char *outname, + int opt_noheader) + { + FILE *out_file; +@@ -512,7 +512,7 @@ int rrd_dump_r( + + int rrd_dump( + int argc, +- char **argv) ++ const char **argv) + { + int opt; + struct optparse_long longopts[] = { +diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c +index aa05cd0..e0c4f4f 100644 +--- a/src/rrd_fetch.c ++++ b/src/rrd_fetch.c +@@ -61,7 +61,7 @@ + + int rrd_fetch( + int argc, +- char **argv, ++ const char **argv, + time_t *start, + time_t *end, /* which time frame do you want ? + * will be changed to represent reality */ +diff --git a/src/rrd_first.c b/src/rrd_first.c +index 6279524..7ecc4f1 100644 +--- a/src/rrd_first.c ++++ b/src/rrd_first.c +@@ -13,7 +13,7 @@ + + time_t rrd_first( + int argc, +- char **argv) ++ const char **argv) + { + struct optparse_long longopts[] = { + {"rraindex", 129, OPTPARSE_REQUIRED}, +diff --git a/src/rrd_flushcached.c b/src/rrd_flushcached.c +index 090bca7..3bf6cd2 100644 +--- a/src/rrd_flushcached.c ++++ b/src/rrd_flushcached.c +@@ -22,7 +22,7 @@ + #include "rrd_tool.h" + #include "rrd_client.h" + +-int rrd_flushcached (int argc, char **argv) ++int rrd_flushcached (int argc, const char **argv) + { + struct optparse_long longopts[] = { + {"daemon", 'd', OPTPARSE_REQUIRED}, +diff --git a/src/rrd_graph.c b/src/rrd_graph.c +index c0ce6d4..fa8b4c4 100644 +--- a/src/rrd_graph.c ++++ b/src/rrd_graph.c +@@ -4606,7 +4606,7 @@ int scan_for_col( + /* Now just a wrapper around rrd_graph_v */ + int rrd_graph( + int argc, +- char **argv, ++ const char **argv, + char ***prdata, + int *xsize, + int *ysize, +@@ -4689,7 +4689,7 @@ int rrd_graph( + + rrd_info_t *rrd_graph_v( + int argc, +- char **argv) ++ const char **argv) + { + image_desc_t im; + rrd_info_t *grinfo; +@@ -4952,7 +4952,7 @@ void rrd_graph_init( + + void rrd_graph_options( + int argc, +- char *argv[], ++ const char **argv, + struct optparse *poptions, + image_desc_t *im) + { +diff --git a/src/rrd_graph.h b/src/rrd_graph.h +index 4df32ec..083cf38 100644 +--- a/src/rrd_graph.h ++++ b/src/rrd_graph.h +@@ -473,12 +473,12 @@ void time_clean( + + void rrd_graph_options( + int, +- char **, ++ const char **, + struct optparse *, + image_desc_t *); + void rrd_graph_script( + int, +- char **, ++ const char **, + image_desc_t *const, + int); + int rrd_graph_color( +diff --git a/src/rrd_graph_helper.c b/src/rrd_graph_helper.c +index f88893b..dda0069 100644 +--- a/src/rrd_graph_helper.c ++++ b/src/rrd_graph_helper.c +@@ -1952,7 +1952,7 @@ static int parse_xport( + + void rrd_graph_script( + int argc, +- char *argv[], ++ const char **argv, + image_desc_t *const im, + int optno) + { +diff --git a/src/rrd_info.c b/src/rrd_info.c +index 76277e8..f1b4313 100644 +--- a/src/rrd_info.c ++++ b/src/rrd_info.c +@@ -82,7 +82,7 @@ rrd_info_t + + rrd_info_t *rrd_info( + int argc, +- char **argv) ++ const char **argv) + { + struct optparse_long longopts[] = { + {"daemon", 'd', OPTPARSE_REQUIRED}, +diff --git a/src/rrd_last.c b/src/rrd_last.c +index 2e05886..4b6a79f 100644 +--- a/src/rrd_last.c ++++ b/src/rrd_last.c +@@ -11,7 +11,7 @@ + + time_t rrd_last( + int argc, +- char **argv) ++ const char **argv) + { + char *opt_daemon = NULL; + time_t lastupdate; +diff --git a/src/rrd_lastupdate.c b/src/rrd_lastupdate.c +index 31ab3f7..28211da 100644 +--- a/src/rrd_lastupdate.c ++++ b/src/rrd_lastupdate.c +@@ -14,7 +14,7 @@ + #include "rrd_client.h" + #include + +-int rrd_lastupdate (int argc, char **argv) ++int rrd_lastupdate (int argc, const char **argv) + { + struct optparse_long longopts[] = { + {"daemon", 'd', OPTPARSE_REQUIRED}, +diff --git a/src/rrd_list.c b/src/rrd_list.c +index e743b9b..6e96220 100644 +--- a/src/rrd_list.c ++++ b/src/rrd_list.c +@@ -37,7 +37,7 @@ static char *move_past_prefix(const char *prefix, const char *string) + return (char *)&(string[index]); + } + +-static char *rrd_list_rec(int recursive, char *root, char *dirname) ++static char *rrd_list_rec(int recursive, const char *root, const char *dirname) + { + #define SANE_ASPRINTF2(_dest_str, _format, ...) \ + if (asprintf(&_dest_str, _format, __VA_ARGS__) == -1) { \ +@@ -138,7 +138,7 @@ static char *rrd_list_rec(int recursive, char *root, char *dirname) + return out; + } + +-char *rrd_list_r(int recursive, char *dirname) ++char *rrd_list_r(int recursive, const char *dirname) + { + #define SANE_ASPRINTF(_dest_str, _format, ...) \ + if (asprintf(&_dest_str, _format, __VA_ARGS__) == -1) { \ +@@ -240,7 +240,7 @@ char *rrd_list_r(int recursive, char *dirname) + return rrd_list_rec(recursive, dirname, dirname); + } + +-char *rrd_list(int argc, char **argv) ++char *rrd_list(int argc, const char **argv) + { + char *opt_daemon = NULL; + int status; +diff --git a/src/rrd_modify.c b/src/rrd_modify.c +index 6de7926..d43fec2 100644 +--- a/src/rrd_modify.c ++++ b/src/rrd_modify.c +@@ -1297,7 +1297,7 @@ done: + } + + int handle_modify(const rrd_t *in, const char *outfilename, +- int argc, char **argv, int optidx, ++ int argc, const char **argv, int optidx, + int newstep) { + // parse add/remove options + int rc = -1; +diff --git a/src/rrd_modify.h b/src/rrd_modify.h +index d78d961..8596801 100644 +--- a/src/rrd_modify.h ++++ b/src/rrd_modify.h +@@ -28,7 +28,7 @@ typedef struct { + } rra_mod_op_t; + + int handle_modify(const rrd_t *in, const char *outfilename, +- int argc, char **argv, int optind, ++ int argc, const char **argv, int optind, + int newstep); + + typedef union { +diff --git a/src/rrd_resize.c b/src/rrd_resize.c +index 44c1ee5..5236cd6 100644 +--- a/src/rrd_resize.c ++++ b/src/rrd_resize.c +@@ -12,9 +12,9 @@ + + int rrd_resize( + int argc, +- char **argv) ++ const char **argv) + { +- char *infilename, outfilename[11] = "resize.rrd"; ++ const char *infilename, outfilename[11] = "resize.rrd"; + rrd_t rrdold, rrdnew; + rrd_value_t buffer; + int version; +diff --git a/src/rrd_restore.c b/src/rrd_restore.c +index 14b9446..19975da 100644 +--- a/src/rrd_restore.c ++++ b/src/rrd_restore.c +@@ -1378,7 +1378,7 @@ int write_file( + + int rrd_restore( + int argc, +- char **argv) ++ const char **argv) + { + struct optparse_long longopts[] = { + {"range-check", 'r', OPTPARSE_NONE}, +diff --git a/src/rrd_tool.c b/src/rrd_tool.c +index 71e2263..ddbae96 100644 +--- a/src/rrd_tool.c ++++ b/src/rrd_tool.c +@@ -22,16 +22,16 @@ + + + static void PrintUsage( +- char *cmd); ++ const char *cmd); + static int CountArgs( + char *aLine); + static int CreateArgs( ++ const char *, + char *, +- char *, +- char **); ++ const char **); + static int HandleInputLine( + int, +- char **, ++ const char **, + FILE *); + int RemoteMode = 0; + int ChangeRoot = 0; +@@ -42,7 +42,7 @@ int ChangeRoot = 0; + + + static void PrintUsage( +- char *cmd) ++ const char *cmd) + { + + #ifdef BUILD_DATE +@@ -443,11 +443,11 @@ static char *fgetslong( + + int main( + int argc, +- char *argv[]) ++ const char *argv[]) + { +- char **myargv; ++ const char **myargv; + char *aLine; +- char *firstdir = ""; ++ const char *firstdir = ""; + + #ifdef MUST_DISABLE_SIGFPE + signal(SIGFPE, SIG_IGN); +@@ -526,7 +526,7 @@ int main( + printf("ERROR: not enough arguments\n"); + continue; + } +- if ((myargv = (char **) malloc((argc + 1) * ++ if ((myargv = malloc((argc + 1) * + sizeof(char *))) == NULL) { + perror("malloc"); + exit(1); +@@ -572,7 +572,7 @@ int main( + resolving them portably is not really simple. */ + static int HandleInputLine( + int argc, +- char **argv, ++ const char **argv, + FILE * out) + { + #if defined(HAVE_OPENDIR) && defined (HAVE_READDIR) +@@ -887,12 +887,12 @@ static int CountArgs( + * CreateArgs - take a string (aLine) and tokenize + */ + static int CreateArgs( +- char *pName, ++ const char *pName, + char *aLine, +- char **argv) ++ const char **argv) + { + char *getP, *putP; +- char **pargv = argv; ++ const char **pargv = argv; + char Quote = 0; + int inArg = 0; + int len; +diff --git a/src/rrd_tune.c b/src/rrd_tune.c +index 3374dd1..dfa8a86 100644 +--- a/src/rrd_tune.c ++++ b/src/rrd_tune.c +@@ -71,7 +71,7 @@ static int set_hwsmootharg( + + int rrd_tune( + int argc, +- char **argv) ++ const char **argv) + { + char *opt_daemon = NULL; + const char *in_filename = NULL; +diff --git a/src/rrd_update.c b/src/rrd_update.c +index 831b8ee..8989f3f 100644 +--- a/src/rrd_update.c ++++ b/src/rrd_update.c +@@ -299,7 +299,7 @@ static void initialize_time( + + rrd_info_t *rrd_update_v( + int argc, +- char **argv) ++ const char **argv) + { + struct optparse_long longopts[] = { + {"template", 't', OPTPARSE_REQUIRED}, +@@ -668,7 +668,7 @@ error: + + int rrd_update( + int argc, +- char **argv) ++ const char **argv) + { + struct optparse_long longopts[] = { + {"template", 't', OPTPARSE_REQUIRED}, +diff --git a/src/rrd_xport.c b/src/rrd_xport.c +index eb814fb..405c9d8 100644 +--- a/src/rrd_xport.c ++++ b/src/rrd_xport.c +@@ -72,7 +72,7 @@ static int rrd_xport_format_addprints( + + int rrd_xport( + int argc, +- char **argv, ++ const char **argv, + int UNUSED(*xsize), + time_t *start, + time_t *end, /* which time frame do you want ? +diff --git a/src/rrdupdate.c b/src/rrdupdate.c +index 340ef5b..6b51530 100644 +--- a/src/rrdupdate.c ++++ b/src/rrdupdate.c +@@ -20,19 +20,20 @@ int main( + int argc, + char **argv) + { ++ const char **cargv = (const char **)argv; + char *name=basename(argv[0]); + rrd_info_t *info; + + if (!strcmp(name, "rrdcreate")) { +- rrd_create(argc, argv); ++ rrd_create(argc, cargv); + } + else if (!strcmp(name, "rrdinfo")) { +- info=rrd_info(argc, argv); ++ info=rrd_info(argc, cargv); + rrd_info_print(info); + rrd_info_free(info); + } + else { +- rrd_update(argc, argv); ++ rrd_update(argc, cargv); + } + + if (rrd_test_error()) { diff --git a/rrdtool.spec b/rrdtool.spec index f04c4be..7107642 100644 --- a/rrdtool.spec +++ b/rrdtool.spec @@ -18,7 +18,7 @@ Summary: Round Robin Database Tool to store and display time-series data Name: rrdtool Version: 1.8.0 -Release: 14%{?dist} +Release: 15%{?dist} License: GPLv2+ with exceptions URL: https://oss.oetiker.ch/rrdtool/ Source0: https://github.com/oetiker/rrdtool-1.x/releases/download/v%{version}/%{name}-%{version}.tar.gz @@ -33,6 +33,9 @@ Patch4: rrdtool-1.4.8-php-ppc-fix.patch # https://github.com/oetiker/rrdtool-1.x/commit/e59f703 Patch5: rrdtool-1.8.0-BUILD_DATE-fix.patch Patch6: rrdtool-configure-c99.patch +# gcc-14 fix +# https://github.com/oetiker/rrdtool-1.x/commit/b76e3c578f1e9f582e9c28f50d82b1f569602075 +Patch7: rrdtool-1.8.0-const-argv.patch BuildRequires: make BuildRequires: gcc-c++ @@ -182,6 +185,7 @@ The %{name}-lua package includes RRDtool bindings for Lua. %patch4 -p1 -b .php-ppc-fix %patch5 -p1 -b .BUILD_DATE-fix %patch6 -p1 -b .configure-c99 +%patch7 -p1 -b .const-argv # Fix to find correct python dir on lib64 perl -pi -e 's|get_python_lib\(0,0,prefix|get_python_lib\(1,0,prefix|g' \ @@ -410,6 +414,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} php -n \ %endif %changelog +* Mon Jan 22 2024 Jaroslav Škarvada - 1.8.0-15 +- Fixed FTBFS with GCC 14 + * Mon Jan 22 2024 Fedora Release Engineering - 1.8.0-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild