Запускатель и PATHEXT

Хотите говорить о Far и не знаете, куда обратиться?
Markus
Posts: 5
Joined: Mon 16 Nov, 2020 08:57

Запускатель и PATHEXT

Post by Markus »

Latest post of the previous page:

5704:
c:\test a b c (with space at end)

Code: Select all

Full command line: ["c:\test.exe" a b c "]
Argument 0: [C:\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
Argument 4: []
c:\test.exe a b c (with space at end and .EXE)

Code: Select all

Full command line: ["c:\test.exe" a b c ]
Argument 0: [\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
5700:
c:\test a b c (with space at end)

Code: Select all

Full command line: ["c:\test.exe" a b c ]
Argument 0: [\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
c:\test.exe a b c (with space at end and .EXE)

Code: Select all

Full command line: ["c:\test.exe" a b c ]
Argument 0: [\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
The difference seems to be the additional " at then end of the command line.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Markus, it looks like the sytem adds that " for some reason.
Can you try this to confirm?
Release.32.vc.7z
(1.42 MiB) Downloaded 149 times

It's the latest 5704, but with the following change to check what is going on:
  1. diff --git a/far/execute.cpp b/far/execute.cpp
  2.  
  3. index fbeeb61de..a3aee9eed 100644
  4.  
  5. diff --git a/far/execute.cpp b/far/execute.cpp
  6.  
  7. index fbeeb61de..a3aee9eed 100644
  8.  
  9. --- a/far/execute.cpp
  10.  
  11. +++ b/far/execute.cpp
  12.  
  13. @@ -428,6 +428,8 @@ static bool execute_shell(string const& Command, string const& Parameters, strin
  14.  
  15.         Info.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOASYNC | SEE_MASK_NOCLOSEPROCESS | (Wait? SEE_MASK_NO_CONSOLE : 0);
  16.  
  17.         Info.lpVerb = RunAs? L"runas" : nullptr;
  18.  
  19.  
  20.  
  21. +       MessageBox({}, format(L"ShellExecuteEx:\n lpFile = [{0}]\n lpParameters = [{1}]"sv, Command, Parameters).c_str(), {}, 0);
  22.  
  23. +
  24.  
  25.         if (!ShellExecuteEx(&Info))
  26.  
  27.                 return false;

If so, what OS are you using?
Markus
Posts: 5
Joined: Mon 16 Nov, 2020 08:57

Запускатель и PATHEXT

Post by Markus »

Windows 10 x64 20H2 (10.0.19042.630)
CMD.EXE (legacy console enabled)
ConEmu x64 (201101)
FAR3 x64 (build 5700, 5702 and 5704)

5704 (32 bit) executing \test a b c :
lpFile = [\test]
lpParameters = [a b c ]
Full command line: ["C:\test.exe" a b c "]

5704 (32 bit) executing \test.exe a b c :
lpFile = [\test.exe]
lpParameters = [a b c ]
Full command line: ["C:\test.exe" a b c ]

ConEmu shell (without FAR) executing \test a b c :
Full command line: [\test a b c ] (no quotation marks and there are 2 spaces before the first parameter "\test__a_b_c_")

CMD.EXE (without ConEmu and FAR) executing \test a b c :
Full command line: [\test a b c ] (no quotation marks and there are 2 spaces before the first parameter "\test__a_b_c_")
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Does it happen in far without conemu?
User avatar
Smitis
Posts: 1709
Joined: Fri 18 Mar, 2005 12:51
Location: Питер
Has thanked: 23 times
Been thanked: 55 times

Запускатель и PATHEXT

Post by Smitis »

5704
Создаю папку cmd.exe
Выполняю не меняя папку cmd
Получаю:
Can't create process, ErrCode=0x00000057, Description:
Параметр задан неверно.
(и далее)
Разум когда-нибудь победит.
Markus
Posts: 5
Joined: Mon 16 Nov, 2020 08:57

Запускатель и PATHEXT

Post by Markus »

Does it happen in far without conemu?
Running FAR from CMD.EXE without ConEmu does not add the additional " to the end of the command line.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Markus wrote: Mon 16 Nov, 2020 17:10Running FAR from CMD.EXE without ConEmu does not add the additional " to the end of the command line.
In such case this issue has nothing to do with far or this topic. Please report it to https://github.com/Maximus5/ConEmu/issues.
Disabling "inject conemu hooks" (or something like that) in its settings might also help.
Markus
Posts: 5
Joined: Mon 16 Nov, 2020 08:57

Запускатель и PATHEXT

Post by Markus »

The FAR changes done in this topic are the reason for the " behavior.

FAR alone works fine.
ConEmu alone works fine.
Up to and including build 5700 FAR and ConEmu always worked fine together.
Now a FAR change broke something.

The " error happens only when the executable needs to be searched. It does not happen when the executable's full path is available.

Since this topic is about changing the way FAR searches for the executable, I would say it belongs in this topic.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

My point is that the situation "the executable needs to be searched" is: 1. legal and 2. the whole point of this change in far.
The fact that conemu intercepts certain windows APIs and spontaneously inserts quotation marks or maybe even whole Monty Python quotes is interesting per se, but it doesn't make the situation illegal and doesn't require any workarounds from our side.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Smitis, 5705.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Markus, due to unrelated reasons the executable's full path is available again, so your issue will probably go away.
Nevertheless, I still highly recommend reporting it. It will manifest itself again one day, if not in far then in some other app.
User avatar
Wave
Posts: 1885
Joined: Thu 04 Aug, 2005 18:47
Has thanked: 14 times
Been thanked: 26 times

Запускатель и PATHEXT

Post by Wave »

I've met buggy additional " with some old versions of ConEmu (while using vim). Bug resolved in somewhen new versions. Dunno which ones.
Пользуюсь ФАРом больше 20 лет © собирательный.
User avatar
KcinKh
Posts: 48
Joined: Fri 14 Oct, 2005 21:47
Location: Ukraine
Has thanked: 5 times

Запускатель и PATHEXT

Post by KcinKh »

DrKnS wrote: Tue 10 Nov, 2020 22:39 У меня вроде бы все работает, поэтому к концу недели все это вполне может оказаться в мастере и у всех, так что кричите, если что не так.
из того "что не так" - раньше ассоциации применялись и для ком.строки с передачей всех параметров в строку запуска? например, при ассоциации

Code: Select all

 *.sh
 [x] Команда, выполняемая по Enter:
     sh.exe !.!
(sh.exe - CygWin, доступен в PATH)
можно было в ком строке выполнить

Code: Select all

$p$g>testsh.sh 1 2 3 4 abc abcdef
это приводило к выполнению

Code: Select all

$p$g>sh.exe test.sh
1 2 3 4 5 sdfsdfsd
в результирующей строке запуска `sh.exe test.sh` параметры не отображаются (не хорошо, но терпимо) главное они передавались, а после переделок запускателя не передаются.
(в ОС ассоциации для .sh - нет)

* может в ассоциациях нужно добавить метасимвол !@ или !* для проброса всех параметров из ком. строки?
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

KcinKh, параметры передаются, но обработка ассоциаций отключена по умолчанию.
Вы можете включить ее в far:config - System.Executor.UseAssociations.
Отображение параметров посмотрю.
User avatar
KcinKh
Posts: 48
Joined: Fri 14 Oct, 2005 21:47
Location: Ukraine
Has thanked: 5 times

Запускатель и PATHEXT

Post by KcinKh »

DrKnS wrote: Sun 22 Nov, 2020 22:59 Вы можете включить ее в far:config - System.Executor.UseAssociations.
спасибо. работает
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

KcinKh wrote: Sun 22 Nov, 2020 22:15 параметры не отображаются
5709.
Post Reply

Return to “Обсуждение Far Manager”