Closed Bug 895435 Opened 9 years ago Closed 8 years ago

JS configure.in uses unquoted shell characters

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: sunfish, Assigned: sunfish)

Details

Attachments

(1 file)

Line 235 of js/src/configure.in is:

IS_ALPHA=`echo $MOZILLA_VERSION | grep [ab]`

The unquoted '[' and ']' work unless there happens to be a file named "b" in the current directory, in which case it expands to "grep b", which causes this line to fail. For example, in shell:

$ echo 25.0a1 | grep [ab]
25.0a1
$ echo hello > b
$ echo 25.0a1 | grep [ab]
$

This can by fixed by escaping or quoting the brackets. For example:

$ echo 25.0a1 | grep \[ab\]
25.0a1
$

That is, changing the line above to this:

IS_ALPHA=`echo $MOZILLA_VERSION | grep \[ab\]`
This patch escapes the shell characters as described above.
Assignee: general → sunfish
Attachment #797336 - Flags: review?(mh+mozilla)
Comment on attachment 797336 [details] [diff] [review]
configure-quote.patch

Review of attachment 797336 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/configure.in
@@ +231,5 @@
>  changequote(,)
>  MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
>  MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
>  MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
> +IS_ALPHA=`echo $MOZILLA_VERSION | grep \[ab\]`

might as well make it grep '[ab]'
Attachment #797336 - Flags: review?(mh+mozilla) → review+
(In reply to Mike Hommey [:glandium] from comment #2)
> > +IS_ALPHA=`echo $MOZILLA_VERSION | grep \[ab\]`
> 
> might as well make it grep '[ab]'

Done. https://hg.mozilla.org/integration/mozilla-inbound/rev/419bd018c13e
https://hg.mozilla.org/mozilla-central/rev/419bd018c13e
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.