Bug 278761 - www/tt-rss: update daemon (ttrssd) now fails with php syntax error
Summary: www/tt-rss: update daemon (ttrssd) now fails with php syntax error
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Alexander Leidinger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-04 19:20 UTC by Robert William Vesterman
Modified: 2024-06-17 00:02 UTC (History)
2 users (show)

See Also:
dereks: maintainer-feedback+


Attachments
Fix files/ttrss_db_check.php.in with (1.17 KB, patch)
2024-05-04 23:05 UTC, Derek Schrock
dereks: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert William Vesterman 2024-05-04 19:20:51 UTC
Last night I updated www/tt-rss@php83 on FreeBSD-RELEASE-13.2-p11 GENERIC amd64 to the latest version (tt-rss-php83-g20240421,2). The main program itself is working fine, but the update daemon, ttrssd, no longer starts up successfully:

# service ttrssd start
PHP Fatal error:  Cannot redeclare get_pref() (previously declared in /usr/local/www/tt-rss/include/functions.php:44) in /usr/local/www/tt-rss/include/functions.php on line 45
/usr/local/etc/rc.d/ttrssd: ERROR: Unknown database configured:

That's the whole thing - there's nothing after the final colon on the last line. I'll point out that the two filenames are the same, the lines are off by one, and at a quick glance by my non-PHP-expert eye only one of the two lines (44) actually declares that function; the other just looks like a line *in* the function. Maybe it's a "include vs. include-once" kind of thing?

I'd like to mention for the benefit of anyone who may also be facing this issue that you can work around it by manually running the update script:

# su -m www -c "/usr/local/bin/php /usr/local/www/tt-rss/update.php --feeds --quiet"

The tt-rss website has several other suggestions for how to update when you're having problems with the standard way. Seems to be written from a Linuxish point of view, but:

https://tt-rss.org/wiki/UpdatingFeeds
Comment 1 Derek Schrock 2024-05-04 19:56:16 UTC
What does your /usr/local/www/tt-rss/config.php look like?
Comment 2 Robert William Vesterman 2024-05-04 20:47:15 UTC
Here's a redacted version of my /usr/local/www/tt-rss/config.php (which has been unmodified and working fine for a long time):

<?php
putenv('TTRSS_PHP_EXECUTABLE=/usr/local/bin/php');
putenv("PATH=/usr/local/bin/:" . getenv("PATH"));
putenv('TTRSS_DB_TYPE=mysql');
putenv('TTRSS_DB_HOST=redacted');
putenv('TTRSS_DB_NAME=redacted');
putenv('TTRSS_DB_USER=redacted');
putenv('TTRSS_DB_PASS=hunter2');
putenv('TTRSS_DB_PORT=redacted');
putenv('TTRSS_SELF_URL_PATH=redacted');
Comment 3 Derek Schrock 2024-05-04 20:54:12 UTC
Ok I was able to reproduce this.  Moved to a new machine without a php.ini and it was hiding error reporting.
Comment 4 Derek Schrock 2024-05-04 22:31:52 UTC
I'm starting to think the local db check isn't needed.  I believe this was only there if ttrssd starts faster than the local database.  Since update.php and update2.php would otherwise not retry giving it 10 seconds.  However, since we're now using daemon it can retry on termination.

Downside it will retry forever until the service is stopped (less of a issue).
Upside you don't need to restart the service if you need to stop the database.
Comment 5 Derek Schrock 2024-05-04 23:05:08 UTC
Created attachment 250405 [details]
Fix files/ttrss_db_check.php.in with

Upstream 16b89cc293 broke files/ttrss_db_check.php.in
autoload was importing functions.php.

testport: ok. 14amd64.
Comment 6 Derek Schrock 2024-05-04 23:05:53 UTC
Give this patch a try. I also have something in the oven to just remove the local db check.  I'd like to review that a little bit more.
Comment 7 Robert William Vesterman 2024-05-05 21:33:17 UTC
I'm sorry, but I'm a bit swamped at the moment. I will try to get to trying out the patch, but I'm afraid I can't promise that I will get to it soon (or, frankly, at all).
Comment 8 Derek Schrock 2024-05-05 21:45:38 UTC
Ok you can get around rebuilding the package and update ttrss_db_check.php directly.

Change /usr/local/www/tt-rss/ttrss_db_check.php

line with functions.php from

require_once "/usr/local/www/tt-rss/include/functions.php";

to

require_once "/usr/local/www/tt-rss/include/autoload.php";

and run

php -f /usr/local/www/tt-rss/ttrss_db_check.php

and expect to get your database type pgsql or mysql
Comment 9 Robert William Vesterman 2024-05-09 01:30:11 UTC
I just tried the direct modification of ttrss_db_check.php. It then did, in fact, print out mysql when run.

I then tried starting up ttrssd, which seems to have worked... not yet sure if it's actually updating stuff, but it is running*, so I'm guessing it probably is.

*: Speaking of ttrssd running: Would it be possible to please enable the "status" and "onestatus" commands for it? The lack of them has been a minor annoyance for me for quite some time. Although minor, I figured that I might as well mention it.

Thanks.
Comment 10 Robert William Vesterman 2024-05-09 02:06:16 UTC
Re: "I then tried starting up ttrssd, which seems to have worked... not yet sure if it's actually updating stuff, but it is running*, so I'm guessing it probably is.":

I just noticed a feed that has actually been updated.
Comment 11 Derek Schrock 2024-05-09 02:28:24 UTC
I can add status to the todo list.  Best to commit this ASAP since it's broken in the current state.
Comment 12 Robert William Vesterman 2024-05-09 02:55:24 UTC
(In reply to Derek Schrock from comment #11)

Great - thanks again!
Comment 13 commit-hook freebsd_committer freebsd_triage 2024-06-04 06:47:59 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fa9f289eb033f95f2f5029498c33b3eb765d1ef0

commit fa9f289eb033f95f2f5029498c33b3eb765d1ef0
Author:     Derek Schrock <dereks@lifeofadishwasher.com>
AuthorDate: 2024-06-04 06:45:25 +0000
Commit:     Alexander Leidinger <netchild@FreeBSD.org>
CommitDate: 2024-06-04 06:47:11 +0000

    www/tt-rss: Only include functions.php via autoload.php

    - Upstream 16b89cc293 broke files/ttrss_db_check.php.in

    PR:     278761

 www/tt-rss/Makefile                    | 1 +
 www/tt-rss/files/ttrss_db_check.php.in | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
Comment 14 Derek Schrock 2024-06-17 00:02:20 UTC
(In reply to Robert William Vesterman from comment #12)

You can checkout status update here.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279803