Skip to content

RemoteOperations::exec_command returns error data in a corrected (expected) format (#154) #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

dmitry-lipetsk
Copy link
Collaborator

RemoteOperations::exec_command does not translate an error message into UTF8 implicitly - function "normalize_error" was deleted.

It resolves a problem with "mutable" format of error data that is returned from this method.

Asserts were added.

This PR closes #154

…rrected)

RemoteOperations::exec_command does not translate an error message into UTF8 implicitly - normalize_error was deleted.

Asserts were added.
@dmitry-lipetsk
Copy link
Collaborator Author

dmitry-lipetsk commented Dec 6, 2024

This PR fixes an original problem with tests but a problem with RemoteOperations::exec_command is more difficult.

We forces this method to raise ExecUtilException with binary message when encoding is not defined. It resolves a problem with tests. But we do not pay attention to the following things:

  1. RemoteOperations::exec_command may throw another ExecUtilException with text (string) message:
    https://github.com/postgrespro/testgres/blob/5e9ecbcce3db6ade8f3bf59290e8d57d8dde19fa/testgres/operations/remote_ops.py#L82C19-L82C36

  2. LocalOperations::exec_command always raises ExecUtilException with text messages:

self._raise_exec_exception('Utility exited with non-zero code. Error `{}`', cmd, process.returncode, error or output)

Note that we may not decode error/output here.


I think we have to stop appending an error data into an exception message (of ExecUtilException), because we do not know the correct codepage of this data. On Windows, for example, error and output may have cp1251 charset.

We can transfer this data as an additional property of ExecUtilException.

@dmitry-lipetsk
Copy link
Collaborator Author

It is an incorrect direction. Exception (ExecUtilException) must have a message with normal string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A problem in OsOperations::exec_command and an error message
1 participant