FS#49392 - [tt-rss] symlinks to data directories at /var/lib/tt-rss/... do not work

Attached to Project: Community Packages
Opened by Volker Tanger (vtanger) - Wednesday, 18 May 2016, 22:18 GMT
Last edited by Jelle van der Waa (jelly) - Sunday, 13 September 2020, 17:43 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Anatol Pomozov (anatolik)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

The PHP scripts themselves test the read-write attributes of various directories used for storing temporary and cached files, namely
* cache/export
* cache/images
* cache/js
* cache/upload
* feed-icons
* lock

Checking those permissions on symlinks fails with current PHP libraries. Thus TTRSS refuses work unless the "problem" is "fixed".
A primitive workaround is to create these directories (with proper permissions) in /usr/share/webapps/tt-rss/ instead of /var/lib/tt-rss/
This task depends upon

Closed by  Jelle van der Waa (jelly)
Sunday, 13 September 2020, 17:43 GMT
Reason for closing:  No response
Comment by Anatol Pomozov (anatolik) - Thursday, 19 May 2016, 03:18 GMT
cache and runtime files should not be stored in /usr/share. /var/... is the right place for caches.

Just create /var/lib/tt-rss/ with proper permissions (like http:http) it works perfectly fine.
Comment by Volker Tanger (vtanger) - Friday, 20 May 2016, 12:11 GMT
  • Field changed: Percent Complete (100% → 0%)
I concur with you that variable and cache data should belong to /var instead of /usr/share
It just did not work.

I just debugged the source: it's not a file permission problem but a programming error: in PHP the IS_WRITABLE function checks on real path only and is allergic to symbolic links (likewise for tilde and dotdot parts in the file-to-be-checked-name). This is why the functionality breaks even if the permissions are set correctly.


Thus in

include/sanity_check.php

instead of
if (!is_writable(CACHE_DIR . "/images")) {

it should read
if (!is_writable(realpath(CACHE_DIR . "/images"))) {

The same applies to similar !is_writable tests in this file.

The problem exists upstream, too.
https://tt-rss.org/gitlab/fox/tt-rss/blob/master/include/sanity_check.php
Comment by Anatol Pomozov (anatolik) - Friday, 20 May 2016, 12:44 GMT
In this case the Arch package should not create symlinks and create caches in /var/lib/tt-rss/ directly. It is actually what I use at my server.
Comment by Anatol Pomozov (anatolik) - Wednesday, 25 May 2016, 04:43 GMT
My previous statement is incorrect. I just checked my server and I see that '/usr/share/webapps/tt-rss/' contains symlinks to /var/lib/tt-rss/* and it works fine. The process is run as http:http.

I also agree that it makes more sense to use 'realpath()' functional call. Could you please send a patch upstream?
Comment by Volker Tanger (vtanger) - Wednesday, 25 May 2016, 22:27 GMT
How is your CACHE_DIR set in /etc/webapps/tt-rss/config.php

define('CACHE_DIR', 'cache');

(as is default and coming with the package) or

define('CACHE_DIR', '/var/lib/tt-rss/cache');

The latter will run properly but ignore the symlinks within the /usr tree - and is not the one distributed in the package.
Comment by Anatol Pomozov (anatolik) - Wednesday, 01 June 2016, 05:33 GMT
My setup config

$ grep CACHE_DIR /etc/webapps/tt-rss/config.php
define('CACHE_DIR', 'cache');
Comment by Ivy Foster (escondida) - Thursday, 10 October 2019, 04:41 GMT
Is this still a problem in the current version?

Loading...