Sync problem with server that has zero timezone offset

Advertisement

djs
Joined:
Posts:
8
Location:
Connecticut

Sync problem with server that has zero timezone offset

I'm a developer setting up an automated build server and I want to use WinSCP to upload files to our web servers using its Sync feature. I've used it on several different servers hosted at Rackspace and 1and1, and it works great. Unfortunately, it doesn't work properly on the servers of one of our clients. The initial sync will copy all of the files but if I run the build script a second time, recompiling the site which should cause many of the files to have newer timestamps, no files are sent to the remote server. I believe this is a problem with how WinSCP sees the file timestamps on the remote server when that server doesn't have a timezone offset.

My computer is Windows 7 SP1 in the US Eastern time zone (offset -4), while the remote server is Windows Server 2012 in the Coordinated Universal Time time zone (offset 00:00:00).

I'm using WinSCP version 5.7.5 via the WinSCP Powershell module from https://github.com/dotps1/WinSCP.

I'm using the Sync-WinSCPPath powershell command to sync two files from my computer to the wwwroot/Uploads folder on the remote server. This is the test powershell script:

Remove-Module [w]inscp
Import-Module WinScp

$ftpHost = "svvs-v-win-stage.corp"
$ftpUser = "user.com-stg"
$ftpDir = "wwwroot/Uploads"

$credential = Get-Credential -UserName $ftpUser -Message "Please enter password for $ftpHost."

$log = (Join-Path $PSScriptRoot "sync-bug.log")
Write-Host "write log to $log"

$session = New-WinSCPSession -Hostname $ftpHost -Credential $credential -Protocol Ftp -SessionLogPath $log

$source = (Join-Path $PSScriptRoot "Uploads")
Write-Host "sync $source to $ftpDir"
Sync-WinSCPPath -WinSCPSession $session -Mode Remote -Criteria Either -LocalPath $source -RemotePath $ftpDir

Remove-WinSCPSession -WinSCPSession $session

These are the steps I took:

1) Run this powershell script to sync local Upload folder containing grog.png file dated 7/28/2014 11:01am.
2) Filezilla GUI shows the remote grog.png file is dated 7/28/2015 11:01am (which is accurate).
3) WinSCP GUI shows the remote grog.png file is dated 7/28/2014 7:01pm (which is 8 hours later).
4) Run the script again and WinSCP doesn't copy any files (i.e. the local grog.png file hasn't changed).
5) I touch the local grog.png file changing its timestamp to 10/6/2015 9:04pm.
6) Run the script again and WinSCP copies the grog.png file to the remote server.
7) Filezilla GUI shows the remote grog.png file is dated 10/6/2015 9:04pm (which is accurate).
8) WinSCP GUI shows the remote grog.png file is dated 10/7/2015 5:04am (which is 8 hours in the future).
9) Touch the local grog.png file again, changing its timestamp to 10/6/2015 9:09pm.
10) Run the script again and WinSCP doesn't copy the grog.png file to the remote server, but it should have.

I've looked over the attached log and I think WinSCP is wrongly calculating the remote file timestamp. Perhaps it is just a coincidence, but WinSCP is off by 8 hours, double the absolute value of the offset my computer has with the US Eastern timezone.

Please let me know if you have any questions or need any additional information.
Thanks
Dan

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,069
Location:
Prague, Czechia

Re: Sync problem with server that has zero timezone offset

Thanks for your report.

Try to list directory using Get-WinSCPChildItem before synchronization and let me know if it changes anything. Post a new log file.

Reply with quote

djs
Joined:
Posts:
8
Location:
Connecticut

Re: Sync problem with server that has zero timezone offset

I added a call to
Get-WinSCPChildItem -WinSCPSession $session -Path $ftpDir
before calling the sync command, did the same steps as before, and got the same results. The log file is attached.

I did notice that the call to Get-WinSCPchildItem returned a different time stamp in the console than I got from either Filezilla or from the WinSCP GUI. The original file's timestamp is 7/28/2014 11:01am, once copied to the remote server Filezilla showed it as 7/28/2014 11:01am, the WinSCP GUI showed it as 7/28/2014 7:01pm, and the Get-WinSCPChildItem command showed it as 7/28/2014 3:01pm. See the attached console.log file.
Description: Powershell console log
Description: WinScp command log

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,069
Location:
Prague, Czechia

Re: Sync problem with server that has zero timezone offset

Thanks.

This bug has been added to the tracker:
https://winscp.net/tracker/1366

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

Reply with quote

djs
Joined:
Posts:
8
Location:
Connecticut

Re: Sync problem with server that has zero timezone offset

Hi,

Thanks for the update. However, I didn't get the email with the dev version of WinSCP. I checked my profile and the email address is correct. Can you please try it again?

Thanks

martin wrote:

Thanks.

This bug has been added to the tracker:
https://winscp.net/tracker/1366

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,069
Location:
Prague, Czechia

Re: Sync problem with server that has zero timezone offset

Indeed, I cannot find the email. Sorry. Sent now.

Reply with quote

djs
Joined:
Posts:
8
Location:
Connecticut

Hi,

It looks like this bug is back. My timezone (USA Eastern) just switched from daylight savings to standard (from -4 to -5) and so now file timestamps on the remote server is an hour ahead of the local time (local is 8:52am while remote shows 9:52am). In FileZilla it shows the time stamp correctly so I imagine the time is set correctly on the remote server and being converted incorrectly in WinSCP.

Please let me know if you need more information.
Thanks
Dan

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,069
Location:
Prague, Czechia

Please provide me the logs again. Name a problematic file and the expected timestamp.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,069
Location:
Prague, Czechia

The dev version is 5.8, so it contains changes that 5.7.6 does not.

Could you please repeat the test with the dev version?

Reply with quote

djs
Joined:
Posts:
8
Location:
Connecticut

Sorry about the delay in this. I've attached two log files. The winscp-9.00.log records the first run which works properly, while the winscp-9.15.log records the second run which doesn't copy up any files. Both runs should copy up at least 6 files as the build script that this is part of will compile or create that many files even if the source code isn't changed.

This was run using version 5.7.6.5874, but I got the exact same results with the 5.8.0.5822 version you sent me before, or the new 5.8.0.6030 beta version.

When I browse the FTP site using WinSCP the file time stamps on these 6 files are one hour ahead, but when I use FileZilla they are accurate.

Thanks, and let me know if you have any other questions.
Dan
  • winscp.log.zip (81.19 KB, Private file)

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,069
Location:
Prague, Czechia

Thanks for the logs. What are the files that should be synchronized, but are not?

Reply with quote

djs
Joined:
Posts:
8
Location:
Connecticut

martin wrote:

Thanks for the logs. What are the files that should be synchronized, but are not?

These 7 files should have been updated in the second run because they are re-created or compiled during the build:
\robots.txt
\web.config
\App_Data\Sitefinity\Configuration\DataConfig.config
\App_Data\Sitefinity\Configuration\SiteSyncConfig.config
\App_Data\Sitefinity\Configuration\SystemConfig.config
\bin\SitefinityWebApp.dll
\bin\SitefinityWebApp.pdb

Note that the build script also deletes the /web.config on the remote server and then re-uploads it to make sure the web site restarts.

Reply with quote

Advertisement

djs
Joined:
Posts:
8
Location:
Connecticut

martin wrote:

Thanks.

It's likely this issue:
https://winscp.net/tracker/1380

I'm sending you an email with a new development version of WinSCP.

Hi,

Thanks for the files, but I'm having the same problem. Note that this server's timezone is set to UTC, which doesn't adjust for Daylight Savings, while my computer is set to US Eastern Time and does adjust for Daylight Savings. Currently my computer's time is -5 from UTC. The first run of the build script worked properly, copying up 9 files, but that is because I haven't run the build script within the last hour. Running the build script a second time didn't copy up any files (see attached log).

After running the build script the WinSCP GUI shows the new files with a time stamp of 12/22/2015 6:27PM, but it should be 5:27PM.

Let me know if you have any other questions.
Dan
  • WinScp-5.27.log.zip (38.25 KB, Private file)

Reply with quote

Advertisement

You can post new topics in this forum