Bug #79410 [Opn->Ver]: system() swallows last chunk if it is exactly 4095 bytes without newline

From: Date: Tue, 24 Mar 2020 22:59:42 +0000
Subject: Bug #79410 [Opn->Ver]: system() swallows last chunk if it is exactly 4095 bytes without newline
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226249@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79410&edit=1

 ID:                 79410
 Updated by:         cmb@php.net
 Reported by:        cschneid@php.net
 Summary:            system() swallows last chunk if it is exactly 4095
                     bytes without newline
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            Program Execution
 Operating System:   *
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2020-03-23 20:41:35] cschneid@php.net

Description:
------------
When executing a program where the output's last chunk is 4095 bytes then the last chunk is
swallowed.
The script below generates 4095 dots on Linux and counts how many system()'s output contain.
None of the dots reach the output, a patch resolving this issue is attached.
The bug could already be reproduced in 5.3.0, I did not trace it back farther than that.

Test script:
---------------
# Execute command print 4095 dots
php -r 'system("printf .%.0s {1..4095}");'  | wc -c

Expected result:
----------------
4095

Actual result:
--------------
0


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=79410&edit=1


Thread (5 messages)

« previous php.bugs (#226249) next »