Topic "Script "call" cmd improperly checks WinSCP-specific switches"

Author Message
andrewvog
[View user's profile]

Joined: 2008-05-24
Posts: 1
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:

Code:
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...)".

Code:
void __fastcall TScriptCommands::CheckParams(TOptions * Parameters,
  bool Switches)
{
  AnsiString Switch;
  if (!Switches && Parameters->UnusedSwitch(Switch))
  {
    throw Exception(FMTLOAD(SCRIPT_UNKNOWN_SWITCH, (Switch)));
  }
}
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
Thanks. This bug has been added to tracker.
_________________
Martin Prikryl
landau351

Guest


I found the same issue and am keen to see it fixed as well!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
It should be working in the latest stable release (4.0.7).
_________________
Martin Prikryl
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 ?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
AdamA wrote:
is it possible to fix both bugs (call command) and (switches) in one version ?

Please wait for the next release.
_________________
Martin Prikryl
sto

Guest


Hello,
I would like to know what is the last version of WinSCP where this bug does not appear?

Thank you,
David
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
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.
_________________
Martin Prikryl
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
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.
_________________
Martin Prikryl
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
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
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).
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License