Linux vs Windows compile gives different results

Posted by rlegere on 20-Aug-2015 10:25

Hi,

I have the following snippet of code that compiles in character base (Linux box) but will not compile using OpenEdge on windows. We are trying to move from character base to using OpenEdge and all it's helpful functionality but when doing full recompiles of our code we have some programs that aren't compiling anymore.

def stream str.

input stream str through value("ps -ef | awk '\{print $2\}' | grep -q " + string("blabla") + " 2> /dev/null; echo $?").

Other than changing the code is there a setting in OpenEdge to work similar to our Linux box?

Any help will be appreciated.

All Replies

Posted by James Palmer on 20-Aug-2015 10:29

The issue is the { before print. Change it to '\~{print $2\}' and it compiles ok. I'm not really sure why it should compile ok on Linux, but I'm not aware of any way around this.

Posted by marcv on 20-Aug-2015 10:31

Those commands are not native to Windows. Do you have a unix tool set installed on the the Windows server?

Posted by TheMadDBA on 20-Aug-2015 11:02

You will have to change the code. The backslash is supported as an escape character on UNIX/LINUX platforms but can't be treated that way on Windows since it is the directory separator.

The tilde(~) is the universal escape character that works on both platforms. I am pretty sure the backslash as an escape character predated the first version of Progress for Windows and probably the existence of Windows itself.

See the ABL Reference documentation for the various special characters.

Posted by gus on 20-Aug-2015 11:13

backslash as an escape character comes from UNIX early 70's. Predates DOS and Progress too.

Posted by Peter Judge on 20-Aug-2015 11:27

Of course, but in this case it's the progress compiler that's confused. The backslash in a quoted string means nothing.

message "\abc" prints \abc  (as it should).

Posted by TheMadDBA on 20-Aug-2015 12:22

That I knew :-)

I was just talking about the Progress implementation of the backslash as an escape character. I didn't use V1-V3 so I didn't know which exact version it showed up in.

Posted by willer on 20-Aug-2015 12:23

Hi,

in an OERA approach you should better do an extra "list_tasks.sh" or call it "list_task.bat" with the wished parameters. $1 and $2 or what you want. So for the future it's never a progress compile problem anymore, when you would liek to move to anyOS.

Posted by Simon L. Prinsloo on 20-Aug-2015 14:02

No, it is not confused. The compiler will interpret the { inside and outside code. It will try to do a compile time substitution (positional parameter, compiler constant or include file) regardless of the presence of quotes.

It is quite valid to do this in an include:

MESSAGE "{1}" ...

In the example above, the { inside the quotes is the problem. The original developer got around the problem by escaping it with with "\", which is valid in *NIX only, but not on Windows. "~" will always work.

This thread is closed