Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
Description
my_vsnprintf() is used internally in the server as a portable printf replacement. And it's also exported to plugins as a service.
It supports a subset of printf formats and three extensions:
- %`s means that a string should be quoted like an `identifier`
- %b means that it's a binary string, not zero-terminated; printing won't stop at \0, so one should always specify the field width (like %.100b)
- %M is used in error messages and prints the integer (errno) and the corresponding strerror() for it
- %T takes string and print it like %s but if the string should be truncated puts "..." at the end
gcc knows printf formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable printf format checks.
An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions
- %sQ to mean "print as an identifier"
- %sB to mean "print a binary string"
- %iE to mean "print an errno"
- %sT to put a "..." as truncation indicator
It'll also need %sS as a synonym for %s as a form of escaping. In case someone needs to print a string, followed by T — using %sT will not do it anymore, so %sST can be used instead.
Old formats can still be supported or they can be removed. The major version of the service should be increased either way to signal an incompatible change (different semantics for, e.g., %sT).
All error messages and all usages of my_vsnprintf should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc printf format checks should be enabled.
Attachments
Issue Links
- blocks
-
MDEV-35601 Use my_vsnprintf extension %sQ where appropriate
-
- Open
-
- relates to
-
MDEV-19784 C++11 protectors for my_error
-
- In Review
-
-
MDEV-35460 Phase out integer typedefs and macros in favor of C/C++ Standard ones
-
- Open
-
-
MDEV-35498 InnoDB logger class causes significant code bloat
-
- Open
-
-
MDEV-35600 Reconsider charset-specific snprintf’s vs. my_snprintf_ex
-
- Open
-
-
MDEV-22545 my_vsnprintf behaves not as in C standard
-
- Closed
-
- split to
-
MDEV-35451 Add printf format for GTID
-
- Open
-
-
MDEV-35597 SST error might be printing literal %M
-
- Open
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%sE}} to mean "print an errno" old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax and gcc {{printf}} format checks should be enabled. |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax and gcc {{printf}} format checks should be enabled. |
Summary | make my_vsnprintf to use gcc-compatibe format extensions | make my_vsnprintf to use gcc-compatible format extensions |
Link |
This issue relates to |
Description |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax and gcc {{printf}} format checks should be enabled. |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" Padding with ... if string is too long should only be used for identifiers. old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax and gcc {{printf}} format checks should be enabled. |
Description |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" Padding with ... if string is too long should only be used for identifiers. old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax and gcc {{printf}} format checks should be enabled. |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax and gcc {{printf}} format checks should be enabled. |
Rank | Ranked higher |
Priority | Minor [ 4 ] | Major [ 3 ] |
Link | This issue relates to MDEV-19784 [ MDEV-19784 ] |
Labels | beginner-friendly | beginner-friendly gsoc21 |
Fix Version/s | 10.7 [ 24805 ] | |
Fix Version/s | 10.6 [ 24028 ] |
Fix Version/s | 10.8 [ 26121 ] | |
Fix Version/s | 10.7 [ 24805 ] |
Workflow | MariaDB v3 [ 105761 ] | MariaDB v4 [ 131238 ] |
Fix Version/s | 10.9 [ 26905 ] | |
Fix Version/s | 10.8 [ 26121 ] |
Summary | make my_vsnprintf to use gcc-compatible format extensions | make my_vsnprintf to use gcc-compatible format extensions (Part-time project) |
Labels | beginner-friendly gsoc21 | beginner-friendly gsoc21 gsoc22 |
Fix Version/s | 10.10 [ 27530 ] | |
Fix Version/s | 10.9 [ 26905 ] |
Description |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax and gcc {{printf}} format checks should be enabled. |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc {{printf}} format checks should be enabled. |
Fix Version/s | 10.11 [ 27614 ] | |
Fix Version/s | 10.10 [ 27530 ] |
Fix Version/s | 10.12 [ 28320 ] | |
Fix Version/s | 10.11 [ 27614 ] |
Labels | beginner-friendly gsoc21 gsoc22 | beginner-friendly gsoc21 gsoc22 gsoc24 |
Summary | make my_vsnprintf to use gcc-compatible format extensions (Part-time project) | make my_vsnprintf to use gcc-compatible format extensions |
Description |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc {{printf}} format checks should be enabled. |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it * {{%T}} takes string and print it like {{%s}} but if the string should be truncated puts "..." at the end gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc {{printf}} format checks should be enabled. |
Description |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it * {{%T}} takes string and print it like {{%s}} but if the string should be truncated puts "..." at the end gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc {{printf}} format checks should be enabled. |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it * {{%T}} takes string and print it like {{%s}} but if the string should be truncated puts "..." at the end gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator Perhaps it'll also need {{%sS}} and {{%uU}} as synonyms for {{%s}} and {{%u}}, as a form of escaping. In case someone needs to print a string, followed by {{I}} — using {{%sI}} will not do it anymore, so {{%sSI}} can be used instead. old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc {{printf}} format checks should be enabled. |
Description |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it * {{%T}} takes string and print it like {{%s}} but if the string should be truncated puts "..." at the end gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator Perhaps it'll also need {{%sS}} and {{%uU}} as synonyms for {{%s}} and {{%u}}, as a form of escaping. In case someone needs to print a string, followed by {{I}} — using {{%sI}} will not do it anymore, so {{%sSI}} can be used instead. old formats can still be supported or they can be removed and in the latter case the major version of the service should be increased to signal an incompatible change. All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc {{printf}} format checks should be enabled. |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it * {{%T}} takes string and print it like {{%s}} but if the string should be truncated puts "..." at the end gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator Perhaps it'll also need {{%sS}} and {{%uU}} as synonyms for {{%s}} and {{%u}}, as a form of escaping. In case someone needs to print a string, followed by {{I}} — using {{%sI}} will not do it anymore, so {{%sSI}} can be used instead. Old formats can still be supported or they can be removed. The major version of the service should be increased either way to signal an incompatible change (different semantics for, e.g., {{%sI}}). All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc {{printf}} format checks should be enabled. |
Assignee | Sergei Golubchik [ serg ] | Andrew Hutchings [ JIRAUSER52179 ] |
Fix Version/s | 11.7 [ 29815 ] | |
Fix Version/s | 11.0 [ 28320 ] |
Assignee | Andrew Hutchings [ JIRAUSER52179 ] | Sergei Golubchik [ serg ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Sergei Golubchik [ serg ] | Andrew Hutchings [ JIRAUSER52179 ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Priority | Major [ 3 ] | Critical [ 2 ] |
Fix Version/s | 11.8 [ 29921 ] | |
Fix Version/s | 11.7 [ 29815 ] |
Labels | beginner-friendly gsoc21 gsoc22 gsoc24 | beginner-friendly gsoc21 gsoc22 gsoc24 tech_debt |
Assignee | Andrew Hutchings [ JIRAUSER52179 ] | Brandon Nesterenko [ JIRAUSER48702 ] |
Description |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it * {{%T}} takes string and print it like {{%s}} but if the string should be truncated puts "..." at the end gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sI}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%uE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator Perhaps it'll also need {{%sS}} and {{%uU}} as synonyms for {{%s}} and {{%u}}, as a form of escaping. In case someone needs to print a string, followed by {{I}} — using {{%sI}} will not do it anymore, so {{%sSI}} can be used instead. Old formats can still be supported or they can be removed. The major version of the service should be increased either way to signal an incompatible change (different semantics for, e.g., {{%sI}}). All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc {{printf}} format checks should be enabled. |
{{my_vsnprintf()}} is used internally in the server as a portable {{printf}} replacement. And it's also exported to plugins as a service.
It supports a subset of {{printf}} formats and three extensions: * {{%`s}} means that a string should be quoted like an {{`identifier`}} * {{%b}} means that it's a binary string, not zero-terminated; printing won't stop at {{\0}}, so one should always specify the field width (like {{%.100b}}) * {{%M}} is used in error messages and prints the integer (errno) and the corresponding {{strerror()}} for it * {{%T}} takes string and print it like {{%s}} but if the string should be truncated puts "..." at the end gcc knows {{printf}} formats and check whether actual arguments match the format string and issue a warning if they don't. Unfortunately there seems to be no easy way to teach gcc our extensions, so for now we have to disable {{printf}} format checks. An better approach would be to use gcc compatible format extensions, like Linux kernel does. We should migrate to a different syntax for our extensions * {{%sQ}} to mean "print as an identifier" * {{%sB}} to mean "print a binary string" * {{%iE}} to mean "print an errno" * {{%sT}} to put a "..." as truncation indicator It'll also need {{%sS}} as a synonym for {{%s}} as a form of escaping. In case someone needs to print a string, followed by {{T}} — using {{%sT}} will not do it anymore, so {{%sST}} can be used instead. Old formats can still be supported or they can be removed. The major version of the service should be increased either way to signal an incompatible change (different semantics for, e.g., {{%sT}}). All error messages and all usages of {{my_vsnprintf}} should be changed to use the new syntax. One way to do it is to disable old syntax conditonally, only in debug builds. All gcc {{printf}} format checks should be enabled. |
Link | This issue relates to MDEV-35460 [ MDEV-35460 ] |
Link | This issue relates to MDEV-35498 [ MDEV-35498 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Status | Stalled [ 10000 ] | In Testing [ 10301 ] |
Link | This issue split to MDEV-35597 [ MDEV-35597 ] |
Link | This issue relates to MDEV-35600 [ MDEV-35600 ] |
Link | This issue blocks MDEV-35601 [ MDEV-35601 ] |
Link | This issue is part of TODO-5071 [ TODO-5071 ] |
Attachment | MDEV-21978 Test Report.pdf [ 74430 ] |
Assignee | Brandon Nesterenko [ JIRAUSER48702 ] | Jimmy Hú [ JIRAUSER55761 ] |
Status | In Testing [ 10301 ] | Stalled [ 10000 ] |
Status | Stalled [ 10000 ] | In Review [ 10002 ] |
Link | This issue split to MDEV-35451 [ MDEV-35451 ] |
Assignee | Jimmy Hú [ JIRAUSER55761 ] | Brandon Nesterenko [ JIRAUSER48702 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Assignee | Brandon Nesterenko [ JIRAUSER48702 ] | Jimmy Hú [ JIRAUSER55761 ] |
Labels | beginner-friendly gsoc21 gsoc22 gsoc24 tech_debt | Preview_11.8 beginner-friendly gsoc21 gsoc22 gsoc24 tech_debt |
issue.field.resolutiondate | 2025-02-11 19:43:29.0 | 2025-02-11 19:43:29.214 |
Fix Version/s | 11.8.1 [ 29961 ] | |
Fix Version/s | 11.8 [ 29921 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
wlad suggested %lluH , for Humanized formatting (
MDEV-27158)