@brainfoolong opened this Issue on January 11th 2022 Contributor

Another one :)

I've seen really strange error messages since a while in our Apache log which have no timestamp or what so ever.

  The system cannot find the path specified.
  The system cannot find the path specified.
  The system cannot find the path specified.
  The system cannot find the path specified.
  'groups' is not recognized as an internal or external command,
  operable program or batch file.

After checking every application i finally found the problem in Matomo (Current version).

The call stack from
https://github.com/matomo-org/matomo/blob/ec3e220b315dbd06a82508e3c0121dbe898cf243/core/CliMulti/Process.php#L206

with the stack
https://github.com/matomo-org/matomo/blob/ec3e220b315dbd06a82508e3c0121dbe898cf243/core/CliMulti/Process.php#L243
https://github.com/matomo-org/matomo/blob/ec3e220b315dbd06a82508e3c0121dbe898cf243/core/CliMulti/Process.php#L255

and the stack
https://github.com/matomo-org/matomo/blob/ec3e220b315dbd06a82508e3c0121dbe898cf243/core/CliMulti/Process.php#L234
https://github.com/matomo-org/matomo/blob/ec3e220b315dbd06a82508e3c0121dbe898cf243/core/CliMulti/Process.php#L250

both result in commands executed on windows ps x and awk... that not exist on windows.

There are even more commands, that are all suppressed with @shell_exec that do not throw a Matomo error, but still log errors on the windows apache, because commands are tried to execute, which apache then logs as errors without useful information.

A general check for commands should be implemented, to check for windows or not. Some shell_exec are already pre-cechekd with isWindows checks, but not all.

More examples:
https://github.com/matomo-org/matomo/blob/ec3e220b315dbd06a82508e3c0121dbe898cf243/core/CliMulti/Process.php#L263

Maybe a fix for the whole canse of isSupportedWithReason could be, when on windows, just skip all other checks. As the isWindows check already return that is not possible on windows so further checks are useless, aren't they?

@tsteur commented on January 11th 2022 Member

Makes sense 👍 if isWindows() === true we want to return immediately and not perform any of the other checks. Thanks for reporting this @brainfoolong

As in

diff --git a/core/CliMulti/Process.php b/core/CliMulti/Process.php
index e3a6bd968d..6016f72918 100644
--- a/core/CliMulti/Process.php
+++ b/core/CliMulti/Process.php
@@ -215,6 +215,7 @@ class Process

         if (SettingsServer::isWindows()) {
             $reasons[] = 'not supported on windows';
+            return $reasons;
         }

         if (self::isMethodDisabled('shell_exec')) {
This Issue was closed on January 18th 2022
Powered by GitHub Issue Mirror