Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-13050

server/debian/mariadb-server-10.x.mysql-server.logrotate || GNU grep v. 2.2.4 [UBUNTU-16.04] FAILS

Details

    Description

      server/debian/mariadb-server-10.x.mysql-server.logrotate
      line 14: if [ -f `my_print_defaults --mysqld | grep -oP "pid-file=\K[^$]+"` ]; then

      this always fails in GNU grep v. 22.4 because of:

      _*$ echo $ | grep -Pz $
      grep: unescaped $ or $ not supported with -Pz
      ...
      This is desired behavior of GNU grep version 2.24 (released on March 10 2016) and above, and that's the fix for the bug which was introduced in GNU grep 2.5.
      ...
      *_
      https://unix.stackexchange.com/questions/324263/grep-command-doesnt-support-start-and-end-of-line-anchors-when-its-wit

      https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22655#47

      Though it's a GNU grep issue there's the need for adjusting grep condition to circumstances.

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment -

            Given the amount of use of my_print_defaults to extract specific server settings perhaps it is my_print_defaults that needs an interface change to return a subset of values only rather than predictable but necessary grep pipelines.

            danblack Daniel Black added a comment - Given the amount of use of my_print_defaults to extract specific server settings perhaps it is my_print_defaults that needs an interface change to return a subset of values only rather than predictable but necessary grep pipelines.

            The line could be updated to:

                      if [ -f `my_print_defaults --mysqld | grep -m 1 -oP "pid-file=\K.+$"` ]; then
            

            That's what the Debian packages use right now.

            oerdnj Ondřej Surý (Inactive) added a comment - The line could be updated to: if [ -f `my_print_defaults --mysqld | grep -m 1 -oP "pid-file=\K.+$" ` ]; then That's what the Debian packages use right now.
            danblack Daniel Black added a comment -

            Or since pid files aren't actually needed in the configuration:

            if systemctl -q is-active mariadb; then
            

            danblack Daniel Black added a comment - Or since pid files aren't actually needed in the configuration: if systemctl -q is-active mariadb; then

            The fix implemented in Debian is not a proper solution, as the process will use the latest definition of a variable. So the 1st instance in /etc/mysql/my.cnf will be overwritten with the second instance in /etc/mysql/mariadb.conf.d/50-server.cnf. Or, potentially in other custom definitions of the variable.

            It is better to use:

            if [ -f $(my_print_defaults --mysqld | grep -m1 -oP "pid-file=\K[^$]+") | tail -n1 ]; then
            

            xkill Pablo Catalina added a comment - The fix implemented in Debian is not a proper solution, as the process will use the latest definition of a variable. So the 1st instance in /etc/mysql/my.cnf will be overwritten with the second instance in /etc/mysql/mariadb.conf.d/50-server.cnf. Or, potentially in other custom definitions of the variable. It is better to use: if [ -f $(my_print_defaults --mysqld | grep -m1 -oP "pid-file=\K[^$]+" ) | tail -n1 ]; then
            xkill Pablo Catalina added a comment - Fix on pull request: https://github.com/MariaDB/server/pull/934
            otto Otto Kekäläinen added a comment - Superseded by https://github.com/MariaDB/server/pull/1556 and MDEV-22659 .
            danblack Daniel Black added a comment -

            Fixed per duplicate issue MDEV-19436

            danblack Daniel Black added a comment - Fixed per duplicate issue MDEV-19436

            People

              danblack Daniel Black
              href hubert reffer
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.