Open kmyk opened 4 years ago
GitHub Actions 上で検出して対処しようとすると「パス名の曖昧検索」みたいなのが必要になってしんどそう。 ユーザのローカル環境上で再現しないのが問題なので、ユーザ環境上で検出するので十分そう。ユーザ環境なら勝手に自動で曖昧検索が有効と同義な状況なので、普通に実行して得られた依存関係のグラフを見れば検出ができる。
これはおそらくみな高確率でひっかかる罠なので警告を出しておきたい。しかし私は Windows も macOS も持ってないのでデバッグが不可能です。よって協力者を募集したい。たすけて
以下を順番に実行すると deps.txt
というファイルができるはずなので、その中身を教えてください。Windows の場合と macOS の場合の両方が知りたいです。なお Windows の人は必ず cmd.exe
や PowerShell 上で実行してください (WSL はだめです)。
hoge/FUGA/piyo.h
という名前のファイルを作る#include "hoge/fuga/PIYO.h"
と書かれた test.cpp
という名前のファイルを作る$ g++ -std=c++14 -MD -MF deps.txt -MM test.cpp
を実行するcc @knshnb @null0124 @wakuwinmail
@kmyk これはフォルダに入れずに / の入った名前で試すということであっていますか そうであるとすると、Windows 環境でファイル名に /, \, などを含めるファイルは作成できないらしいので実行できなさそうです
@null0124 いいえ、hoge
というフォルダの中の FUGA
というフォルダの中に piyo.h
というファイルを作ってください。
\
で書くとmacOS の場合に紛らわしいなと思って /
で書いたのですが、今度は Windows の場合で紛らわしかったですね :bow:
@kmyk
回答ありがとうございます。
deps.txt
の中身は
test.o: test.cpp hoge/fuga/PIYO.h
になってました
MacOS (Catalina 10.15.2)でも
test.o: test.cpp hoge/fuga/PIYO.h
になりました。
@null0124 @knshnb ありがとうございます。
ということは g++ は #include "..."
に書かれた文字列をそのまま出力しているぽいですね。g++ の出力を .resolve()
して変化がないか判定するのが楽そうというのが分かりました。
この手の微妙な仕様に依存するのは実はあまりよくないのだけど (壊れやすいので)、ここが嘘でも致命的ではないので、いきなり完璧は書かずにまずはお手軽実装で誤魔化していきます
A hint message is added at https://github.com/online-judge-tools/verification-helper/pull/265
「分かりにくい形で落ちるバグ」から「エラーの表示がすこし不親切なだけ」に緩和されました。とりあえずこれでいいかなと思うけど、まだ改善の余地はあるので issue 自体は残しておく
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.被害者1
https://github.com/online-judge-tools/verification-helper/issues/228#issuecomment-619986014
被害者2