"Tag chmod before tag download" exception

Advertisement

Dziki_Jam
Joined:
Posts:
2
Location:
Belarus, Minsk

"Tag chmod before tag download" exception

Hello! I'm getting the following exception when executing directory sync with permissions set:
Exception calling "SynchronizeDirectories" with "7" argument(s): "Tag chmod before tag download"
The most strange thing here is that script does its job and files are transferred correctly as far as I can judge. Even permissions are correct.

Here's my script's main part code:
try {
    $sessionOptions = New-Object WinSCP.SessionOptions -Property @{
        Protocol                             = [WinSCP.Protocol]::Sftp
        HostName                             = $PuppetSrvIP
        UserName                             = $PuppetSrvUserName
        GiveUpSecurityAndAcceptAnySshHostKey = $True
        SshPrivateKeyPath                    = $PuppetSrvKeyFile
        #SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
    }
 
    $session = New-Object WinSCP.Session

    $transferOptions = New-Object WinSCP.TransferOptions
    $transferOptions.FileMask = "$($Include -join ";")|$($Exclude -join ";")"
    $transferOptions.FilePermissions = New-Object WinSCP.FilePermissions
    $transferOptions.FilePermissions.Octal = "$Permissions"

    try {
        # Will continuously report progress of synchronization
        $session.add_FileTransferred( { FileTransferred($_) } )
 
        # Connect
        $session.Open($sessionOptions)

        if ($NoCleanup) {
            $Cleanup = $False
        }
        else {
            $Cleanup = $True
        }
 
        # Synchronize files
        $synchronizationResult = $session.SynchronizeDirectories(
         [WinSCP.SynchronizationMode]::Remote, $SourcePath, $TargetPath, $Cleanup, $False, [WinSCP.SynchronizationCriteria]::Time, $transferOptions)
 
        # Throw on any error
        $synchronizationResult.Check()
    }
    finally {
        # Disconnect, clean up
        $session.Dispose()
    }

    Write-Host "Successfully synced directories"
    if ($NoCleanup) {
        Write-Host "No cleanup was performed"
    }
}
catch {
    $Exception = $_.Exception
    Write-Error "Error: $($Exception.Message)"
}
How can I debug this strange behavior? I've checked session logs but nothing suspicious was found except the same exception.
Also, I've noticed that FileTransferred event handler stopped working after I added FilePermissions option. I'm using event handler from this example.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,815
Location:
Prague, Czechia

Re: "Tag chmod before tag download" exception

Please set Session.DebugLogPath and Session.SessionLogPath and attach both logs.

Reply with quote

Dziki_Jam
Joined:
Posts:
2
Location:
Belarus, Minsk

Re: "Tag chmod before tag download" exception

martin wrote:

Please set Session.DebugLogPath and Session.SessionLogPath and attach both logs.
Please find the attachment. The archive contains both logs you've requested.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
29,815
Location:
Prague, Czechia

Re: "Tag chmod before tag download" exception

Thanks for the logs.

This issue has been added to the tracker:
https://winscp.net/tracker/1603

I'm sending you an email with a development version of WinSCP to the address you have used to register on this forum.

Reply with quote

Advertisement

You can post new topics in this forum