Script "call" cmd improperly checks WinSCP-specific switches

Advertisement

andrewvog
Joined:
Posts:
1

Script "call" cmd improperly checks WinSCP-specific switches

Hello,

I recently upgraded from WinSCP 3.8 to 4.x (I experienced the following failure on both 4.0.7 and 4.1.3beta). The problem I'm seeing is that WinSCP looks for and also validates switches on the script "call" command. This is improper, because "call" invokes a remote command that has nothing to do with WinSCP's internal script syntax.

This is a serious issue for me; it prevents me from using the call command for anything but running a remote script that doesn't take parameters.

An example of a command that will (currently) fail every time is the example given in WinSCP's own site:

call mysqldump --opt -u USERNAME --password=PASSWORD --all-databases > all_databases.sql

I downloaded the source, and think I have found this bug (copied below, from Script.cpp). Note that the expression "if (!Switches ...)" seems like it should really be: "if (Switches...)".

void __fastcall TScriptCommands::CheckParams(TOptions * Parameters,
  bool Switches)
{
  AnsiString Switch;
  if (!Switches && Parameters->UnusedSwitch(Switch))
  {
    throw Exception(FMTLOAD(SCRIPT_UNKNOWN_SWITCH, (Switch)));
  }
}

Reply with quote

Advertisement

AdamA
Guest

I also found this bug in version 4.1. I downgraded WINSCP to previous stable version: 4.0.7 and call command works fine however in this version in scripting mode I can not use switches for example:
put --preservertime ....
or
synchronize .... --criteria=both

is it possible to fix both bugs (call command) and (switches) in one version ?

Reply with quote

Advertisement

martin
Site Admin
martin avatar

AdamA wrote:

is it possible to fix both bugs (call command) and (switches) in one version ?
Please wait for the next release.

Reply with quote

martin
Site Admin
martin avatar

sto wrote:

I would like to know what is the last version of WinSCP where this bug does not appear?
The latest stable, 4.0.7.

Reply with quote

Sto
Guest

I'm sorry but this does not work...
When I call synchronize -delete remote . /home/user, I get a "Too many parameters for command 'synchronize'." error, event with WinSCP 4.0.7 .

Thanks,
David

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,440
Location:
Prague, Czechia

Sto wrote:

I'm sorry but this does not work...
When I call synchronize -delete remote . /home/user, I get a "Too many parameters for command 'synchronize'." error, event with WinSCP 4.0.7 .
OK, so what were you asking for? The thread is about bug in handling of switches in "call" command.

This bug was introduced in 4.1.x, with introduction of switches.
On the other hand, if you want to use switches, you have to use 4.1.x.

Reply with quote

Guest

Owww, sorry... -__-'
I did not read carefully, I thought the problem with switches was global...
So I'm going to try 4.1.x !!
Thanks again,
David

Reply with quote

sto
Guest

Sorry, another question.
I realize that, at the moment, there is no mean to use at the same time switches for synchronize, and switches inside call, as there is no WinSCP version that supports these two features.
Am I wrong?

Thanks,
David

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,440
Location:
Prague, Czechia

sto wrote:

Sorry, another question.
I realize that, at the moment, there is no mean to use at the same time switches for synchronize, and switches inside call, as there is no WinSCP version that supports these two features.
That's correct. You can workaround that, by creating script on the server-side with the command you need to execute, so you can use the script from "call" command (without switches).

Reply with quote

Advertisement

You can post new topics in this forum