aws / aws-codedeploy-agent

Host Agent for AWS CodeDeploy
https://aws.amazon.com/codedeploy
Apache License 2.0
329 stars 187 forks source link

Recent codedeploy-agent seems to be running bash scripts in POSIX compliant mode (sh) regardless of shebang. #71

Closed glennpratt closed 8 years ago

glennpratt commented 8 years ago

A recent release of codedeploy-agent broke our previously working scripts:

--> Script at specified location: script/system.sh failed with exit code 2
--> LifecycleEvent - AfterInstall
--> Script - script/system.sh
--> [stderr]/opt/codedeploy-agent/deployment-root/1a506db0-192b-4124-a869-359f1d001c5a/d-GVFM5I4BG/deployment-archi
ve/script/logger.sh: line 4: syntax error near unexpected token `>'
[ ✗ ] [ 0m 35s ] Error while performing step: Creating Deployment
  Thor::Error: Deployment was unsuccessful!
Deployment was unsuccessful!

All of our scripts start with a shebang line pointing at bash:

#!/bin/bash

But for some reason, they are running in bash in POSIX mode which wasn't previously the case.

Our fix:

set +o posix

One potential cause for the change:

https://github.com/aws/aws-codedeploy-agent/commit/f2d8cba93bc6df6e3ca2480045ced6c8dc1ef6c8
glennpratt commented 8 years ago

Looks like #68 fixes this.

suryanarayanan commented 8 years ago

Merged https://github.com/aws/aws-codedeploy-agent/pull/68

glennpratt commented 8 years ago

Thanks!