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

From: Date: Mon, 23 Mar 2020 20:41:35 +0000
Subject: Bug #79410 [NEW]: system() swallows last chunk if it is exactly 4095 bytes without newline
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226245@lists.php.net to get a copy of this message
From:             cschneid
Operating system: *
PHP version:      Irrelevant
Package:          Program Execution
Bug Type:         Bug
Bug description:system() swallows last chunk if it is exactly 4095 bytes without newline

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 bug report at https://bugs.php.net/bug.php?id=79410&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=79410&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=79410&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=79410&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=79410&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=79410&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=79410&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=79410&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=79410&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=79410&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=79410&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79410&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=79410&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=79410&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=79410&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=79410&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=79410&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=79410&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#226245) next »