This is an archive of the discontinued LLVM Phabricator instance.

Fix .arclint on Windows
ClosedPublic

Authored by rnk on Apr 24 2020, 5:54 PM.

Details

Summary

Run "bash myscript.sh". This will work if bash is on PATH, which it
probably is, since developers have to use git.

Diff Detail

Event Timeline

rnk created this revision.Apr 24 2020, 5:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 24 2020, 5:54 PM

'bash' in my cmd.exe command prompt will run WSL's bash.exe (which is in Window's system directory)

'bash' in my mingw terminal will run mingw's bash.

Is this intended? 'git' in cmd.exe will run mingw's git. It may not even matter since invoking 'utils/arcanist/clang-format.sh' from cmd.exe didn't even work in any case before.

scott.linder accepted this revision.Apr 27 2020, 11:08 AM

I don't have a way to test this, but it seems like an OK change to me, modulo the fact that I don't know the effect of the weirdness @Meinersbur brings up.

Does git really depend on bash, or just "POSIX sh"? We could instead change the script to invoke /bin/sh and audit it to be POSIX.

I think we should really just rewrite it in Python, which I intended to do but haven't had a chance to yet.

This revision is now accepted and ready to land.Apr 27 2020, 11:08 AM
rnk added a comment.Apr 28 2020, 9:54 AM

'bash' in my cmd.exe command prompt will run WSL's bash.exe (which is in Window's system directory)

'bash' in my mingw terminal will run mingw's bash.

Is this intended? 'git' in cmd.exe will run mingw's git. It may not even matter since invoking 'utils/arcanist/clang-format.sh' from cmd.exe didn't even work in any case before.

It's true, I'm just hoping that the right bash is on PATH. I feel bad leaving this here as a stumbling block for someone who uses cmd.exe with arcanist to trip over, but I need to do something for myself in the meantime.

I don't have a way to test this, but it seems like an OK change to me, modulo the fact that I don't know the effect of the weirdness @Meinersbur brings up.

Does git really depend on bash, or just "POSIX sh"? We could instead change the script to invoke /bin/sh and audit it to be POSIX.

Yes, if you install git for Windows, it contains bash. There's no package manager, so it's not exactly a dependency.

I think we should really just rewrite it in Python, which I intended to do but haven't had a chance to yet.

I agree, a Python port would work best in the long run, and would address the cmd.exe issues @Meinsersbur raised.

Thanks for looking at this, I'll land it soon.

rnk updated this revision to Diff 260676.Apr 28 2020, 9:55 AM
  • testing lint
This revision was automatically updated to reflect the committed changes.