GoogleCloudPlatform / cloud-builders-community

Community-contributed images for Google Cloud Build
https://cloud.google.com/cloud-build/
Apache License 2.0
1.26k stars 858 forks source link

envsubst - Fix when more than 2 arguments #527

Closed eric-hemasystems closed 3 years ago

eric-hemasystems commented 3 years ago

The previous code:

 files_count=$((  + 1 ))

Is effectively the same as:

files_count=1

I suspect the double space meant originaly it was:

files_count=$(( files_count + 1 ))

Somehow an editing error occurred and the files_count was removed. The result is the first argument is indexed at 0 (from above) all subsequent values are indexed at 1 with each later argument overwriting the previous. This means only the first and last argument are actually processed.

This fixes the code so that all arguments are processed.

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

eric-hemasystems commented 3 years ago

@googlebot I signed it!

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

eric-hemasystems commented 3 years ago

@googlebot I signed it!

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

eric-hemasystems commented 3 years ago

@googlebot I signed it!