Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The case-sensitivity of file systems depends OS and make confusing errors #259

Open
kmyk opened this issue May 12, 2020 · 10 comments
Open

Comments

@kmyk
Copy link
Member

kmyk commented May 12, 2020

Paths are case-insensitive in Windows and macOS but case-sensitive in Linux and GitHub Actions (which uses Ubuntu).

This problem appears as No such file or directory errors in the phase to analyze dependencies of files, and also users cannot reproduce it on their local environments. As the result, it's very difficult for users to recognize what is wrong.

INFO:onlinejudge_verify.verify:verify: /home/runner/work/CompetitiveProgramming/CompetitiveProgramming/kyopro/test/unionfind_yosupo-judge.test.cpp
/home/runner/work/CompetitiveProgramming/CompetitiveProgramming/kyopro/test/unionfind_yosupo-judge.test.cpp:5:10: fatal error: ../Library/DataStructure/unionfind.cpp: No such file or directory
 #include "../Library/DataStructure/unionfind.cpp"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

被害者1

@kmyk
ありがとうございます。

https://github.com/knshnb/competitive_library/runs/618276854?check_suite_focus=true
ここに書くべきでは無いかもしれませんが、そもそもこれがコンパイル通っていない原因もわかっていません(テストで落ちるのでとりあえずファイルをignoreしたりファイル名変更して対応しようとした結果が先程のissueです)。

手元のMac環境ではoj-verify runは通っていて、依存関係は特に問題ないように思えるのですが…
(問題ファイル: https://github.com/knshnb/competitive_library/blob/e4a8328a5afcafb5a4604fbb9fe781df8b4a9e0c/test/yukicoder/1036_segment_tree.test.cpp)

#228 (comment)

被害者2

https://t.co/ZVJ0vLVLgl
GitHub 難しい

— null🍆🌖 (@null_0124) May 12, 2020
@kmyk kmyk added bug Something isn't working priority:high difficulty:middle labels May 12, 2020
@kmyk
Copy link
Member Author

kmyk commented May 12, 2020

GitHub Actions 上で検出して対処しようとすると「パス名の曖昧検索」みたいなのが必要になってしんどそう。
ユーザのローカル環境上で再現しないのが問題なので、ユーザ環境上で検出するので十分そう。ユーザ環境なら勝手に自動で曖昧検索が有効と同義な状況なので、普通に実行して得られた依存関係のグラフを見れば検出ができる。

@kmyk
Copy link
Member Author

kmyk commented May 19, 2020

これはおそらくみな高確率でひっかかる罠なので警告を出しておきたい。しかし私は Windows も macOS も持ってないのでデバッグが不可能です。よって協力者を募集したい。たすけて


以下を順番に実行すると deps.txt というファイルができるはずなので、その中身を教えてください。Windows の場合と macOS の場合の両方が知りたいです。なお Windows の人は必ず cmd.exe や PowerShell 上で実行してください (WSL はだめです)。

  1. 中身が空の hoge/FUGA/piyo.h という名前のファイルを作る
  2. 中身に #include "hoge/fuga/PIYO.h" と書かれた test.cpp という名前のファイルを作る
  3. $ g++ -std=c++14 -MD -MF deps.txt -MM test.cpp を実行する

cc @knshnb @null0124 @wakuwinmail

@null0124
Copy link

@kmyk
これはフォルダに入れずに / の入った名前で試すということであっていますか
そうであるとすると、Windows 環境でファイル名に /, , などを含めるファイルは作成できないらしいので実行できなさそうです

@kmyk
Copy link
Member Author

kmyk commented May 20, 2020

@null0124 いいえ、hoge というフォルダの中の FUGA というフォルダの中に piyo.h というファイルを作ってください。

\ で書くとmacOS の場合に紛らわしいなと思って / で書いたのですが、今度は Windows の場合で紛らわしかったですね 🙇

@null0124
Copy link

null0124 commented May 20, 2020

@kmyk
回答ありがとうございます。
deps.txt の中身は
test.o: test.cpp hoge/fuga/PIYO.h
になってました

@knshnb
Copy link

knshnb commented May 20, 2020

MacOS (Catalina 10.15.2)でも
test.o: test.cpp hoge/fuga/PIYO.h
になりました。

@kmyk
Copy link
Member Author

kmyk commented May 20, 2020

@null0124 @knshnb ありがとうございます。

ということは g++ は #include "..." に書かれた文字列をそのまま出力しているぽいですね。g++ の出力を .resolve() して変化がないか判定するのが楽そうというのが分かりました。

@kmyk
Copy link
Member Author

kmyk commented May 20, 2020

この手の微妙な仕様に依存するのは実はあまりよくないのだけど (壊れやすいので)、ここが嘘でも致命的ではないので、いきなり完璧は書かずにまずはお手軽実装で誤魔化していきます

@kmyk
Copy link
Member Author

kmyk commented May 21, 2020

A hint message is added at #265

@kmyk kmyk added enhancement New feature or request priority:low and removed bug Something isn't working priority:high labels May 21, 2020
@kmyk
Copy link
Member Author

kmyk commented May 21, 2020

「分かりにくい形で落ちるバグ」から「エラーの表示がすこし不親切なだけ」に緩和されました。とりあえずこれでいいかなと思うけど、まだ改善の余地はあるので issue 自体は残しておく

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants