Recognize MSYS2_ARG_CONV_EXCL#8
Merged
dra27 merged 2 commits intometastack:masterfrom Sep 6, 2021
diskuv:feature-msys2-arg-conv-excl
Merged
Recognize MSYS2_ARG_CONV_EXCL#8dra27 merged 2 commits intometastack:masterfrom diskuv:feature-msys2-arg-conv-excl
dra27 merged 2 commits intometastack:masterfrom
diskuv:feature-msys2-arg-conv-excl
Conversation
Merged
Contributor
|
I don't think this quite works - the prefix can only be relaxed in diff --git a/msvs-detect b/msvs-detect
index 601575c..89691c6 100755
--- a/msvs-detect
+++ b/msvs-detect
@@ -204,13 +204,6 @@ SCAN_ENV=0
# Various PATH messing around means it's sensible to know where tools are now
WHICH=$(which which)
-if [[ $(uname --operating-system 2>/dev/null) = "Msys" ]] ; then
- # Prevent MSYS from translating command line switches to paths
- SWITCH_PREFIX='//'
-else
- SWITCH_PREFIX='/'
-fi
-
# Parse command-line. At the moment, the short option which usefully combines with anything is -d,
# so for the time being, combining short options is not permitted, as the loop becomes even less
# clear with getopts. GNU getopt isn't installed by default on Cygwin...
@@ -920,6 +913,8 @@ for i in "${TEST[@]}" ; do
if [[ $DEBUG -gt 3 ]] ; then
printf "Scanning %s... " "$(basename "$SCRIPT") $ARCH_SWITCHES $SCRIPT_SWITCHES">&2
fi
+ # Setting MSYS2_ARG_CONV_EXCL to * inhibits attempts to convert the flags to COMSPEC as
+ # command line parameters.
num=0
while IFS= read -r line; do
case $num in
@@ -933,7 +928,8 @@ for i in "${TEST[@]}" ; do
((num++))
done < <(INCLUDE='' LIB='' PATH="?msvs-detect?:$DIR:$PATH" ORIGINALPATH='' \
EXEC_SCRIPT="$(basename "$SCRIPT") $ARCH_SWITCHES $SCRIPT_SWITCHES" \
- $(cygpath "$COMSPEC") ${SWITCH_PREFIX}v:on ${SWITCH_PREFIX}c $COMMAND 2>/dev/null | grep -F XMARKER -A 3 | tr -d '\015' | tail -3)
+ MSYS2_ARG_CONV_EXCL='*' \
+ $(cygpath "$COMSPEC") /v:on /c $COMMAND 2>/dev/null | grep -F XMARKER -A 3 | tr -d '\015' | tail -3)
if [[ $DEBUG -gt 3 ]] ; then
echo done>&2
fi(i.e. instead of respecting |
Contributor
|
That diff makes |
Contributor
Author
|
Yes MSYS2_ARG_CONV_EXCL='*' caused hanging before the change. More accurately the Command Prompt was opened invisibly and only typing 'exit' twice caused the shell to close.
…________________________________
From: David Allsopp ***@***.***>
Sent: Friday, September 3, 2021, 5:47 AM
To: metastack/msvs-tools
Cc: Jonah Beckford; Author
Subject: Re: [metastack/msvs-tools] Recognize MSYS2_ARG_CONV_EXCL (#8)
That diff makes MSYS2_ARG_CONV_EXCL='*' ./msvs-detect --all which before was hanging - is that what you were seeing, too?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#8 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AREG4POPYOYJ574UPBWMMPTUAC7UJANCNFSM5DCOSIWQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Prevent MSYS from translating command line switches to paths _if and only if_ MSYS2_ARG_CONV_EXCL has not been set. When `MSYS2_ARG_CONV_EXCL` is set (https://www.msys2.org/wiki/Porting/#filesystem-namespaces) then MSYS2 will not interpret the command line.
Contributor
Author
|
That was a great simplification. Tested it and updated the PR. |
Contributor
|
Thanks for testing it, too! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prevent MSYS from translating command line switches to paths if and only if MSYS2_ARG_CONV_EXCL has not been set.
When
MSYS2_ARG_CONV_EXCLis set (https://www.msys2.org/wiki/Porting/#filesystem-namespaces) then MSYS2 will not interpret the command line.