Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running unzip process outputs process output in unzipped files #1

Open
demarey opened this issue Aug 21, 2019 · 1 comment
Open

Running unzip process outputs process output in unzipped files #1

demarey opened this issue Aug 21, 2019 · 1 comment

Comments

@demarey
Copy link
Collaborator

demarey commented Aug 21, 2019

Can be reproduced by using unzip exe provided by git for Windows:

OSWSWinProcess new.
process 
	shellCommand;
	arguments: #('"C:\Program Files\Git\usr\bin\unzip"' '-o' '-d' '"C:\Users\me\Documents\Pharo\vms\70-x64"' '"C:\Users\me\Documents\Pharo\vms\70-x64.zip"');
	runAndWait;
	isSuccess

After unzipping, files are corrupted. Every (binary) file in the archive starts with some string that seems to be from the unzip progress report:

$ strings 70-x64/FT2Plugin.dll | head
  inflating: C:\Users\me\Documents\Pharo\vms\70-x64/FT2Plugin.dll  MZ
!This program cannot be run in DOS mode.
.text
P`.data
.rdata
`@.pdata
[email protected]
[email protected]
.edata
[email protected]

It seems that the stdout output from unzip is written to the files!?

The problem could be fixed with:

OSWSWinProcess new.
process 
	shellCommand;
	arguments: #('"C:\Program Files\Git\usr\bin\unzip"' '-o' '-d' '"C:\Users\me\Documents\Pharo\vms\70-x64"' '"C:\Users\me\Documents\Pharo\vms\70-x64.zip"' '> nul');
	runAndWait;
	isSuccess

The setup of the stdout handle is given in a struct called StartupInfoW. But the code looks sane, the startupinfo sent in this FFI call is all zeros. Thus the fallback would be the console window's buffer:

hStdOutput

If dwFlags specifies STARTF_USESTDHANDLES, this member is the standard output handle for the process. Otherwise, this member is ignored and the default for standard output is the console window's buffer.

So next questions I have are: which process writes the console window's buffer? And why is written to disk along with the unzipped binaries?

Problem reported by @zormit on Pharo Launcher issue tracker. See pharo-project/pharo-launcher#349

@AlainBecker
Copy link

AlainBecker commented Feb 19, 2020

For information (if ever this bug came up again despite last fix to pharo-project/pharo-launcher#349) : same issue here on win7-64 with VMs downloaded and extracted through Pharo Launcher v1.9.2

Environment-specifics : CygWin-installed unzip 6.00 is on the path here.

Same symptoms as previously described :

C:\>strings C:\Users\me\Documents\Pharo\vms\80-x64\FT2Plugin.dll | head
  inflating: C:\Users\me\Documents\Pharo\vms\80-x64/FT2Plugin.dll  MZ
!This program cannot be run in DOS mode.
[z[\
.text
P`.data
.rdata
`@.pdata
[email protected]
[email protected]
.edata

Manual unziping the VM with 7-zip solves it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants