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

test-framework: Assignment short ID contains spaces lead to incorrect SSH call #1023

Closed
yc2lee opened this Issue Mar 2, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@yc2lee
Contributor

yc2lee commented Mar 2, 2013

In the file app/helpers/automated_tests_helper.rb, there is a function called launch_test which makes several SSH calls. Among them are:

stdout, stderr, status = Open3.capture3("scp -p -r #{src_dir}/* #{server}:#{run_dir}")
stdout, stderr, status = Open3.capture3("scp -p -r #{test_dir}/* #{server}:#{run_dir}")

src_dir and test_dir are formed from the assignment short identifier, which may contains spaces. So src_dir and test_dir can contain spaces. In that case, the SSH calls will have extra arguments.

The SSH calls should probably be something like this instead:

stdout, stderr, status = Open3.capture3("scp -p -r '#{src_dir}'/* #{server}:#{run_dir}")
stdout, stderr, status = Open3.capture3("scp -p -r '#{test_dir}'/* #{server}:#{run_dir}")
@yc2lee

This comment has been minimized.

Show comment
Hide comment
@yc2lee

yc2lee Mar 6, 2013

Contributor

I think the String src_dir should not be formed using the assignment short identifier. Currently, it is formed by:

src_dir = File.join(repo_dir, assignment.short_identifier)

This works as long as the short identifier is equal to the repository folder. But of course that is not guaranteed to be true for every assignment.

Contributor

yc2lee commented Mar 6, 2013

I think the String src_dir should not be formed using the assignment short identifier. Currently, it is formed by:

src_dir = File.join(repo_dir, assignment.short_identifier)

This works as long as the short identifier is equal to the repository folder. But of course that is not guaranteed to be true for every assignment.

benjaminvialle added a commit that referenced this issue Mar 9, 2013

Merge pull request #1041 from umsmit32/issue-1023
FIX for issue 1023
Assignments with spaces in their short identifier will be properly handled in the command line calls now so that the automated test script doesn't fail.
Closes #1023
@danielstjules

This comment has been minimized.

Show comment
Hide comment
@danielstjules

danielstjules Sep 7, 2013

Member

Fixed via #1041

Member

danielstjules commented Sep 7, 2013

Fixed via #1041

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment