Skip to content

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

Closed

Description

@cyberb

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'

Activity

  1. hoorna commented on Sep 11, 2015

    @hoorna

    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.

  2. cyberb commented on Sep 11, 2015

    @cyberb
    ContributorAuthor

    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.

  3. changed the title [-]php 32 bit (arm) filemtime issue[/-] [+]php 32 bit (arm) filemtime on large file issue[/+] on Sep 11, 2015
  4. poltpolt commented on Feb 3, 2016

    @poltpolt

    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?

  5. cyberb commented on May 20, 2016

    @cyberb
    ContributorAuthor

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

  6. PVince81 commented on Jun 17, 2016

    @PVince81
    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)

  7. cyberb commented on Jun 17, 2016

    @cyberb
    ContributorAuthor

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

  8. DeepDiver1975 commented on Jun 21, 2016

    @DeepDiver1975
    Contributor

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

    Feel free to submit a pull request - THX

  9. PVince81 commented on Jan 13, 2017

    @PVince81
    Contributor

    PR #25428 got merged, closing

  10. lock commented on Aug 3, 2019

    @lock

    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.

  11. locked as resolved and limited conversation to collaborators on Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions