【问题标题】:Windows command line tar "cannot connect to d: resolve failed" with Chef Knife使用 Chef Knife 的 Windows 命令行 tar“无法连接到 d:解析失败”
【发布时间】:2012-10-01 04:04:13
【问题描述】:

使用安装了 cygwin、chef 和 ruby​​ 的 Windows 命令行。尝试时

knife cookbook site install mysql

返回以下错误

Begin output of tar zxvf D:/path/to/chef-repo/cookbooks/mysql.tar.gz  
STDOUT:  
STDERR: tar<child>: Cannot connect to D: resolve failed  
gzip: stdin: undexpected end of file  
tar: Child returned status 128  
tar:  Error is not recoverable: exiting now</code>

我该如何解决这个问题?我可以使用

手动解压缩
tar zxvf mysql.tar.gz  

但这并不理想。我相信这与colon in filename 有关,但我怎样才能改变刀或厨师的偏好呢?

【问题讨论】:

    标签: command-line gzip tar chef-infra


    【解决方案1】:

    原因是tar 将文件名中的冒号 (:) 解释为它是另一台机器上的文件。您可以使用标志 --force-local 禁用此行为。

    这是来自here 的回答。

    【讨论】:

      【解决方案2】:

      我不知道一个完整的答案,但最近在 Linux 机器上看到了这个:

      $ date > today
      $ tar -czf - today > to:day.tgz
      $ tar -tzf to:day.tgz
      ssh: connect to host to port 22: Connection refused
      tar (child): to\:day.tgz: Cannot open: Input/output error
      tar (child): Error is not recoverable: exiting now
      
      gzip: stdin: unexpected end of file
      tar: Child returned status 2
      tar: Error is not recoverable: exiting now
      $ tar -tzf - < to:day.tgz 
      today
      $ 
      

      似乎tar 想要进行某种远程文件处理,因为文件名中有冒号,您可以通过使用某种形式的重定向或管道来伪造它 - 用于读取和写入 tarball。我仍然想找到一个选项或告诉tar 不要这样做。

      【讨论】:

        【解决方案3】:

        如果从 cmd 运行,tar 命令会起作用吗?另外,如果输出到本地驱动器怎么办。别的试试这个,

        tar zxvf "D:/path/to/chef-repo/cookbooks/mysql.tar.gz"
        

        【讨论】:

          猜你喜欢
          • 2012-09-28
          • 2015-11-22
          • 2023-03-18
          • 2023-03-18
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多