SeattleTestbed / buildscripts

Tools to build runnable components from SeattleTestbed repos
MIT License
0 stars 2 forks source link

`initialize.py` may clone into dirnames containing `\r` #7

Open aaaaalbert opened 8 years ago

aaaaalbert commented 8 years ago

Ajay (@kellender) reports that editing an init config on a Windows machine breaks the build process. I can reproduce the problem by appending a \r (by typing ^V^M) on the end of a line of the init config. This causes the repo on that line to be git-cloned into a directory reponame\r; subsequently, the build script fails as the dirname it uses doesn't match the one we cloned into.

The issue is in initialize.py, which loops over the files of the init config here, but doesn't care to strip() off whitespace (which includes \r and \n!) when constructing the git command line here.

Apart from the obvious fix, we may consider dealing with line endings on the level of local Git configs.


Example

# My config_initialize.txt. Note the ``^M'' at the end of the line
https://github.com/SeattleTestbed/seattlelib_v2 ../DEPENDENCIES/seattlelib_v2^M

This clones seattlelib_v2 into ../DEPENDENCIES/seattlelib_v2^M. Then, firing up the build:

albert$ python build.py 
Building into /private/tmp/rv2/RUNNABLE
WARNING: File expression 'DEPENDENCIES/seattlelib_v2/*' does not match any files. Maybe the directory is empty, or the file / directory doesn't exist?
Done building!

History side-note

It has been brought to my attention that the fact that different operating systems historically use different character(s) to signal the end of a line of text should not be considered common knowledge.

Of relevance today are two different schools of line endings:

This causes some cross-platform grief for Seattle time and again. See here for a list of open issues/PRs concerning Seattle and CR/LF. For more intricate detail, please refer to Wikipedia.

awwad commented 8 years ago

The simple fix of employing strip() resolves this issue and also issue #8. The same should be done to SeattleTestbed/common/build_component.py when it parses config_build.txt. Did that, tested, works. I guess I can't issue a single pull request to two repositories, so I'll... do it separately.