twitter / hadoop-lzo

Refactored version of code.google.com/hadoop-gpl-compression for hadoop 0.20
GNU General Public License v3.0
545 stars 328 forks source link

Windows build.properties contains shell script error instead of commit ID in build_revision field. #99

Closed cnauroth closed 9 years ago

cnauroth commented 9 years ago

hadoop-lzo logs version information when it loads. We've discovered that for Windows builds, we're instead getting error output from the get_build_revision.sh script. For example:

14/09/29 14:30:47 INFO lzo.LzoCodec: Successfully loaded & initialized native-lzo library [hadoop-lzo rev D:\w\b\project\hadoop-lzo/scripts/get_build_revision.sh: line 2: $'\r': command not found 
D:\w\b\project\hadoop-lzo/scripts/get_build_revision.sh: line 28: syntax error: unexpected end of file]

This information comes from the build.properties file. There are 2 problems with the way this file is generated on Windows:

  1. Running sh on a script, even on Windows, expects LF line endings. At least this is the case with the sh builds from GnuWin32 that I've used. However, depending on the git user, the files might get checked out with CRLF line endings on Windows.
  2. The argument passed to sh is the absolute path of the get_build_revision.sh, composed by concatenating the Maven basedir and the relative path to get_build_revision.sh. On Windows, basedir will contain back slashes. sh can handle this, but it writes a warning to stderr advising that it would be better to use forward slashes.