[phpMyAdmin Git] [phpmyadmin/sql-parser] 541948: Fix #309 - Use stream_select instead of non-blocking STDIN

Sergio Durigan Junior sergio.durigan at canonical.com
Thu Aug 27 09:39:26 CEST 2020


Branch: refs/heads/QA
Home: https://github.com/phpmyadmin/sql-parser
Commit: 5419487eb14c96e729bc6b3cda1c6e215b5097af
https://github.com/phpmyadmin/sql-parser/commit/5419487eb14c96e729bc6b3cda1c6e215b5097af
Author: Sergio Durigan Junior <sergio.durigan at canonical.com>
Date: 2020-08-27 (Thu, 08 August 2020) +02:00

Changed paths: 
M src/Utils/CLI.php

Log Message:
-----------
Fix #309 - Use stream_select instead of non-blocking STDIN

The idiom used in the readStdin function from src/Utils/CLI.php is not
entirely error-prone: marking stdin as non-blocking and then reading
from it can lead to racy scenarios where we are not able to catch
what's being fed to the program.  This can be seen very frequently on
s390x, where a loop like this:

  $ while echo "invalid query" | /usr/bin/php7.4 /path/to//highlight-query; do sleep 1; done;

will lead to failures once on every few runs (as can be seen in the
description of issue #309).

This commit implements the more robust method which uses stream_select
to wait for stdin to become available, but resorts to a sensible
timeout value (0.2 seconds) which will prevent the blocking from
happening.

I tested this patch extensively on s390x and amd64, and noticed that
the non-determinism is gone.

Signed-off-by: Sergio Durigan Junior <sergio.durigan at canonical.com>

Commit: c862a108b363c40fcc9d3ae03c0e0983f1a7d8ae
https://github.com/phpmyadmin/sql-parser/commit/c862a108b363c40fcc9d3ae03c0e0983f1a7d8ae
Author: William Desportes <williamdes at wdes.fr>
Date: 2020-08-27 (Thu, 08 August 2020) +02:00

Changed paths: 
M src/Utils/CLI.php

Log Message:
-----------
#309 - Set back PHP compatibility


Signed-off-by: William Desportes <williamdes at wdes.fr>

Commit: 0770895be14d06f3ee9df912e947d7774eb11872
https://github.com/phpmyadmin/sql-parser/commit/0770895be14d06f3ee9df912e947d7774eb11872
Author: William Desportes <williamdes at wdes.fr>
Date: 2020-08-27 (Thu, 08 August 2020) +02:00

Changed paths: 
M src/Utils/CLI.php

Log Message:
-----------
Merge #312 - Fix #309 - Use stream_select instead of non-blocking STDIN

Pull-request: #312
Fixes: #309

Signed-off-by: William Desportes <williamdes at wdes.fr>

Commit: e0da85e69f9eb3571982f161c831b68d6d537eb4
https://github.com/phpmyadmin/sql-parser/commit/e0da85e69f9eb3571982f161c831b68d6d537eb4
Author: William Desportes <williamdes at wdes.fr>
Date: 2020-08-27 (Thu, 08 August 2020) +02:00

Changed paths: 
M CHANGELOG.md

Log Message:
-----------
Add a ChangeLog entry for #309

Signed-off-by: William Desportes <williamdes at wdes.fr>



More information about the Git mailing list