【问题标题】:Error while running checksetup.pl Bugzilla 5.0.6 Install: The regular expression you provided '^[^,]+{' is not valid运行 checksetup.pl 时出错 Bugzilla 5.0.6 安装:您提供的正则表达式 '^[^,]+{' 无效
【发布时间】:2020-01-24 17:19:07
【问题描述】:

我正在尝试使用本指南在 Windows 10 机器上安装 Bugzilla:

https://bugzilla.readthedocs.io/en/latest/installing/windows.html#

Apache 2.4、Perl 5.28.2 和 MySQL 8.0 已安装并正常运行。我已经使用“install-modules.pl --all”命令安装了所有必需的 Perl 模块。我可以打开 Bugzilla 页面,尽管它是纯文本版本。

问题是上次运行 checksetup.pl。它检查所有已安装的模块,然后给我这个:

Removing existing compiled templates...
Precompiling templates...done.
Initializing "Dependency Tree Changes" email_setting ...
Initializing "Product/Component Changes" email_setting ...
Use of uninitialized value in numeric eq (==) at Bugzilla/Install/DB.pm line 2688.
The regular expression you provided '^[^,]+{' is not valid. The error
was: Syntax error in regular expression on line 1, character 7..

我在sub _add_password_salt_separator 的DB.pm 文件中找到了正则表达式。 (第 4110 行)

这是似乎是问题孩子的代码块:

  my $profiles
    = $dbh->selectall_arrayref(
        "SELECT userid, cryptpassword FROM profiles WHERE ("
      . $dbh->sql_regexp("cryptpassword", "'^[^,]+{'")
      . ")");

我尝试重新加载 Bugzilla 以查看是否只是下载或配置的问题,但在第 3 轮之后,我仍然收到相同的错误。

我尝试查找表达式,但似乎没有任何意义。我不熟悉正则表达式,所以我不知道该去哪里解决这个问题。任何帮助让这个系统运行都非常感谢。

【问题讨论】:

  • 我尝试进行更改,但它仍然给了我错误:The regular expression you provided '^[^,]+\{' is not valid.
  • 您可以echo "SELECT userid, cryptpassword FROM profiles WHERE (" . $dbh->sql_regexp("cryptpassword", "'^[^,]+{'") . ")" 并将输出添加到您的问题详细信息中吗?这将使您更清楚地了解您的字符串连接是否产生了有效的 SQL 语句。对我来说,开始和结束引号 ' 看起来很可疑,尤其是因为 ^ 表示正则表达式中字符串的开始。
  • @ikegami 所以是character 7 来自错误引用]+
  • 所以添加"'^[^,]+\\\\{'" 允许它继续但现在出现另一个错误:electcol_arrayref failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near [SQL Command] at Bugzilla/DB.pm line 1521
  • ` Bugzilla::DB::_check_references(Bugzilla::DB::Mysql=HASH(0xb4eb848), "bug_group_map", "group_id", HASH(0xee7​​a610)) 在 Bugzilla/DB.pm 调用第 663 行 Bugzilla::DB::bz_add_fks(Bugzilla::DB::Mysql=HASH(0xb4eb848), "bug_group_map", HASH(0xaa0a7d0), HASH(0xee7​​a640)) 在 Bugzilla/DB.pm 第 581 行调用 Bugzilla::DB ::bz_setup_foreign_keys(Bugzilla::DB::Mysql=HASH(0xb4eb848)) 在 Bugzilla/Install/DB.pm 第 748 行调用 Bugzilla::Install::DB::update_table_definitions(HASH(0x2ec9590)) 在 C:\bugzilla 调用\checksetup.pl 第 175 行`

标签: regex perl bugzilla


【解决方案1】:

似乎 MySQL 不再允许使用未转义的 { 来匹配 {

这可能发生在 MySQL 在 8.0.4 版本中开始使用具有更好 Unicode 支持的新正则表达式库时。

Bugzilla/Install/DB.pm,替换

"'^[^,]+{'"

"'^[^,]+\\\\{'"

我提交了ticket


对于那些好奇为什么会有这么多斜线的人:

$dbh->sql_regexp 期望它的第二个参数是生成 MySQL 正则表达式模式的 SQL。

  1. Perl 字符串文字 "'\\\\{" 生成字符串 '\\{'
  2. 字符串'\\{'用作SQL代码。
  3. SQL 代码'\\{' 生成字符串\{
  4. 字符串\{ 用作正则表达式模式。
  5. 正则表达式模式\{ 匹配{

【讨论】:

  • 感谢您的帮助。
猜你喜欢
  • 1970-01-01
  • 2020-04-12
  • 2011-07-29
  • 1970-01-01
  • 2020-04-21
  • 2016-02-22
  • 1970-01-01
  • 1970-01-01
  • 2020-04-18
相关资源
最近更新 更多