Update 20150709 Linux FAQs with Answers--How to fix 'tar--Exiting with failure status due to previous errors'.md

This commit is contained in:
XLCYun 2015-07-10 14:59:56 +08:00
parent 47b7d5bb78
commit b18fa8f2a9

View File

@ -3,31 +3,29 @@ Linux常见问题解答--如何修复"tar由于前一个错误导致于失败
> **问题**: 当我想试着用tar命令来创建一个压缩文件时总在执行过程中失败并且抛出一个错误说明"tar由于前一个错误导致于失败状态中退出"("Exiting with failure status due to previous errors"). 什么导致这个错误的发生,要如何解决?
![](https://farm9.staticflickr.com/8863/17631029953_1140fe2dd3_b.jpg)
If you encounter the following error while running tar command, the most likely reason is that you do not have read permission on one of the files you are trying to archive with tar.
如果当你执行tar命令时遇到了下面的错误那么最有可能的原因是对于你想用tar命令压缩的某个文件中你并不具备其读权限。
tar: Exiting with failure status due to previous errors
Then how can we pin down the file(s) causing the errors, or identify any other cause?
那么我们要如何确定引起错误的这个(些)文件呢?或者如何确定其它的错误根源?
The tar command should actually print out what those "previous errors" are, but you can easily miss printed error messages if you run tar in verbose mode (e.g., -cvf). To catch error messages more easily, you can filter out tar's stdout messages as follows.
事实上tar命令应该会打印出所谓的“上一个错误”("previous errors")到底是什么错误但是如果你让tar运行在详细模式即verbose mode例如, -cvf)那么你会很容易错失这些信息。要找到这些信息你可以像下面那样把tar的标准输出stdout)信息过滤掉。
$ tar cvzfz backup.tgz my_program/ > /dev/null
You will then see only error messages sent by tar to stderr.
然后你会看到tar输出的标准错误(stderr)信息。
tar: my_program/src/lib/.conf.db.~lock~: Cannot open: Permission denied
tar: Exiting with failure status due to previous errors
As you can see in the above example, the cause for the errors is indeed "denied read permission."
To solve the problem, simply adjust the permission of the problematic file (or remove it), and re-run tar.
你可以从上面的例子中看到引起错误的原因的确是“读权限不允许”denied read permission.)
要解决这个问题只要简单地更改出问题的文件的权限即可或将其移除然后重新执行tar命令。
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/tar-exiting-with-failure-status-due-to-previous-errors.html
作者:[Dan Nanni][a]
译者:[译者ID](https://github.com/译者ID)
译者:[XLCYun(袖里藏云)](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出