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

command prompt does not accept new line character \n in my.cnf

Details

    Description

      We upgraded some of our machines from 10.3 to 10.6 and noticed that mysql client / mariadb client command prompt looks different in 10.6 because it does not accept newline character \n

      \n is documented in https://mariadb.com/kb/en/mysql-command-line-client/

      In 10.3 we had

      [mysql]
      prompt = \u @ \h [\d]:\nmysql>\_
      

      The prompt looks like this:

      root @ localhost [(mydatabase)]:
      mysql>
      

      With the same settings in MariaDB 10.6 the prompt looks like this:

      root @ localhost [(mydatabase)]:mysql>
      

      The prompt is not wrapped to 2 lines.

      I also tried to define it in section [mariadb-client] but nothing changed.

      This is clearly a regression from the older versions.

      Attachments

        Activity

          Lachman Miroslav Lachman created issue -

          I do more tests. Tab (\t) is ignored too.
          And not only in my.cnf but also on command line:

          # mysql -u root --prompt="(\u@\h) \t\t\t [\d]> "
           
          (root@localhost)  [(none)]>
          

          # mysql -u root --prompt="(\u@\h) \n [\d]> "
           
          (root@localhost)  [(none)]>
          

          Lachman Miroslav Lachman added a comment - I do more tests. Tab (\t) is ignored too. And not only in my.cnf but also on command line: # mysql -u root --prompt="(\u@\h) \t\t\t [\d]> "   (root@localhost) [(none)]> # mysql -u root --prompt="(\u@\h) \n [\d]> "   (root@localhost) [(none)]>

          were both 10.3 and 10.6 built from ports?

          serg Sergei Golubchik added a comment - were both 10.3 and 10.6 built from ports?

          Yes, both built from FreeBSD ports tree in clean environment with poudriere tool.

          Lachman Miroslav Lachman added a comment - Yes, both built from FreeBSD ports tree in clean environment with poudriere tool.

          Could it be readline-vs-libedit thing?

          I've just tried (on my linux) on a version > 10.6 and your prompt worked fine, with \n changing to a new line.

          Please, check what libraries your mysql client was linked with

          serg Sergei Golubchik added a comment - Could it be readline-vs-libedit thing? I've just tried (on my linux) on a version > 10.6 and your prompt worked fine, with \n changing to a new line. Please, check what libraries your mysql client was linked with
          serg Sergei Golubchik made changes -
          Field Original Value New Value
          Status Open [ 1 ] Needs Feedback [ 10501 ]

          Both versions depends on readline and libedit.

          This is the package dependencies info

          # pkg info -d mariadb103-client
          mariadb103-client-10.3.36:
                  readline-8.1.2
                  libedit-3.1.20210910,1
                  libiconv-1.17
          

          # pkg info -d mariadb106-client
          mariadb106-client-10.6.10:
                  readline-8.1.2
                  pcre2-10.40
                  libedit-3.1.20210910,1
                  libiconv-1.17
                  zstd-1.5.2_1
          

          Is there something I can try to change in the configuration?

          Lachman Miroslav Lachman added a comment - Both versions depends on readline and libedit. This is the package dependencies info # pkg info -d mariadb103-client mariadb103-client-10.3.36: readline-8.1.2 libedit-3.1.20210910,1 libiconv-1.17 # pkg info -d mariadb106-client mariadb106-client-10.6.10: readline-8.1.2 pcre2-10.40 libedit-3.1.20210910,1 libiconv-1.17 zstd-1.5.2_1 Is there something I can try to change in the configuration?

          This is the client from 10.6:

          /usr/local/bin/mysql:
                  libedit.so.0 => /usr/local/lib/libedit.so.0 (0x80058a000)
                  libncursesw.so.9 => /lib/libncursesw.so.9 (0x8005c4000)
                  libssl.so.111 => /usr/lib/libssl.so.111 (0x800638000)
                  libcrypto.so.111 => /lib/libcrypto.so.111 (0x8006d0000)
                  libm.so.5 => /lib/libm.so.5 (0x8009c5000)
                  libz.so.6 => /lib/libz.so.6 (0x8009f8000)
                  libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x800a14000)
                  libc++.so.1 => /usr/lib/libc++.so.1 (0x800a1a000)
                  libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x800aec000)
                  libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x800b0f000)
                  libthr.so.3 => /lib/libthr.so.3 (0x800b28000)
                  libc.so.7 => /lib/libc.so.7 (0x800b55000)
                  libelf.so.2 => /lib/libelf.so.2 (0x800f66000)
          

          10.3 client doesn't have libedit.so.0, so it's indeed readline vs libedit issue. 10.3 is linked with a budled readline, while 10.6 uses system libedit.

          Use

          make CMAKE_ON=WITH_READLINE=bundled
          

          to get 10.3-like build

          serg Sergei Golubchik added a comment - This is the client from 10.6: /usr/local/bin/mysql: libedit.so.0 => /usr/local/lib/libedit.so.0 (0x80058a000) libncursesw.so.9 => /lib/libncursesw.so.9 (0x8005c4000) libssl.so.111 => /usr/lib/libssl.so.111 (0x800638000) libcrypto.so.111 => /lib/libcrypto.so.111 (0x8006d0000) libm.so.5 => /lib/libm.so.5 (0x8009c5000) libz.so.6 => /lib/libz.so.6 (0x8009f8000) libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x800a14000) libc++.so.1 => /usr/lib/libc++.so.1 (0x800a1a000) libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x800aec000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x800b0f000) libthr.so.3 => /lib/libthr.so.3 (0x800b28000) libc.so.7 => /lib/libc.so.7 (0x800b55000) libelf.so.2 => /lib/libelf.so.2 (0x800f66000) 10.3 client doesn't have libedit.so.0 , so it's indeed readline vs libedit issue. 10.3 is linked with a budled readline, while 10.6 uses system libedit. Use make CMAKE_ON=WITH_READLINE=bundled to get 10.3-like build
          serg Sergei Golubchik made changes -
          Status Needs Feedback [ 10501 ] Open [ 1 ]
          serg Sergei Golubchik made changes -
          issue.field.resolutiondate 2022-12-01 23:01:36.0 2022-12-01 23:01:36.575
          serg Sergei Golubchik made changes -
          Component/s Compiling [ 11001 ]
          Component/s Platform FreeBSD [ 10139 ]
          Fix Version/s N/A [ 14700 ]
          Assignee Sergei Golubchik [ serg ]
          Resolution Not a Bug [ 6 ]
          Status Open [ 1 ] Closed [ 6 ]

          People

            serg Sergei Golubchik
            Lachman Miroslav Lachman
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.