Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate time on remote end #64

Merged
merged 2 commits into from Nov 7, 2016
Merged

Calculate time on remote end #64

merged 2 commits into from Nov 7, 2016

Conversation

odcinek
Copy link
Contributor

@odcinek odcinek commented Nov 1, 2016

In case of timezone (not time) difference between source and destination we can end up with invalid testing time. Touch command takes [[CC]YY]MMDDhhmm[.ss], which if calculated locally might end up being in the past on remote end (since there is no timezone information).

This fixes it by passing timestamp and calculating time on remote end.

In case of timezone (not time) difference between source and destination we can end up with invalid testing time. Touch command takes [[CC]YY]MMDDhhmm[.ss], which if calculated locally might end up being in the past on remote end (since there is no timezone information).

This fixes it by passing timestamp and calculating time on remote end.
transport.run!
end
end

private

def touchcmd
touch = Base64.encode64("touch --date \"$(date -d @" +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work on macs:

[root@mactest989.06.ash3 ~]# date -d @1478049513 +'%Y-%m-%d %T'
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nor does your touch command:

[root@mactest989.06.ash3 ~]# touch --date
touch: illegal option -- -
usage:
touch [-A [-][[hh]mm]SS] [-acfhm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...

@odcinek
Copy link
Contributor Author

odcinek commented Nov 7, 2016

@jaymzh works on Darwin now

Copy link
Collaborator

@jaymzh jaymzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks sane to me... minus the style thing

"#{TasteTester::Config.testing_end_time.to_i} +'%Y%m%d%H%M.%S')\"" +
" #{TasteTester::Config.timestamp_file}; else touch --date \"$(date -d @" +
"#{TasteTester::Config.testing_end_time.to_i} +'%Y-%m-%d %T')\"" +
" #{TasteTester::Config.timestamp_file}; fi").delete("\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you want chomp here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, this needs to be contiguous string with no newlines, which Base64.encode64 sprinkles all over

@odcinek odcinek merged commit 17504b3 into facebook:master Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants