作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试使用 ocaml_tar 库创建 TAR 文件时,出现 End_of_file 异常。
我的代码...
#require "tar";;
#require "tar.unix";;
let f = Unix.openfile "test.tar" [ Unix.O_RDWR; Unix.O_CREAT ] 0o600;;
Tar_unix.Archive.create ["write_ex.ml"] f;;
Unix.close f;;
...产生以下堆栈跟踪:
$ utop write_ex.ml
Exception: End_of_file.
Raised at file "lib/tar.ml", line 549, characters 36-47
Called from file "lib/tar.ml", line 460, characters 4-11
Called from file "stream.ml", line 149, characters 33-38
Called from file "lib/tar.ml", line 578, characters 6-28
Called from file "toplevel/toploop.ml", line 180, characters 17-56
有人知道这是怎么回事吗?
最佳答案
你的代码没有任何问题。它实际上是 Tar_unix
模块中的一个错误。 output
函数不够健壮,如果写入被截断,则会失败并出现 End_of_file
异常。我已经解决了这个问题,并且您的代码工作正常。看我的PR了解更多信息。
PR 已合并,较新的 (0.5.1) 版本已发布到 opam。升级到最新版本:
opam update
opam upgrade
通过查询 opam 确保安装了最新 (>= 0.5.1) 版本
opam show tar-format
如果它仍然是旧的,则强制 opam 安装最新的:
opam install 'tar-format>=0.5.1'
关于ocaml - 使用 *ocaml_tar* 创建 TAR 文件时出现 End_of_file 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39201064/
在多年未接触该语言之后,我正尝试在 Ada 中构建一个 REPL。 如果我检查代码中的 END_OF_FILE,Text_IO 缓冲输入和输出的方式会发生变化。我记得是这种情况,但找不到关于为什么或如
当我尝试使用 ocaml_tar 库创建 TAR 文件时,出现 End_of_file 异常。 我的代码... #require "tar";; #require "tar.unix";; let f
我是一名优秀的程序员,十分优秀!