1

打电话时

tokens = g_regex_split (arv_gv_device_get_url_regex (), filename, 0);

我偶然发现了这个错误

(process:15239): GLib-WARNING **: unknown option bit(s) set
(process:15239): GLib-CRITICAL **: g_regex_split_full: assertion 'regex != NULL' failed

g_regex_split是 glib 的一部分。

在线搜索让我相信该错误可能与引用错误 pcre(=Perl 兼容正则表达式库)的编译器有关。(请参阅此处对类似错误的讨论:https ://groups.google.com/forum/#!topic/mu-discuss/cy_yKE6ivzM )

我将如何定义我的编译器选择的 pcre?我在 Makefile 中设置了什么标志?


附加信息

$ locate libpcre.so
/lib/x86_64-linux-gnu/libpcre.so.3
/lib/x86_64-linux-gnu/libpcre.so.3.13.1
/usr/lib/x86_64-linux-gnu/libpcre.so

$ dpkg -s libpcre3
Package: libpcre3
Status: install ok installed
Priority: required
Section: libs
Installed-Size: 466
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: same
Source: pcre3
Version: 1:8.31-2
Depends: libc6 (>= 2.14)
Pre-Depends: multiarch-support
Breaks: approx (<< 4.4-1~), cduce (<< 0.5.3-2~), cmigrep (<< 1.5-7~), galax (<< 1.1-7~), libpcre-ocaml (<< 6.0.1~), liquidsoap (<< 0.9.2-3~), ocsigen (<< 1.3.3-1~)
Conflicts: libpcre3-dev (<= 4.3-3)
Description: Perl 5 Compatible Regular Expression Library - runtime files
This is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
.
This package contains the runtime libraries.
Original-Maintainer: Mark Baker <mark@mnb.org.uk>
4

1 回答 1

0

regex != NULL您将 NULL 传递给它时,将发生断言失败g_regex_split,在您的情况下,这意味着 is 的返回arv_gv_device_get_url_regexNULL。听起来您正在创建正则表达式而没有检查以确保它确实成功。

至于为什么g_regex_new不成功,您没有包含该代码,因此很难回答,但是有关“未知选项位设置”的警告肯定提供了线索。仔细查看您传递给哪些标志g_regex_new并找出导致该警告的标志 - 修复它可能会g_regex_new返回一个实际实例而不是NULL,这应该修复断言失败。当然,你仍然应该在运行时检查返回值并适当地处理错误,而不是让它们变成断言失败……</p>

于 2014-03-28T20:04:11.423 回答