1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Not a Bug Possible bug with avatars

Discussion in 'Resolved Bug Reports' started by Romchik®, Jul 8, 2011.

  1. Romchik®

    Romchik® Well-Known Member

    I'm not sure this is a bug in the XF or the server.
    One user complains. He has in the error log:
    rename(/***/forum/data/avatars/l/0/1.jpg) [<a href='function.rename'>function.rename</a>]: Operation not permitted
    File: library/XenForo/Model/Avatar.php:302
    Stack Trace
    #0 [internal function]: XenForo_Application::handlePhpError(2, 'rename(/var/tmp...', '/usr/home/pva...', 302, Array)
    #1 /***/forum/library/XenForo/Model/Avatar.php(302): rename('/var/tmp/phpj2C...', '/usr/home/pva...')
    #2 /***/forum/library/XenForo/Model/Avatar.php(189): XenForo_Model_Avatar->_writeAvatar(1, 'l', '/var/tmp/phpj2C...')
    #3 /***/forum/library/XenForo/Model/Avatar.php(67): XenForo_Model_Avatar->applyAvatar(1, '/var/tmp/phpj2C...', 3, 152, 155, Array)
    #4 /***/forum/library/XenForo/ControllerPublic/Account.php(482): XenForo_Model_Avatar->uploadAvatar(Object(XenForo_Upload), 1, Array)
    #5 /***/forum/library/XenForo/FrontController.php(303): XenForo_ControllerPublic_Account->actionAvatarUpload()
    #6 /***/forum/library/XenForo/FrontController.php(132): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
    #7 /***/forum/index.php(15): XenForo_FrontController->run()
    #8 {main}
    chmod - 777.
    With attachments he did not have a problems or errors.

    And this change fixes his problem.
    library/XenForo/Model/Avatar.php:302 :
                $success rename($tempFile$filePath);
    $success = @rename($tempFile$filePath);
    Dinh Thanh likes this.
  2. Mike

    Mike XenForo Developer Staff Member

    That just silences the error - that's an error coming from the OS itself, so it's indicating that the rename doesn't work. If the rename goes through, then that's very misleading and may be an issue in the file system (permissions, perhaps in the temp area).

    In very old versions, apparently rename couldn't move across partitions and this error could happen, but that was changed many years ago. I do see that move_uploaded_file (which can be used for attachments) uses some different code, but the same thing should be used for both attachment thumbs and avatars. If image attachments work, I suspect that there is a permission issue at play.
  3. liquidox

    liquidox Member

    I can confirm the edit to Avatar.php actually SOLVES the issue, not just hide the error.
  4. Brandon

    Brandon Active Member

    I was having the same issue on my server. it's a permissions issue where the file copied has a different user than my vhost. adding the @ solved it.
  5. Dinh Thanh

    Dinh Thanh Well-Known Member

    This is not resolved in lasted Xenforo 1.1.2.
    I have this issue and Romchik's tip resloved it.
  6. ricky lemuz

    ricky lemuz New Member

    could any one help me? for me the avatars just load... and they dont work..
  7. Brogan

    Brogan XenForo Moderator Staff Member

    This is a bug report.

    If you want support with your installation, associate your forum account with your licence and post in the customer support forums.
  8. Arkshine

    Arkshine Active Member

    Debian 6 "squeeeze" + XF 1.1.4 + correct persmission, and it still happens. I had to edit again to add a @ to get it working. Well just saying/confirming the issue and I would hope something will be done because it's going to be a pain to redo always the same modification again and again.
  9. Kyle

    Kyle Member

    I just ran into this as well on XF 1.1.5, with the correct permissions, etc. In our case, it will try to rename the tmp file (in /tmp), to the data directory which resides on an NFS share. I am not sure if it is a cross filesystems issue or what, but suppressing the error as suggested does indeed allow it to function as expected. I realize that's not a proper fix but this is in my opinion an issue still.

Share This Page