Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Issue 3032021: Need $ on same line to not eval hash as command in bash (Closed)

Created:
10 years, 5 months ago by sosa
Modified:
9 years, 6 months ago
CC:
chromium-os-reviews_chromium.org, Mandeep Singh Baines, anush, sosa
Base URL:
ssh://git@chromiumos-git//crosutils.git
Visibility:
Public.

Description

Need $ on same line to not eval hash as command in bash TEST=Re-ran script and saw new changes.

Patch Set 1 #

Patch Set 2 : Fix space #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -2 lines) Patch
M cros_mark_all_as_stable View 1 2 chunks +4 lines, -2 lines 1 comment Download

Messages

Total messages: 2 (0 generated)
sosa
Small fix for mark all that only occurs once commit id's are present
10 years, 5 months ago (2010-07-23 22:18:10 UTC) #1
Christopher Covington
10 years, 5 months ago (2010-07-26 16:36:23 UTC) #2
http://codereview.chromium.org/3032021/diff/2001/3001
File cros_mark_all_as_stable (right):

http://codereview.chromium.org/3032021/diff/2001/3001#newcode51
cros_mark_all_as_stable:51: eval echo $(grep CROS_WORKON_COMMIT ${ebuild_path} |
cut -f 2 -d '=')) ||\
Too late now, but just a thought for the record. This has a pretty noisy
failure:

$ egit_commit=$(eval echo $(grep CROS_WORKON_COMMIT mm-core-oss-9999.ebuild |
cut -f 2 -d '=')) || echo "No CROS_WORKON_COMMIT found in
mm-core-oss-9999.ebuild" 
bash: eval: line 1: unexpected EOF while looking for matching `}'
bash: eval: line 2: syntax error: unexpected end of file
No CROS_WORKON_COMMIT found in mm-core-oss-9999.ebuild

Because of a line like this:
EGIT_BRANCH=${EGIT_BRANCH:="${CROS_WORKON_COMMIT}"}

Something along the lines of the following might fail a little more gracefully.
egit_commit=$(sed -nr 's/CROS_WORKON_COMMIT=("[a-z0-9]{40}")/\1/p'
"${ebuild_path}")
[ -z "${egit_commit}" ] && echo "No CROS_WORKON_COMMIT found in ${ebuild_path}"

I've only been testing this snippet so I don't know if the quotes should be a
part of the string or not. Looks like the grep and cut line includes them
though.

Powered by Google App Engine
This is Rietveld 408576698