Req #48886 [Com]: [PATCH] Add support for 64bits file handling on 32 bits architecture
Edit report at https://bugs.php.net/bug.php?id=48886edit=1 ID: 48886 Comment by: mail dot pourri at laposte dot net Reported by:mail dot pourri at laposte dot net Summary:[PATCH] Add support for 64bits file handling on 32 bits architecture Status: Not a bug Type: Feature/Change Request Package:Feature/Change Request Operating System: All PHP Version:5.3.0 Block user comment: N Private report: N New Comment: Please check the attached patch against PHP 5.5.1. I've no time to backport it to all PHP version. It pass all tests that where passing without the patch. Configure with CFLAGS='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' Hope it helps Previous Comments: [2012-01-28 19:20:05] luigi dot assom at gmail dot com Could you please instruct how to add the patch? I don't know if this is what i need... I am trying to work on wikipedia dump i am using xampp and bigdump.php Importing fails with: UNEXPECTED: Can't set file pointer behind the end of file I thought it is because of this patch.. I am not a programmer.. using mac.. please could you tell me what to do? thank you so much, Luigi [2009-11-28 21:12:16] j...@php.net 1. You should provide patch against all branches (PHP_5_2, PHP_5_3 and HEAD) 2. Put it online somewhere where it can be downloaded. Adding them here is quite useless since they can not be applied. 3. Check also bug #27792 of which this is a duplicate of. 4. Mail intern...@lists.php.net about it. [2009-09-11 15:25:49] boite dot pour dot spam at gmail dot com It's working. You should talk about this on the dev mailing list [2009-07-11 13:39:03] mail dot pourri at laposte dot net diff -aur php-5.3.0.orig/ext/phar/phar_internal.h php-5.3.0/ext/phar/phar_internal.h --- php-5.3.0.orig/ext/phar/phar_internal.h 2009-05-13 22:25:43.0 +0200 +++ php-5.3.0/ext/phar/phar_internal.h 2009-07-11 15:10:04.0 +0200 @@ -534,8 +534,15 @@ return FAILURE; } #else -# define phar_stream_copy_to_stream(src, dest, maxlen, len) _php_stream_copy_to_stream_ex((src), (dest), (maxlen), (len) STREAMS_CC TSRMLS_CC) - +static inline size_t phar_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen, size_t *len) +{ + off_t _maxlen = maxlen == (size_t)PHP_STREAM_COPY_ALL ? PHP_STREAM_COPY_ALL : maxlen, _len = 0; + size_t ret = php_stream_copy_to_stream_ex(src, dest, _maxlen, _len); + if (ret == SUCCESS) { + if (len) *len = (size_t)_len; + } else if (len) *len = 0; + return ret; +} #endif #if PHP_VERSION_ID = 6 diff -aur php-5.3.0.orig/ext/standard/file.c php-5.3.0/ext/standard/file.c --- php-5.3.0.orig/ext/standard/file.c 2009-06-22 13:37:30.0 +0200 +++ php-5.3.0/ext/standard/file.c 2009-07-11 15:23:32.0 +0200 @@ -594,7 +594,7 @@ char *filename; int filename_len; zval *data; - int numbytes = 0; + off_t numbytes = 0; long flags = 0; zval *zcontext = NULL; php_stream_context *context = NULL; @@ -642,7 +642,7 @@ switch (Z_TYPE_P(data)) { case IS_RESOURCE: { - size_t len; + off_t len; if (php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL, len) != SUCCESS) { numbytes = -1; } else { @@ -659,9 +659,9 @@ case IS_STRING: if (Z_STRLEN_P(data)) { - numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); - if (numbytes != Z_STRLEN_P(data)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Only %d of %d bytes written, possibly out of free disk space, numbytes, Z_STRLEN_P(data)); + numbytes = (off_t)php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); + if (numbytes != (off_t)Z_STRLEN_P(data)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Only %d of %d bytes written, possibly out of free disk space, (size_t)numbytes, Z_STRLEN_P(data)); numbytes = -1; } } @@ -680,13 +680,13 @@ convert_to_string(*tmp); } if (Z_STRLEN_PP(tmp)) { -
Req #48886 [Com]: [PATCH] Add support for 64bits file handling on 32 bits architecture
Edit report at https://bugs.php.net/bug.php?id=48886edit=1 ID: 48886 Comment by: luigi dot assom at gmail dot com Reported by:mail dot pourri at laposte dot net Summary:[PATCH] Add support for 64bits file handling on 32 bits architecture Status: Not a bug Type: Feature/Change Request Package:Feature/Change Request Operating System: All PHP Version:5.3.0 Block user comment: N Private report: N New Comment: Could you please instruct how to add the patch? I don't know if this is what i need... I am trying to work on wikipedia dump i am using xampp and bigdump.php Importing fails with: UNEXPECTED: Can't set file pointer behind the end of file I thought it is because of this patch.. I am not a programmer.. using mac.. please could you tell me what to do? thank you so much, Luigi Previous Comments: [2009-11-28 21:12:16] j...@php.net 1. You should provide patch against all branches (PHP_5_2, PHP_5_3 and HEAD) 2. Put it online somewhere where it can be downloaded. Adding them here is quite useless since they can not be applied. 3. Check also bug #27792 of which this is a duplicate of. 4. Mail intern...@lists.php.net about it. [2009-09-11 15:25:49] boite dot pour dot spam at gmail dot com It's working. You should talk about this on the dev mailing list [2009-07-11 13:39:03] mail dot pourri at laposte dot net diff -aur php-5.3.0.orig/ext/phar/phar_internal.h php-5.3.0/ext/phar/phar_internal.h --- php-5.3.0.orig/ext/phar/phar_internal.h 2009-05-13 22:25:43.0 +0200 +++ php-5.3.0/ext/phar/phar_internal.h 2009-07-11 15:10:04.0 +0200 @@ -534,8 +534,15 @@ return FAILURE; } #else -# define phar_stream_copy_to_stream(src, dest, maxlen, len) _php_stream_copy_to_stream_ex((src), (dest), (maxlen), (len) STREAMS_CC TSRMLS_CC) - +static inline size_t phar_stream_copy_to_stream(php_stream *src, php_stream *dest, size_t maxlen, size_t *len) +{ + off_t _maxlen = maxlen == (size_t)PHP_STREAM_COPY_ALL ? PHP_STREAM_COPY_ALL : maxlen, _len = 0; + size_t ret = php_stream_copy_to_stream_ex(src, dest, _maxlen, _len); + if (ret == SUCCESS) { + if (len) *len = (size_t)_len; + } else if (len) *len = 0; + return ret; +} #endif #if PHP_VERSION_ID = 6 diff -aur php-5.3.0.orig/ext/standard/file.c php-5.3.0/ext/standard/file.c --- php-5.3.0.orig/ext/standard/file.c 2009-06-22 13:37:30.0 +0200 +++ php-5.3.0/ext/standard/file.c 2009-07-11 15:23:32.0 +0200 @@ -594,7 +594,7 @@ char *filename; int filename_len; zval *data; - int numbytes = 0; + off_t numbytes = 0; long flags = 0; zval *zcontext = NULL; php_stream_context *context = NULL; @@ -642,7 +642,7 @@ switch (Z_TYPE_P(data)) { case IS_RESOURCE: { - size_t len; + off_t len; if (php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL, len) != SUCCESS) { numbytes = -1; } else { @@ -659,9 +659,9 @@ case IS_STRING: if (Z_STRLEN_P(data)) { - numbytes = php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); - if (numbytes != Z_STRLEN_P(data)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Only %d of %d bytes written, possibly out of free disk space, numbytes, Z_STRLEN_P(data)); + numbytes = (off_t)php_stream_write(stream, Z_STRVAL_P(data), Z_STRLEN_P(data)); + if (numbytes != (off_t)Z_STRLEN_P(data)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Only %d of %d bytes written, possibly out of free disk space, (size_t)numbytes, Z_STRLEN_P(data)); numbytes = -1; } } @@ -680,13 +680,13 @@ convert_to_string(*tmp); } if (Z_STRLEN_PP(tmp)) { - numbytes += Z_STRLEN_PP(tmp); + numbytes += (off_t)Z_STRLEN_PP(tmp); bytes_written = php_stream_write(stream, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); if (bytes_written 0 || bytes_written != Z_STRLEN_PP(tmp)) {