Permission denied on unlink(lock/update.lock), easy fix, any chance it making it to origin?

If you run tt-rss on an officially unsupported platform (shared hosting, Windows, etc.) post here
tsimmons
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 06 Nov 2013, 20:46

Permission denied on unlink(lock/update.lock), easy fix, any chance it making it to origin?

Postby tsimmons » 05 Jan 2017, 23:42

Running the updater as a scheduled task on Windows 2008 R2 has for years led to the following log message every time the update runs:

E_WARNING (2) update.php:408 unlink(lock/update.lock): Permission denied 1. update.php(408): unlink(lock/update.lock)


It's not permissions ... it is because you cannot unlink a file that is still open in PHP running on Windows (the file pointer from make_lockfile() is still open when you hit line 408 of update.php.) Adding the following:

Code: Select all

fclose($lock_handle);


right before

Code: Select all

unlink(LOCK_DIRECTORY . "/$lock_filename");


clears this up. It's like opening and closing the door when leaving home instead of busting out a window and jumping. :lol:

Any chance of that making it into origin for us sorry Windows users? :wink: I hate having to modify core code and getting off track for using git pull updates.

See one of the original suggestions in this post.

Thanks &
Cheers.

User avatar
HeikoAdams
Bear Rating Master
Bear Rating Master
Posts: 101
Joined: 19 Mar 2013, 00:17

Re: Permission denied on unlink(lock/update.lock), easy fix, any chance it making it to origin?

Postby HeikoAdams » 06 Jan 2017, 00:30

tsimmons wrote:Any chance of that making it into origin for us sorry Windows users?

Yes, submit a patch or start a merge request on tt-rss.org :wink:

tsimmons
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 06 Nov 2013, 20:46

Re: Permission denied on unlink(lock/update.lock), easy fix, any chance it making it to origin?

Postby tsimmons » 06 Jan 2017, 00:36

Roger that. I wasn't registered with Andrew's gitlab installation, just did.

tsimmons
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 06 Nov 2013, 20:46

Re: Permission denied on unlink(lock/update.lock), easy fix, any chance it making it to origin?

Postby tsimmons » 06 Jan 2017, 01:08

After registering, I created a branch for my proposed changes, committed them locally and tried to push a merge request but received:

remote: GitLab: You are not allowed to push code to this project.
To https://tt-rss.org/git/tt-rss.git
! [remote rejected] fclose-before-unlink-updater -> fclose-before-unlink-updater (pre-receive hook declined)
error: failed to push some refs to 'https://tt-rss.org/git/tt-rss.git'


I'm not a git pro (obviously) ... is there something Andrew has to do before I can push a merge request or am I doing it wrong?

User avatar
HeikoAdams
Bear Rating Master
Bear Rating Master
Posts: 101
Joined: 19 Mar 2013, 00:17

Re: Permission denied on unlink(lock/update.lock), easy fix, any chance it making it to origin?

Postby HeikoAdams » 06 Jan 2017, 01:27

You need to push your changes to your branch, not to master

tsimmons
Bear Rating Trainee
Bear Rating Trainee
Posts: 17
Joined: 06 Nov 2013, 20:46

Re: Permission denied on unlink(lock/update.lock), easy fix, any chance it making it to origin?

Postby tsimmons » 06 Jan 2017, 01:31

Thought I had (my branch is called fclose-before-unlink-updater) ... used the following:

Code: Select all

git push origin fclose-before-unlink-updater


Maybe I need dev rights granted?

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Permission denied on unlink(lock/update.lock), easy fix, any chance it making it to origin?

Postby fox » 06 Jan 2017, 09:38

before i merge anything, i think unlock is done in that fashion to prevent a possible race condition with lock files

so the patch should probably check the platform and only call fclose() explicitly on windows

e: op you should have correct permissions on gitlab now


Return to “Unsupported platforms”

Who is online

Users browsing this forum: No registered users and 1 guest