Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-4175

maxctrl writes error messages to stdout instead of stderr

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.2.4
    • Fix Version/s: 22.08.0
    • Component/s: maxctrl
    • Labels:
      None

      Description

      When maxctrl fails to run a command, it prints an error message (and sets the exit code to be greater than zero).

      In Unix (and hence Linux), each process has two output file descriptors: Standard Output (stdout) and Standard Error (stderr). The purpose of the first is to get common messages from the program - e.g., notices, information etc. The purpose of the second is to specifically get only error messages. This convention is important as many tools that may call a program will check its exit code and, if greater than zero, will log its Standard Error only.

      maxctrl does not comply with these rules as it always prints its messages, even error messages, to stdout (on the Linux shell file descriptors are assigned integers for convenience, with 1 being stdout and 2 being stderr):

      [root@p2w4 ~]# maxctrl lala > stdout 2>stderr; echo $?
      1
      [root@p2w4 ~]# ls -l
      total 4
      -rw-r--r--. 1 root root  0 Jun 23 20:16 stderr
      -rw-r--r--. 1 root root 23 Jun 23 20:16 stdout
      [root@p2w4 ~]# cat stdout 
      Unknown argument: lala
      [root@p2w4 ~]# cat stderr
      [root@p2w4 ~]# 
      

      This issue likely affects all versions of maxctrl since its introduction as a replacement to maxadmin.

        Attachments

          Activity

            People

            Assignee:
            markus makela markus makela
            Reporter:
            assen.totin Assen Totin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.