greenbone / openvas-scanner

This repository contains the scanner component for Greenbone Community Edition.

Home Page:https://greenbone.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

g_pattern_match_string is deprecated

bgamex opened this issue · comments

During compilation latest version got the following error:

/tmp/openvas-scanner/misc/strutils.c:39:7: error: ‘g_pattern_match_string’ is deprecated: Use 'g_pattern_spec_match_string' instead [-Werror=deprecated-declarations] 39 | res = g_pattern_match_string (patt, g_ascii_strdown (string, -1)); | ^~~ In file included from /usr/include/glib-2.0/glib.h:65, from /tmp/openvas-scanner/misc/strutils.c:19: /usr/include/glib-2.0/glib/gpattern.h:55:15: note: declared here 55 | gboolean g_pattern_match_string (GPatternSpec *pspec, | ^~~~~~~~~~~~~~~~~~~~~~ /tmp/openvas-scanner/misc/strutils.c:44:7: error: ‘g_pattern_match_string’ is deprecated: Use 'g_pattern_spec_match_string' instead [-Werror=deprecated-declarations] 44 | res = g_pattern_match_string (patt, string);

Changed g_pattern_match_string to g_pattern_spec_match_string in file openvas-scanner/misc/strutils.c

Hi @bgamex ! Thanks for reporting this. I will take it in account.

according to https://libsoup.org/glib/glib-Glob-style-pattern-matching.html#g-pattern-spec-match-string the new function is available since glib 2.7. As the reference system is Debian 10 and Debian 11 for stable and unstable, and they don't include the new glib version, we can't consider this as a bug/issue.
Once the newer glib version is in used, the deprecated function will properly replaced.

If you can compile the code, I suggest:

  • either to modify the flags in the CMakeLists.txt, so it is not consider as error, but a warning; or
  • to use pragma to silent the skip the error. You will find an example how to use pragma here

It should be something like:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
res = g_pattern_match_string (patt, g_ascii_strdown (string, -1));
#pragma GCC diagnostic pop

So, closing this issue for now.

If you need further support please join / post at https://community.greenbone.net.