Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php 32 bit (arm) filemtime on large file issue #18971

Closed
cyberb opened this issue Sep 11, 2015 · 9 comments
Closed

php 32 bit (arm) filemtime on large file issue #18971

cyberb opened this issue Sep 11, 2015 · 9 comments

Comments

@cyberb
Copy link
Contributor

cyberb commented Sep 11, 2015

I am facing an issue with running file:scan on arm:

filemtime(): stat failed

Looks like the reason is filemtime [1] is not working for files over 2G on 32 bit php [2]

Fixing function according to php website comment solved the problem:

  exec ('stat -c %Y '. escapeshellarg ($this->getSourcePath($path)));

I am sure that worked fine in past with older owncloud/php versions on the same hardware.

Is there something I am missing or this never worked on php (32bit) / arm?
Or is it possible to have some if, like:

if (PHP_INT_SIZE === 4)
   return exec ('stat -c %Y '. escapeshellarg ($this->getSourcePath($path)));
else
   return filemtime($this->getSourcePath($path));

I cannot upgrade php to 64 bit on arm board as there there is no such thing yet as arm64 or at least not popular enough on single board computers yet.

[1] http://php.net/manual/en/function.filemtime.php#68814
[2] https://github.com/owncloud/core/blob/master/lib/private/files/storage/local.php#L159

My system:
ownCloud version 8.0.4
PHP Version => 5.6.9
System => Linux cubietruck 3.4.79-sun7i #13 SMP PREEMPT Thu Jul 3 06:34:55 CST 2014 armv7l
Configure Command => './configure' '--enable-fpm' '--with-pgsql' '--with-pdo-pgsql' '--enable-opcache' '--prefix' '--with-config-file-path=/root/build/install/config' '--with-gd' '--enable-zip' '--with-zlib' '--with-curl' '--with-readline' '--with-ldap' '--with-ldap-sasl' '--with-libdir=lib/arm-linux-gnueabihf' '--enable-mbstring'

@hoorna
Copy link

hoorna commented Sep 11, 2015

Hi,

I am also facing an issue with file:scan. I hope I am allowed to post it here.

While running the file:scan command I am receiving many, many, many times the next message:

     stat: invalid option -- 'c'
     BusyBox v1.16.1 (2015-06-29 18:12:44 CST) multi-call binary.

     Usage: stat [OPTIONS] FILE...

     Display file (default) or filesystem status

     Options:
             -f      Display filesystem status
             -L      Follow links
             -t      Display info in terse form

I am running OwnCloud on a Synology Diskstation. Synology implemented the Busybox shell on their Diskstations.

I don't know if there is something going wrong nor how to solve this.

@cyberb
Copy link
Contributor Author

cyberb commented Sep 11, 2015

After digging a little bit more I have found that there is already exist some large file support for file size:
https://github.com/owncloud/core/blob/master/lib/private/largefilehelper.php#L164

So probably the right way to fix filemtime issue is to add getFileMTime similar to getFileSize.
I can add one in a branch but I can do only linux.

@hoorna
Your issue must be with getFileSize which tries 'stat -c' on linux:
https://github.com/owncloud/core/blob/master/lib/private/largefilehelper.php#L170
but busybox probably does not implement -c option.

@cyberb cyberb changed the title php 32 bit (arm) filemtime issue php 32 bit (arm) filemtime on large file issue Sep 11, 2015
@poltpolt
Copy link

poltpolt commented Feb 3, 2016

this is still an issue in 32bit x86 in owncloud 8.2.2
@cyberb Your solution works ok - how can we make it go upstream?

@cyberb
Copy link
Contributor Author

cyberb commented May 20, 2016

@polrus Someone from ownCloud team should probably do a complete fix to cover other platforms as I care only about linux.

@PVince81
Copy link
Contributor

@cyberb not sure what other platforms you mean. Windows server support has been dropped a while ago and so far only Linux is supported. (some people run on FreeBSD but it's not officially supported)

@cyberb
Copy link
Contributor Author

cyberb commented Jun 17, 2016

If that is true then it should be easy to integrate my fix

@DeepDiver1975
Copy link
Member

If that is true then it should be easy to integrate my fix

Feel free to submit a pull request - THX

DeepDiver1975 pushed a commit that referenced this issue Sep 29, 2016
* fixing php 32 bit (arm) filemtime on large file issue (#18971)

* cast to int
@PVince81
Copy link
Contributor

PR #25428 got merged, closing

@lock
Copy link

lock bot commented Aug 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants