[MDEV-30018] command prompt does not accept new line character \n in my.cnf Created: 2022-11-15  Updated: 2022-12-01  Resolved: 2022-12-01

Status: Closed
Project: MariaDB Server
Component/s: Compiling, Platform FreeBSD
Affects Version/s: 10.6.10
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Miroslav Lachman Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: regression
Environment:

FreeBSD 12.3-RELEASE-p7 amd64 GENERIC
MariaDB 10.6.10



 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.



 Comments   
Comment by Miroslav Lachman [ 2022-11-16 ]

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)]>

Comment by Sergei Golubchik [ 2022-11-25 ]

were both 10.3 and 10.6 built from ports?

Comment by Miroslav Lachman [ 2022-11-26 ]

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

Comment by Sergei Golubchik [ 2022-11-27 ]

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

Comment by Miroslav Lachman [ 2022-11-28 ]

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?

Comment by Sergei Golubchik [ 2022-12-01 ]

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

Generated at Thu Feb 08 10:13:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.