-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: PDFtk binary is invalid #3000
Comments
This is the point at code that throw this error: libresign/lib/Service/Install/ConfigureCheckService.php Lines 136 to 162 in e2cc403
You can try to mount the exec command with the path of downloaded files to check what's returned by --version. Sounds that the return is empty or is an error in your case. |
I'm having this same issue, but am seeing a correct output from that command:
|
The way to identify the version of pdftk that I implemented is this regex that is applied at first row: /pdftk port to java (?<version>.*) a Handy Tool/ The first row is: And the expected value for now is The message I think that will be necessary put more debugs/log points to identify what happening. |
I put points of log to be possible follow the code execution. If possible, would be good if you apply this changes adding the log rows at your To check the log output, you can use a tail with grep: tail -f data/nextcloud.log |grep libresign I will need the output of tail to be possible check what's happening. diff --git a/lib/Service/Install/ConfigureCheckService.php b/lib/Service/Install/ConfigureCheckService.php
index ccc79b20c..c73ca4dc5 100644
--- a/lib/Service/Install/ConfigureCheckService.php
+++ b/lib/Service/Install/ConfigureCheckService.php
@@ -131,13 +131,21 @@ class ConfigureCheckService {
*/
public function checkPdftk(): array {
$pdftkPath = $this->appConfig->getAppValue('pdftk_path');
+ \OC::$server->getLogger()->debug('Path of PDFTK', ['app' => 'libresign', 'pdftk_path' => $pdftkPath]);
if ($pdftkPath) {
+ \OC::$server->getLogger()->debug('PDFTK exists', ['app' => 'libresign']);
if (file_exists($pdftkPath)) {
$javaPath = $this->appConfig->getAppValue('java_path');
\exec($javaPath . ' -jar ' . $pdftkPath . " --version 2>&1", $version);
+ \OC::$server->getLogger()->debug('executed command', ['app' => 'libresign', 'command' => $javaPath . ' -jar ' . $pdftkPath . " --version 2>&1"]);
+ \OC::$server->getLogger()->debug('output of version', ['app' => 'libresign', 'version' => $version]);
+ \OC::$server->getLogger()->debug('Exists first row', ['app' => 'libresign', 'exists' => isset($version[0]) ? 'yes': 'no']);
if (isset($version[0])) {
+ \OC::$server->getLogger()->debug('First row', ['app' => 'libresign', 'version' => $version[0]]);
preg_match('/pdftk port to java (?<version>.*) a Handy Tool/', $version[0], $matches);
+ \OC::$server->getLogger()->debug('Return of regex', ['app' => 'libresign', 'version' => $matches]);
if (isset($matches['version'])) {
+ \OC::$server->getLogger()->debug('Version identified', ['app' => 'libresign', 'version' => $matches['version']]);
if ($matches['version'] === InstallService::PDFTK_VERSION) {
$return[] = (new ConfigureCheckHelper())
->setSuccessMessage('PDFtk version: ' . InstallService::PDFTK_VERSION) |
@vitormattos I'm getting the same issue, here's the debug logs with those statements added:
|
Seems like javaPath is empty, and indeed if I add this: $javaPath = $this->appConfig->getAppValue('java_path');
+ \OC::$server->getLogger()->debug('java path', ['app' => 'libresign', 'javaPath' => $javaPath]); I get
|
I can fix it by installing java instead of using OS java, ( I see in @stepcellwolf's screenshot that he also didn't run that. Perhaps the java check should set |
Will be complex to check if have Java installed at OS to use this and also could have side effects using a java version that isn't the same that is used by LibreSign. |
Describe the bug and to reproduce
When I try to run the following command
sudo -u nextcloud php8.2 --define apc.enable_cli=1 occ libresign:install --pdftk
I do not get any error, where on the interface in NC version 28.0.5 and PHP Version: 8.2.18 on yunohost version 11.2.11.3 (stable).Expected behavior
It should install.
Screenshots
Environment information (please complete the following information):
Additional context
I also installed
pdftk
withapt install pdftk
output:Any idea what might be the problem? Thanks in advance.
The text was updated successfully, but these errors were encountered: