Skip to content
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

pihole -a -t fails since update to 5.1 #1497

Closed
3 tasks done
AleksCee opened this issue Jul 16, 2020 · 10 comments · Fixed by #1517
Closed
3 tasks done

pihole -a -t fails since update to 5.1 #1497

AleksCee opened this issue Jul 16, 2020 · 10 comments · Fixed by #1517

Comments

@AleksCee
Copy link

In raising this issue, I confirm the following: {please fill the checkboxes, e.g: [X]}

How familiar are you with the the source code relevant to this issue?:

{Replace this with a number from 1 to 10. 1 being not familiar, and 10 being very familiar}


Expected behavior:

A new backup file without errors.

Actual behavior:

Error after start: pihole -a -t

PHP Warning: filesize(): stat failed for /tmp/pi-hole-pihole.fritz.box-teleporter_2020-07-16_18-36-06.tar.gz in /var/www/html/admin/scripts/pi-hole/php/teleporter.php on line 581
PHP Warning: readfile(/tmp/pi-hole-pihole.fritz.box-teleporter_2020-07-16_18-36-06.tar.gz): failed to open stream: No such file or directory in /var/www/html/admin/scripts/pi-hole/php/teleporter.php on line 585
PHP Warning: unlink(/tmp/pi-hole-pihole.fritz.box-teleporter_2020-07-16_18-36-06.tar.gz): No such file or directory in /var/www/html/admin/scripts/pi-hole/php/teleporter.php on line 587

Steps to reproduce:

run: pihole -a -t

In Line $archive->compress(Phar::GZ); // Creates a gziped copy the command seam to create a file with the name: /tmp/pi-hole-pihole.tar.gz
If I comment out the unlink command: unlink($archive_file_name); // Unlink original tar file as it is not needed anymore

I get:
/tmp/pi-hole-pihole.fritz.box-teleporter_2020-07-16_19-17-35.tar
/tmp/pi-hole-pihole.tar.gz

It's look like that the $archive->compress(Phar::GZ) use a wrong name for the File while gzipping? But I don't know why.

PHP Version: PHP 7.0.33-0+deb9u8 (cli) (built: Jul 5 2020 06:34:50) ( NTS ) on
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"

@dschaper dschaper transferred this issue from pi-hole/pi-hole Jul 16, 2020
@AleksCee
Copy link
Author

Oh, i have found a hint to the Bug on php.net: https://www.php.net/manual/de/phardata.compress.php#118891
In the Update zu 5.1 you have add the hostname, the hostname has dots, and the issue on php.net says: This method destroys everything after the first dot in your filename and replaces it with the zip extension (.tar.gz, etc)

Perhaps, this is the same here? What about to replace the dots in the hostname withe underscores?

@AleksCee
Copy link
Author

Ok, I have tested my idea

This fixes it: $hostname = gethostname() ? str_replace(".","_",gethostname())."-" : "";

But I‘m wondering about the change because of the bash script the filename which generated in the php script was not used, so the hostename addon reaches never the backup file name which was stored by the shell script:

Teleporter() {
    local datetimestamp
    datetimestamp=$(date "+%Y-%m-%d_%H-%M-%S")
    php /var/www/html/admin/scripts/pi-hole/php/teleporter.php > "pi-hole-teleporter_${datetimestamp}.tar.gz"
}

@DL6ER
Copy link
Member

DL6ER commented Jul 17, 2020

When looking at #1503, I thought @PromoFaux's most recent changes to Teleporter (#1417) were not causing this, however, they actually do.

I‘m wondering about the change because of the bash script the filename which generated in the php script was not used, so the hostename addon reaches never the backup file name which was stored by the shell script

It likely was forgotten that the CLI method exists. It was buried in my memory as well. That's the danger of adding more and more features only a few use. We forget about them. Usually this is not harmful, but it can result in such things.

@pralor-bot
Copy link

This issue has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/teleporter-backup-error-500/35883/18

@AleksCee
Copy link
Author

No, not relevant. And I think the solution is (no dots in the filename excepted the extensions dot): #1497 (comment)

@Taomyn
Copy link

Taomyn commented Jul 27, 2020

I'm a little confused by all the tags being changed, has this issue been fixed/patched and if so how can I apply it to my current install? Thanks.

@PromoFaux
Copy link
Member

The current active tags are:

  • Bug
  • Fixed in Next Release

This will be fixed in the next version of the web interface that gets released.

@Taomyn
Copy link

Taomyn commented Jul 29, 2020

Thanks, but got impatient and patched the file myself - confirmed now all working again, thanks

@Taomyn
Copy link

Taomyn commented Aug 6, 2020

I just updated to the latest test release of 5.2 (release/v5.2, vDev-905994e, because the service kept dying) and the manual patch I applied for this issue disappeared. Is this fix really going to get included in the next release because it hasn't made it to the test one yet, at least for me.

@yubiuser
Copy link
Member

This has been fixed a long time ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants