1. WEE-41 UPX fail on Ubuntu 15.10 64-bit
- Posted by K_D_R Dec 21, 2015
- 1664 views
This is very strange. On WEE-41 and several previous versions I have experienced strange results with the Translate-Compile option.
The upx code seems to be executing prior to the translate compile code.
This is a capture of the lxterminal cosole output upon running wee.exw v. 41 in a terminal and then selecting translate and compile with only the test run after bind/shroud translate option selected:
kenneth@kenneth-desktop:~/wee/wee41$ eui wee.exw wee.exw /usr/bin/upx Ultimate Packer for eXecutables Copyright (C) 1996 - 2013 UPX 3.91 Markus Oberhumer, Laszlo Molnar & John Reiser Sep 30th 2013 File size Ratio Format Name -------------------- ------ ----------- ----------- upx: wee: FileNotFoundException: wee Packed 0 files.
The "Run in background" option was not selected. A gnome-terminal window opened immediately and reported the progress of translation/compile operation during which time the wee.exw code page remained unshaded. Upon completion of the translation/compile process the gnome-terminal window closed. A check of the wee41 folder revealed that the file had been translated/compiled, but not packed by UPX:
kenneth@kenneth-desktop:~/wee/wee41$ ls -s total 2996 4 EuGTK 4 scintilla 48 ui_gtk.e *** 2676 wee *** 12 weeicon.e 84 parser.e 76 scintilla.e 4 updater.ex 88 wee.exw {{{ When I run the translate/compile option again. The upx function executes immediately and compresses the wee binary created by the previous run. {{{ /usr/bin/upx Ultimate Packer for eXecutables Copyright (C) 1996 - 2013 UPX 3.91 Markus Oberhumer, Laszlo Molnar & John Reiser Sep 30th 2013 File size Ratio Format Name -------------------- ------ ----------- ----------- 2740216 -> 813644 29.69% linux/ElfAMD wee Packed 1 file.
Then the wee.exw code is translated and compiled again, overwriting the previously created compressed wee binary.
On the second run the editor window shaded and remained shaded and unresponsive, even after the translation/compile task completed. I had to force the unresponsive window to close.
Bind fails in the same manner. On the first run, upx will try to compress filebase(file_name) before executing eubind, then a bound version of file_name is created which is not compressed. On the 2nd run, the previously created bound file is compressed; however execution fails with the message:
kenneth@kenneth-desktop:~/wee/wee41$ ./wee <0302>:: no Euphoria IL code to execute
I do not believe that bound euphoria programs are compressable with upx.
I edited the translate compile clause in RunStart as follows:
-- insert before RunStart in ui_gtk.e function background(sequence cmd) -- for use with system_exec(cmd[1], cmd[2]) cmd &= " &" cmd[1] = cmd cmd[2] = 1 -- the previous graphics mode is restored -- and the screen is cleared. if run_background then cmd[2] = 0 -- a beep sound will be made and the program will wait for the user to press a key before the previous graphics mode is restored. end if return cmd end function -- replaces existing translate/compile code in function RunStart. -- if run menu option "Run in Backround is not selected -- progress will be reported in the -- system default terminal emulator -- a keypress is required to proceed -- to the next process. elsif equal(lbl, "Translate and Compile") then if file_exists(filebase(file_name)) then -- else upx will execute first, -- compressing the existing file, -- and then a new file will be created, -- which will not be compressed! delete_file(filebase(file_name)) end if cmd &= get_eu_bin("euc") & ' ' & quote_spaces(file_name) cmd = background(cmd) -- requires function background(sequence cmd) if system_exec(cmd[1], cmd[2]) = 0 then -- file translated/compiled successfully cmd = "upx " & filebase(file_name) cmd = background(cmd) if system_exec(cmd[1], cmd[2]) = 0 then -- executable file packed successfully if run_testrun then cmd = "./" & filebase(file_name) cmd = background(cmd) if system_exec(cmd[1], cmd[2]) = 0 then end if end if end if end if
Perhaps it would be easier not to support upx. Or maybe add a discrete option to the Run menu.
Regards, Ken
2. Re: WEE-41 UPX fail on Ubuntu 15.10 64-bit
- Posted by petelomax Dec 22, 2015
- 1514 views
kenneth@kenneth-desktop:~/wee/wee41$ eui wee.exw wee.exw
Is that a typo? Or a bug in wee? Note: I'm not conversant with eui command-line options and the on-line manual is unedifying. I assume it should be eui wee.exw wee[.exe]?
Pete
3. Re: WEE-41 UPX fail on Ubuntu 15.10 64-bit
- Posted by jimcbrown (admin) Dec 22, 2015
- 1519 views
kenneth@kenneth-desktop:~/wee/wee41$ eui wee.exw wee.exw
Is that a typo? Or a bug in wee? Note: I'm not conversant with eui command-line options and the on-line manual is unedifying. I assume it should be eui wee.exw wee[.exe]?
Pete
I don't know anything about wee, but this makes sense.
The first part, is just eui.
The first two parts, say to run wee from the source code:
eui wee.exw
The third part is thus a parameter to wee itself. Like so,
eui wee.exw myprogramtoedit.ex
This is probably the code to edit/translate/compile/bind/etc.
So the following,
eui wee.exw wee.exw
is just running wee and telling wee to open its own source code (so K_D_R can use wee itself to create its own executable and run UPX on it).
4. Re: WEE-41 UPX fail on Ubuntu 15.10 64-bit
- Posted by petelomax Dec 22, 2015
- 1549 views
The third part is thus a parameter to wee itself.
DOH. I can be so thick sometimes...
5. Re: WEE-41 UPX fail on Ubuntu 15.10 64-bit
- Posted by K_D_R Dec 23, 2015
- 1550 views
OK, I this is what I have learned thus far on my Linux, Ubuntu 15.1 64 bit system with the following terminal emulators installed: xterm, xfce4-terminal, gnome-terminal, lxterminal, mate-terminal
- The "Wait For Keypress after Run in Terminal" option only works with xterm.
- UPX only works consistently correctly with xterm.
- "Wait For Keypress after Run" makes it easy to monitor the success/failure of Translate/Compile/Compress.
Xterm has an incredibly small default font size. Installing a better font set is way too much trouble. But for most purposes, it will probably suffice.
Other terminal emulators, such as the xfce4-terminal, which are highly configurable and easy on the eyes can be used for well behaved Linux console programs.
So I decided to make xterm default whenever "Wait For Keypress ...", or "Translate and Compile is selected from the Run menu. An easier to use, SEE, and configure terminal emulator selected from the "Set Terminal Emulater" run menu option will be automatically be used for all other terminal emulator purposes.
--<=== marks code insertion block or line procedure Run(sequence cmd) sequence prev_term = terminal_program --<=== if length(terminal_program) then if run_waitkey then -- don't show "Press Enter" on errors terminal_program = "xterm -e" --<=== cmd = match_replace("eui ", cmd, "eui -batch ") cmd &= " ; read -p \"\nPress any key...\" -n1 -s" end if if run_waitkey or ends(" -e", terminal_program) then cmd = quote_spaces(cmd) end if cmd = terminal_program & ' ' & cmd end if if run_background then cmd &= " &" end if system(cmd) terminal_program = prev_term --<=== end procedure -- function RunStart(atom ctl) function RunStart(atom ctl) object lbl = gtk:get(ctl, "label") sequence cmd = "" integer wk = 0 --<=== run_waitkey switch back flag -- -- elsif equal(lbl, "Translate and Compile") then --<===------------------------------ if run_waitkey = 0 then run_waitkey = 1 wk = 1 --< set switch back flag end if --<===------------------------------- cmd &= get_eu_bin("euc") & ' ' & quote_spaces(file_name) if system_exec("which upx") = 0 then cmd &= " && upx " & filebase(file_name) end if if run_testrun then cmd &= " && ./" & filebase(file_name) end if Run(cmd) --<====--------------------------------------- if wk then -- switch run_waitkey back to 0 run_waitkey = 0 end if --<===---------------------------------------
6. Re: WEE-41 UPX fail on Ubuntu 15.10 64-bit
- Posted by PeteE Dec 23, 2015
- 1537 views
I suspect this is a problem with trying to pass multiple commands to the terminal emulator. I think the better solution is to put the commands in a temporary script and let the terminal emulator run that. That way it shows all the output from every command before prompting to press a key. It should also work with any terminal emulator. I've made version .42 for you to test.
Forked into: WEE-42 Run Terminal Focus doesn't follow current file