Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 压缩数据无效--是否违反格式?_Linux_Bash_Tar - Fatal编程技术网

Linux 压缩数据无效--是否违反格式?

Linux 压缩数据无效--是否违反格式?,linux,bash,tar,Linux,Bash,Tar,我想使用tar-zxvf命令从xxx.tar.gz文件中提取数据,但我出现了一些错误,下面是详细信息: suse11配置服务器:/home/webapp/wiki#tar-zxvf dokuwiki.20151010.tar.gz /dokuwiki/ ./dokuwiki/..htaccess.dist ./dokuwiki/.htaccess.dist /dokuwiki/bin/ /dokuwiki/conf/ ./dokuwiki/.\u复制 /dokuwiki/复制 焦油:跳到下一个头

我想使用
tar-zxvf
命令从xxx.tar.gz文件中提取数据,但我出现了一些错误,下面是详细信息:

suse11配置服务器:/home/webapp/wiki#tar-zxvf dokuwiki.20151010.tar.gz

/dokuwiki/

./dokuwiki/..htaccess.dist

./dokuwiki/.htaccess.dist

/dokuwiki/bin/

/dokuwiki/conf/

./dokuwiki/.\u复制

/dokuwiki/复制

焦油:跳到下一个头

gzip:stdin:压缩数据无效--格式冲突

tar:返回的子项状态1

tar:错误不可恢复:正在退出


但是这个命令在MacOS x系统中运行良好,我无法找出原因。

您的命令是正确的。但文件似乎已损坏。 当一些文件被正确提取时(例如
/dokuwiki/.htaccess.dist
),很容易判断,但其余的文件则不容易判断

重新创建
dokuwiki.20151010.tar.gz
文件,并确保在执行此操作时不会报告错误。 如果您从某处下载了文件,请验证校验和,或者至少验证文件大小

底线是,文件创建或下载不正确。 您的命令应该可以与
.tar.gz
文件一起使用。

Gzip在其常见问题解答中对此错误有一个解释。提供的实用程序对我的情况没有帮助,但它可能会修复您的存档。根据gzip:

如果您已以ASCII模式传输文件,并且不再具有原始文件的访问权限,则可以尝试使用程序fixgz删除传输插入的额外CR(回车)字节。这里有一个Windows9x/NT/2000/ME/XP二进制文件。但绝对不能保证这会修复您的文件。结论:切勿以ASCII模式传输二进制文件

Gzip的
fixgz
实用程序的替代位置 如果您在gzip.org的网站上再也找不到
fixgz
,这里有一个到archive.org上可用版本的链接:

fixgz实用程序的源代码 此外,如果它也消失了,下面是
fixgz
实用程序的源代码:

/* fixgz attempts to fix a binary file transferred in ascii mode by
 * removing each extra CR when it followed by LF.
 * usage: fixgz  bad.gz fixed.gz

 * Copyright 1998 Jean-loup Gailly <jloup@gzip.org>
 *   This software is provided 'as-is', without any express or implied
 * warranty.  In no event will the author be held liable for any damages
 * arising from the use of this software.

 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely.
 */

#include <stdio.h>

int main(argc, argv)
     int argc;
     char **argv;
{
    int c1, c2; /* input bytes */
    FILE *in;   /* corrupted input file */
    FILE *out;  /* fixed output file */

    if (argc <= 2) {
    fprintf(stderr, "usage: fixgz bad.gz fixed.gz\n");
    exit(1);
    }
    in  = fopen(argv[1], "rb");
    if (in == NULL) {
    fprintf(stderr, "fixgz: cannot open %s\n", argv[1]);
    exit(1);
    }
    out = fopen(argv[2], "wb");
    if (in == NULL) {
    fprintf(stderr, "fixgz: cannot create %s\n", argv[2]);
    exit(1);
    }

    c1 = fgetc(in);

    while ((c2 = fgetc(in)) != EOF) {
    if (c1 != '\r' || c2 != '\n') {
        fputc(c1, out);
    }
    c1 = c2;
    }
    if (c1 != EOF) {
    fputc(c1, out);
    }
    exit(0);
    return 0; /* avoid warning */
}

/*fixgz尝试修复以ascii模式传输的二进制文件
*移除每个额外CR,然后是LF。
*用法:fixgz bad.gz fixed.gz
*版权所有1998 Jean loup Gailly
*本软件按“原样”提供,无任何明示或暗示
*保证书。在任何情况下,提交人都不对任何损害负责
*由于使用本软件而产生的。
*允许任何人出于任何目的使用本软件,
*包括商业应用程序,并对其进行修改和重新发布
*自由地。
*/
#包括
int main(argc、argv)
int-argc;
字符**argv;
{
int c1,c2;/*输入字节*/
文件*in;/*已损坏的输入文件*/
文件*out;/*固定输出文件*/

如果(argc)再次以二进制模式将文件上载到ftp服务器,则解决了我的问题。谢谢。也可从以下位置获得: