yosupo06 / library-checker-problems

The problem data (Test case generator, judge's solution, task, ...) of Library Checker
https://judge.yosupo.jp/
Apache License 2.0
509 stars 117 forks source link

入力ハッシュ値が異なる #598

Closed hareku closed 3 years ago

hareku commented 3 years ago

便利なライブラリをありがとうございます。 何らかの不具合と思うので報告です。(そもそも使い方を間違えていたらすみません。)

概要

aplusbのハッシュ値がexampleのinのみ異なる。

具体的には、下記出力の"example_00.in"と"example_01.in"が https://github.com/yosupo06/library-checker-problems/blob/master/sample/aplusb/hash.json と同一ではありません。

18:41:57 [ERROR] hashes are different
18:41:57 [ERROR] your hash: {
  "example_00.in": "34e562561bf8bcf332707e9f66b3201e724bbc834d204c5f1718258f0eb13e46",
  "example_00.out": "d6e0da7b83d84fac4d6a6bd11ad0b0e6ea72351748b4f6a277b9762d9d0eb159",
  "example_01.in": "5719fa50746c3e7931fd3cb6169804d9351e77c5299ec26447732d18e2324b7d",
  "example_01.out": "6f2264250160ee91b20af64f30128e3787fcf641f1c504f7ac752597e7d2cc09",
  "random_00.in": "45c7fed5c64e74e639542e7d2c21f6426dbf4cb0d03838fabefa5c8a7950d2ec",
  "random_00.out": "7e45fb0642b929b33086a261bc50ff4c0d5e2790c87d5805551a71e2ea42751d",
  "random_01.in": "09d4c8f1cc423a16a50b2c321b6da5ca3710f3aef8106dcfbe7ed4470b4cb322",
  "random_01.out": "c455b489aaf5d540b04d1bdb467d1609d6c6dc8eed3c970c0e0c541592039825",
  "random_02.in": "e3f3bd8ed95f2ea57a2e14545c51d37a7441a5fba470c0956dce116324d741d5",
  "random_02.out": "67fe5c5d24a1ddf8880c0b7e391ccd11b6d09f90ff0c3bc65889fc55c81d0757",
  "random_03.in": "f5c07bdf2f2e4f85820de1608bc1b716b31b8b1d58043d112f8490d00f362703",
  "random_03.out": "e9158747d23387848cd19a0f8ae5e2abcc275a7f0f98f6e330722304792f7b37",
  "random_04.in": "eac559a5f5a4ca59acdb94ebb4c7165b4d4e4ea8fca4fa87f06ed9a2fc8da452",
  "random_04.out": "641c97ca141fefb23d58b487faf05794f756a9bd57dfa6948ac7fe5229c17fb9",
  "random_05.in": "cbd572700bc33ba20285daa7f92e0dd049d0375ac4f572395417d759d937d054",
  "random_05.out": "f229b9dbab5f987243887ed81e98284d13307746095f732a036687eb03afea9f",
  "random_06.in": "7a255bfabb6408ec8c60555ba1ce38bac6f687f6deff7f9eca7803f4d3e3f369",
  "random_06.out": "e44443c93c416c5361b02b24cbc73a8cf5b7a934cfe62e0a3587e39a1f04753a",
  "random_07.in": "bc79234cff0c9c44e931dcee5d6034e51656caedcc914876aa29b8bdf3753ee3",
  "random_07.out": "350383341d5108ccef2db13dafc416bb338e7218d80b3f67c1fe018b184aad19",
  "random_08.in": "a01e043afeaa526c73fd94d6094b92a5d315ed2677c2e18d1d3f7fc6d28d872a",
  "random_08.out": "57b607914e24e470c5ae979ffe7ff8f80b86b6e6baf7da0a65c9f71d835c39f8",
  "random_09.in": "c9989bf191b488b8b50e80eff107abbf4b74553588356c977b839b4ff90c11a6",
  "random_09.out": "1ad331898d98deea5104a076b2cfd12fae4a671a1ab6b2942643ef4dcf5c1564"
}

環境

提出コードは以下と同一です。 https://judge.yosupo.jp/submission/25189

kmyk commented 3 years ago

https://github.com/online-judge-tools/verification-helper から実行」ということなら online-judge-tools 側の問題である可能性があります (たとえば git pull 中に Ctrl-C を押して中断して状態が壊れた、など)。

@hareku ~/.cache/online-judge-tools/library-checker-problems のようなディレクトリの中で git status を実行した結果を教えてください。また、このディレクトリを消してからもういちど試して再現するか確認してみてください。

hareku commented 3 years ago

@kmyk ありがとうございます。Web上からはテスト実行できるので、急いで対応していただく必要はありません。

コードはここのリポジトリと同一で、おそらく再現も可能と思われます。 https://github.com/hareku/cpp-algorithm

rm -rf ~/.cache/online-judge-tools/library-checker-problemsしても再現しました。 ちなみにoj-verifyからAOJのテストは成功しています。(上記リポジトリのmylib/bellman_ford.test.cpp

git status

root ➜ ~/.cache/online-judge-tools/library-checker-problems (master) $ ls
LICENSE    ci_generate.py           common         deploy.py  generate.py       geo    htmlgen.py  requirements.txt  scripts  test
README.md  ci_generate_parallel.py  datastructure  docs       generate_test.py  graph  math        sample            string

root ➜ ~/.cache/online-judge-tools/library-checker-problems (master) $ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

git log

commit d53ea168d1879bfdffdfdedc163570b43644d09e (HEAD -> master, origin/master, origin/HEAD)
Merge: abb59f1 c4af428
Author: yosupo06 <yosupo06@gmail.com>
Date:   Tue Sep 22 13:30:25 2020 +0900

    Merge pull request #597 from yosupo06/patch/task

    add japanese statement for chordal_graph_recognition

oj-verify run mylib/example.test.cpp

oj-verify run mylib/example.test.cpp 
INFO:onlinejudge_verify.config:no config file
INFO:onlinejudge_verify.verify:verify: mylib/example.test.cpp
INFO:onlinejudge.dispatch:problem recognized: LibraryCheckerProblem.from_url('https://judge.yosupo.jp/problem/aplusb'): https://judge.yosupo.jp/problem/aplusb
INFO:onlinejudge_verify.verify:problem: https://judge.yosupo.jp/problem/aplusb
INFO:onlinejudge_verify.verify:$ sleep 2
INFO:onlinejudge_verify.verify:$ oj download --system -d .verify-helper/cache/8e3916c7805235eb07ec2a58660d89c6/test --silent https://judge.yosupo.jp/problem/aplusb
[INFO] online-judge-tools 11.0.0 (+ online-judge-api-client 10.4.0)
[INFO] problem recognized: LibraryCheckerProblem.from_url('https://judge.yosupo.jp/problem/aplusb'): https://judge.yosupo.jp/problem/aplusb
[INFO] load cookie from: /root/.local/share/online-judge-tools/cookie.jar
git version 2.20.1
[INFO] $ git -C /root/.cache/online-judge-tools/library-checker-problems pull
Already up to date.
[INFO] $ /usr/bin/python3 /root/.cache/online-judge-tools/library-checker-problems/generate.py /root/.cache/online-judge-tools/library-checker-problems/sample/aplusb/info.toml
11:56:33 [INFO] Start aplusb
11:56:33 [INFO] generate params.h
11:56:33 [INFO] Test cases are already generated
11:56:33 [INFO] The checker is already compiled
11:56:33 [ERROR] hashes are different
11:56:33 [ERROR] your hash: {
  "example_00.in": "34e562561bf8bcf332707e9f66b3201e724bbc834d204c5f1718258f0eb13e46",
  "example_00.out": "d6e0da7b83d84fac4d6a6bd11ad0b0e6ea72351748b4f6a277b9762d9d0eb159",
  "example_01.in": "5719fa50746c3e7931fd3cb6169804d9351e77c5299ec26447732d18e2324b7d",
  "example_01.out": "6f2264250160ee91b20af64f30128e3787fcf641f1c504f7ac752597e7d2cc09",
  "random_00.in": "45c7fed5c64e74e639542e7d2c21f6426dbf4cb0d03838fabefa5c8a7950d2ec",
  "random_00.out": "7e45fb0642b929b33086a261bc50ff4c0d5e2790c87d5805551a71e2ea42751d",
  "random_01.in": "09d4c8f1cc423a16a50b2c321b6da5ca3710f3aef8106dcfbe7ed4470b4cb322",
  "random_01.out": "c455b489aaf5d540b04d1bdb467d1609d6c6dc8eed3c970c0e0c541592039825",
  "random_02.in": "e3f3bd8ed95f2ea57a2e14545c51d37a7441a5fba470c0956dce116324d741d5",
  "random_02.out": "67fe5c5d24a1ddf8880c0b7e391ccd11b6d09f90ff0c3bc65889fc55c81d0757",
  "random_03.in": "f5c07bdf2f2e4f85820de1608bc1b716b31b8b1d58043d112f8490d00f362703",
  "random_03.out": "e9158747d23387848cd19a0f8ae5e2abcc275a7f0f98f6e330722304792f7b37",
  "random_04.in": "eac559a5f5a4ca59acdb94ebb4c7165b4d4e4ea8fca4fa87f06ed9a2fc8da452",
  "random_04.out": "641c97ca141fefb23d58b487faf05794f756a9bd57dfa6948ac7fe5229c17fb9",
  "random_05.in": "cbd572700bc33ba20285daa7f92e0dd049d0375ac4f572395417d759d937d054",
  "random_05.out": "f229b9dbab5f987243887ed81e98284d13307746095f732a036687eb03afea9f",
  "random_06.in": "7a255bfabb6408ec8c60555ba1ce38bac6f687f6deff7f9eca7803f4d3e3f369",
  "random_06.out": "e44443c93c416c5361b02b24cbc73a8cf5b7a934cfe62e0a3587e39a1f04753a",
  "random_07.in": "bc79234cff0c9c44e931dcee5d6034e51656caedcc914876aa29b8bdf3753ee3",
  "random_07.out": "350383341d5108ccef2db13dafc416bb338e7218d80b3f67c1fe018b184aad19",
  "random_08.in": "a01e043afeaa526c73fd94d6094b92a5d315ed2677c2e18d1d3f7fc6d28d872a",
  "random_08.out": "57b607914e24e470c5ae979ffe7ff8f80b86b6e6baf7da0a65c9f71d835c39f8",
  "random_09.in": "c9989bf191b488b8b50e80eff107abbf4b74553588356c977b839b4ff90c11a6",
  "random_09.out": "1ad331898d98deea5104a076b2cfd12fae4a671a1ab6b2942643ef4dcf5c1564"
}
Traceback (most recent call last):
  File "/root/.cache/online-judge-tools/library-checker-problems/generate.py", line 632, in <module>
    main(sys.argv[1:])
  File "/root/.cache/online-judge-tools/library-checker-problems/generate.py", line 629, in main
    problem.generate(mode, Path(opts.htmldir) if opts.htmldir else None)
  File "/root/.cache/online-judge-tools/library-checker-problems/generate.py", line 478, in generate
    self.assert_hashes()
  File "/root/.cache/online-judge-tools/library-checker-problems/generate.py", line 407, in assert_hashes
    raise RuntimeError("hashes are different")
RuntimeError: hashes are different
[ERROR] the generate.py failed: check https://github.com/yosupo06/library-checker-problems/issues
[ERROR] Command '['/usr/bin/python3', '/root/.cache/online-judge-tools/library-checker-problems/generate.py', '/root/.cache/online-judge-tools/library-checker-problems/sample/aplusb/info.toml']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/onlinejudge_command/main.py", line 251, in main
    run_program(parsed, parser=parser)
  File "/usr/local/lib/python3.7/dist-packages/onlinejudge_command/main.py", line 217, in run_program
    download(args)
  File "/usr/local/lib/python3.7/dist-packages/onlinejudge_command/subcommand/download.py", line 48, in download
    samples = problem.download_system_cases(session=sess)
  File "/usr/local/lib/python3.7/dist-packages/onlinejudge/service/library_checker.py", line 86, in download_system_cases
    self._generate_test_cases_in_cloned_repository()
  File "/usr/local/lib/python3.7/dist-packages/onlinejudge/service/library_checker.py", line 108, in _generate_test_cases_in_cloned_repository
    subprocess.check_call(command, stdout=sys.stderr, stderr=sys.stderr)
  File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/root/.cache/online-judge-tools/library-checker-problems/generate.py', '/root/.cache/online-judge-tools/library-checker-problems/sample/aplusb/info.toml']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/onlinejudge_verify/verify.py", line 85, in verify_file
    exec_command(command)
  File "/usr/local/lib/python3.7/dist-packages/onlinejudge_verify/verify.py", line 42, in exec_command
    subprocess.check_call(command)
  File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['oj', 'download', '--system', '-d', '.verify-helper/cache/8e3916c7805235eb07ec2a58660d89c6/test', '--silent', 'https://judge.yosupo.jp/problem/aplusb']' returned non-zero exit status 1.
::error file=mylib/example.test.cpp::failed to verify
ERROR:onlinejudge_verify.verify:1 tests failed
ERROR:onlinejudge_verify.verify:failed: mylib/example.test.cpp
yosupo06 commented 3 years ago

報告ありがとうございます。

以下のようなオプションをgitのインストール時にonにしたのではないかと考えています(https://qiita.com/yokoh9/items/1ec8099696ade0c1f36e より引用)

git config --global --listを実行したらautoCRLF=trueという行が出てこないでしょうか?

○ Checkout Windows-style, commit Unix-style line endings
  チェックアウト時に改行コードを[LF]から[CR+LF]に変換し、コミットする時に[CR+LF]を[LF]に変換する。

これをonにしていると、改行コードが変わり、ハッシュが変わってしまうはずです

hareku commented 3 years ago

@yosupo06 ありがとうございます!改行コードが原因のようでした。

git config --global core.autocrlf falseしてキャッシュ削除後に再度試してみたところ、無事テストが成功しました。