Skip to content

Inherited environment variables don’t always get passed down correctly #72

@Rinzwind

Description

@Rinzwind

The Bash script given below gives a few examples in which OSSUnixSubprocess doesn’t pass down inherited environment variables as expected, the output is:

$ ./test.sh 
OK (\x41\x42\x43):
0000000 41 42 43                                       
0000000 41 42 43                                       

Output does not match (\x09\x31\x09\x32\x09):
0000000 09 31 09 32 09                                 
0000000 31 09 32                                       

Output does not match (\x46\x72\x61\x6E\xC3\xA7\x61\x69\x73):
0000000 46 72 61 6e c3 a7 61 69 73                     
0000000 46 72 61 6e e7 61 69 73                        

Error in Pharo (\x46\x72\x61\x6E\xE7\x61\x69\x73):
0000000 46 72 61 6e e7 61 69 73                        
ZnInvalidUTF8: Illegal continuation byte for utf-8 encoding

Error in Pharo (\xF0\x9F\x92\xA3):
0000000 f0 9f 92 a3                                    
Instance of WideString did not understand #tfPointerAddress

The script ‘test.sh’ (you will probably need to modify ‘pharovm’ and ‘pharoimage’):

#!/bin/bash

pharovm=~/'Documents/Pharo/vms/110-x64/Pharo.app/Contents/MacOS/Pharo'
pharoimage=~/'Documents/Pharo/images/Pharo 11.0 - 64bit (development version, latest)/Pharo 11.0 - 64bit (development version, latest).image'
script="
	[
		Metacello new
			baseline: 'OSSubprocess';
			repository: 'github://pharo-contributions/OSSubprocess:master/repository';
			load
	] on: MetacelloNotification , NewUndeclaredWarning do: [ :notification |
		notification resume ].
	(Smalltalk at: #OSSUnixSubprocess) new
		shell: '/bin/bash' command: 'echo -n \"\$TEST\" | hexdump';
		runAndWait.
	nil"

run() {
	printf '%s\n' "$1 ($2):"
	export TEST="$(printf %b "$2")"
	/bin/bash -c 'echo -n "$TEST" | hexdump' | head -n 1
	"${pharovm}" --headless "${pharoimage}" eval "${script}" 2>&1 | head -n 1
	tput sgr0
	printf '\n'
}

run 'OK' '\x41\x42\x43'
run 'Output does not match' '\x09\x31\x09\x32\x09'
run 'Output does not match' '\x46\x72\x61\x6E\xC3\xA7\x61\x69\x73'
run 'Error in Pharo' '\x46\x72\x61\x6E\xE7\x61\x69\x73'
run 'Error in Pharo' '\xF0\x9F\x92\xA3'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions