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

Tar error: File removed before we read it /bin/tar: #114

Closed
planetahuevo opened this Issue Aug 29, 2017 · 21 comments

Comments

Projects
None yet
2 participants
@planetahuevo

planetahuevo commented Aug 29, 2017

I have got this error using tar:
File removed before we read it /bin/tar:
It was because I delete some files during the backup process but I was wondering why this happen if I already have the

ignoreFailedRead setup to true:

I found this link, but I am not sure is the same thing.
https://stackoverflow.com/questions/20318852/tar-file-changed-as-we-read-it
Any ideas?

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Sep 18, 2017

Owner

When I understand the documentation correctly it is possible to suppress these warning via the --warning option.

But the exit code should still be 0.
So the tar should be created anyway.

Or is phpbu marking the backup as failed?

To not display this errors phpbu must use the --warning option.

Owner

sebastianfeldmann commented Sep 18, 2017

When I understand the documentation correctly it is possible to suppress these warning via the --warning option.

But the exit code should still be 0.
So the tar should be created anyway.

Or is phpbu marking the backup as failed?

To not display this errors phpbu must use the --warning option.

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Sep 18, 2017

The problem is that I am getting an error.
phpbu is marking it as failed.
Not sure why. Considering to sync into another folder and then use the tar... but that is an overkill...

planetahuevo commented Sep 18, 2017

The problem is that I am getting an error.
phpbu is marking it as failed.
Not sure why. Considering to sync into another folder and then use the tar... but that is an overkill...

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Sep 18, 2017

Owner

Could you try to execute tar directly with this option

--warning='file-removed'

And check if that works, if so I would add this option to phpbu

Owner

sebastianfeldmann commented Sep 18, 2017

Could you try to execute tar directly with this option

--warning='file-removed'

And check if that works, if so I would add this option to phpbu

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Sep 18, 2017

I will try, the problem is that is not failing all the time. I will try to remove a file manually to force the problem.
Not sure when I can do the tests...

planetahuevo commented Sep 18, 2017

I will try, the problem is that is not failing all the time. I will try to remove a file manually to force the problem.
Not sure when I can do the tests...

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Sep 19, 2017

Hi,
I have not tested it yet but I got the error tonight, and it is a different one.

Exception 'RuntimeException' with message 'Command failed: exit-code: 1 message: /bin/tar: XXXXXXXX/XXXXXXX/xxxx.log: file changed as we read it ' in phar:///XXXXX/phpbu/lib/phpdotenv/Command/Runner/Simple.php:57

planetahuevo commented Sep 19, 2017

Hi,
I have not tested it yet but I got the error tonight, and it is a different one.

Exception 'RuntimeException' with message 'Command failed: exit-code: 1 message: /bin/tar: XXXXXXXX/XXXXXXX/xxxx.log: file changed as we read it ' in phar:///XXXXX/phpbu/lib/phpdotenv/Command/Runner/Simple.php:57
@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Sep 19, 2017

Owner

This is strange normally those warnings should not affect the exit code of tar
as stated here

Sometimes, while performing the requested task, GNU tar notices some conditions that are not exactly errors, but which the user should be aware of. When this happens, tar issues a warning message describing the condition. Warning messages are output to the standard error and they do not affect the exit code of tar command.

Some of those warnings are:

  • file changed as we read it
  • File removed before we read it

And more

I will try to reproduce this locally

Owner

sebastianfeldmann commented Sep 19, 2017

This is strange normally those warnings should not affect the exit code of tar
as stated here

Sometimes, while performing the requested task, GNU tar notices some conditions that are not exactly errors, but which the user should be aware of. When this happens, tar issues a warning message describing the condition. Warning messages are output to the standard error and they do not affect the exit code of tar command.

Some of those warnings are:

  • file changed as we read it
  • File removed before we read it

And more

I will try to reproduce this locally

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Sep 19, 2017

From the link I posted:
"Still the exit code return by the tar is "1" in warning message case: http://www.gnu.org/software/tar/manual/html_section/Synopsis.html"

It seems there is an answer approved there too.

planetahuevo commented Sep 19, 2017

From the link I posted:
"Still the exit code return by the tar is "1" in warning message case: http://www.gnu.org/software/tar/manual/html_section/Synopsis.html"

It seems there is an answer approved there too.

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Sep 19, 2017

Owner

Maybe phpbu should accept exit code 1 as well if the ignoreFailedRead option is set

Owner

sebastianfeldmann commented Sep 19, 2017

Maybe phpbu should accept exit code 1 as well if the ignoreFailedRead option is set

sebastianfeldmann added a commit that referenced this issue Sep 29, 2017

Allow tar exit code 1 - issue #114
If the 'ignoreFailedRead' option is set the 'Tar' backup
will accept a tar exit code 1 as well as it only indicates some
read warnings.
@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Sep 29, 2017

Owner

I've just released version 5.0.5 with a fix that allows the tar command to exit with return code 1 as well if the ignoreFailedRead option is set

I hope that fixes your problem ;)

Owner

sebastianfeldmann commented Sep 29, 2017

I've just released version 5.0.5 with a fix that allows the tar command to exit with return code 1 as well if the ignoreFailedRead option is set

I hope that fixes your problem ;)

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Sep 29, 2017

Owner

Please let me know if it works
Cheers, Sebastian

Owner

sebastianfeldmann commented Sep 29, 2017

Please let me know if it works
Cheers, Sebastian

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Sep 29, 2017

I will try it and let you know.

Thank you!!

planetahuevo commented Sep 29, 2017

I will try it and let you know.

Thank you!!

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Oct 3, 2017

Hi, testing it right now and got this error, so it seems it is still failing with exit=1:
"
phpbu --configuration=phpbu.xml
phpbu 5.0.5 by Sebastian Feldmann and contributors.

Time: 4.03 minutes, Memory: 10.00MB

Exception 'RuntimeException' with message 'Command failed:
exit-code: 1
message: /bin/tar: public: file changed as we read it

'
in phar:///usr/local/bin/phpbu/lib/phpdotenv/Command/Runner/Simple.php:57

FAILURE!
Backups: 2, failed Checks: 0, failed Crypts: 0, failed Syncs: 0, failed Clea: 0.
"

planetahuevo commented Oct 3, 2017

Hi, testing it right now and got this error, so it seems it is still failing with exit=1:
"
phpbu --configuration=phpbu.xml
phpbu 5.0.5 by Sebastian Feldmann and contributors.

Time: 4.03 minutes, Memory: 10.00MB

Exception 'RuntimeException' with message 'Command failed:
exit-code: 1
message: /bin/tar: public: file changed as we read it

'
in phar:///usr/local/bin/phpbu/lib/phpdotenv/Command/Runner/Simple.php:57

FAILURE!
Backups: 2, failed Checks: 0, failed Crypts: 0, failed Syncs: 0, failed Clea: 0.
"

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Oct 3, 2017

My config file has this option:

planetahuevo commented Oct 3, 2017

My config file has this option:

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Oct 3, 2017

<option name="ignoreFailedRead" value="true"/>

planetahuevo commented Oct 3, 2017

<option name="ignoreFailedRead" value="true"/>

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Oct 3, 2017

Owner

Ok I see the proablem now.
The exception is thrown way before phpbu tries to handle the exit codes.
I will release a fix ASAP

Owner

sebastianfeldmann commented Oct 3, 2017

Ok I see the proablem now.
The exception is thrown way before phpbu tries to handle the exit codes.
I will release a fix ASAP

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Oct 3, 2017

No hurries! It does work most of the time. :)

planetahuevo commented Oct 3, 2017

No hurries! It does work most of the time. :)

sebastianfeldmann added a commit that referenced this issue Oct 6, 2017

Upgrade to 'cli' lib version 2.0
With version 2 of the cli lib we can define what kind of exit
codes we are willing to accept without any exceptions.
This was necessary to handle the exit codes of 'tar' in case
of failed read warnings.

Now, in case of 'ignoreFailedRead' option to be true, we accept
exit code 1 from tar ass well.

Issue #114

sebastianfeldmann added a commit that referenced this issue Oct 6, 2017

Upgrade to 'cli' lib version 2.0
With version 2 of the cli lib we can define what kind of exit
codes we are willing to accept without any exceptions.
This was necessary to handle the exit codes of 'tar' in case
of failed read warnings.

Now, in case of 'ignoreFailedRead' option to be true, we accept
exit code 1 from tar as well.

Issue #114
@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Oct 6, 2017

Owner

I upgraded the Commands so you can define some acceptableExitCodes.
By default this is only 0
So if the ignoreFailedRead option is set, the tar command has two acceptable exit codes 0 and 1 so hopefully no exception will be thrown anymore ;)

So now this should work, if not I'm going to shoot myself 😜

Please update to the latest version 5.0.6 and have a try #fingersCrossed 🙈

Owner

sebastianfeldmann commented Oct 6, 2017

I upgraded the Commands so you can define some acceptableExitCodes.
By default this is only 0
So if the ignoreFailedRead option is set, the tar command has two acceptable exit codes 0 and 1 so hopefully no exception will be thrown anymore ;)

So now this should work, if not I'm going to shoot myself 😜

Please update to the latest version 5.0.6 and have a try #fingersCrossed 🙈

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Oct 6, 2017

I will be traveling a lot next month, so I won´t be able to test it properly until I am back.
I am sure you got it, and if not, it is not a big deal.
Thank you for the great work.

planetahuevo commented Oct 6, 2017

I will be traveling a lot next month, so I won´t be able to test it properly until I am back.
I am sure you got it, and if not, it is not a big deal.
Thank you for the great work.

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Oct 6, 2017

Owner

No worries
Don’t hesitate to let me know if it doesn’t work.
Thanks for your patience and your support/feedback to make phpbu better.

Owner

sebastianfeldmann commented Oct 6, 2017

No worries
Don’t hesitate to let me know if it doesn’t work.
Thanks for your patience and your support/feedback to make phpbu better.

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Apr 1, 2018

Owner

I'll close this issue, if you still have problems feel free to reopen it

Owner

sebastianfeldmann commented Apr 1, 2018

I'll close this issue, if you still have problems feel free to reopen it

@planetahuevo

This comment has been minimized.

Show comment
Hide comment
@planetahuevo

planetahuevo Apr 4, 2018

Yeah, sorry I didn´t wrote you back. I think it is fixed.

Thanks!

planetahuevo commented Apr 4, 2018

Yeah, sorry I didn´t wrote you back. I think it is fixed.

Thanks!

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