osascript segfaults if executed with "-l AppleScript" on 10.10

Originator:stokesgeoff
Number:rdar://18699231 Date Originated:18-Oct-2014
Status:Open Resolved:No
Product:OS X Product Version:10.10
Classification: Reproducible:Always
 
Summary:
Running a text-based AppleScript using the osascript command, providing the arguments "-l AppleScript" consistently emits a segmentation fault.

Steps to Reproduce:
1. Create a text-based AppleScript with any script content, and save it
2. Execute the script from the terminal using "osascript $path_to_script"
3. Observe execution success.
4. Execute the script from the terminal using "osascript -l AppleScript $path_to_script"
5. Observe segmentation fault.

This behaviour is also exhibited when "-l AppleScript" is entered into the shebang of an executable-marked script; the attached script files demonstrate this.
1. Download the scripts
2. "chmod +x" the scripts
3. Execute "applescriptnosegfault"
4. Observe execution success.
5. Execute "applescriptsegfault"
5. Observe segmentation fault.

Expected Results:
The script should be executed, as AppleScript, in both cases.

Actual Results:
osascript emits a segmentation fault if the AppleScript language is specified.

Version:
10.10 (14A389)

Notes:
This occurs under both bash and zsh.

Note that this does not happen for scripts provided as command line arguments, only files (osascript -l AppleScript -e "\"This should print on your terminal\"" does not exhibit this erroneous behaviour).

Configuration:
MacBook Pro (Retina, 15-inch, Mid 2014)

Attachments:
'applescriptnosegfault' and 'applescriptsegfault' were successfully uploaded.

Contents of applescriptnosegfault:
```
#!/usr/bin/env osascript

"This should print on your terminal"
```


Contents of applescriptsegfault:
```
#!/usr/bin/env osascript -l AppleScript

"This should print on your terminal"
```

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!