Page 1 of 2
c:version bug
Posted: Tue Jan 15, 2013 1:37 pm
by lazi
Something wrong with OS4 version command.
It affects at least the Hollywood created applications. The correct $VER:blabla text is in the file, but can't supply version information for the version command or for rawbinfo.
Here is how I compared it with the old version from OS3.1:
6.RAM Disk:> wget *>NIL:
http://www.os4depot.net/share/graphics/ ... howgeo.lha showgeo.lha -O showgeo.lha
6.RAM Disk:> lha x -N showgeo.lha
Extracting from archive 'showgeo.lha':
9 files extracted, all files OK.
Operation successful.
6.RAM Disk:> version ShowGeo/showgeo full
VERSION: Could not find version information for "ShowGeo/showgeo".
6.RAM Disk:> classic:wb/c/version ShowGeo/showgeo full
ShowGeo 1.1 (2013.01.03.)
6.RAM Disk:>
Here is the version's of the version commands:
7.RAM Disk:> version c:version full
Version 53.5 (2011.02.19.)
7.RAM Disk:> version classic:wb/c/version full
Version 44.4 (1999.09.30.)
7.RAM Disk:>
(Maybe that is not an official Version

Re: c:version bug
Posted: Tue Jan 15, 2013 3:15 pm
by tbreeden
6.RAM Disk:> version ShowGeo/showgeo full
VERSION: Could not find version information for "ShowGeo/showgeo".
6.RAM Disk:> classic:wb/c/version ShowGeo/showgeo full
ShowGeo 1.1 (2013.01.03.)
Maybe the embedded version needs a null byte at the beginning.
I had not seen the announcement, but at some point the AOS 4
version command began requiring that the embedded version string be bracketed by null bytes.
I found the same thing in my
Modula-2 programs until I realized what was happening.
Here is one definition of the requirement:
OpenAmiga doc
Tom
Aglet M2
Re: c:version bug
Posted: Tue Jan 15, 2013 8:10 pm
by xenic
tbreeden wrote:
Maybe the embedded version needs a null byte at the beginning.
I had not seen the announcement, but at some point the AOS 4
version command began requiring that the embedded version string be bracketed by null bytes.
I found the same thing in my
Modula-2 programs until I realized what was happening.
Here is one definition of the requirement:
OpenAmiga doc
Tom
Aglet M2
I don't think that requirement is completely true. It may be true of compiled programs but version strings also work in text files. I have numerous AmigaDOS scripts and ARexx scripts that contain version strings and work with the version command. I HEX edited the "showgeo" file and added NULL bytes before and after the version string and the OS4 version command still didn't find it.
This "version command" issue was discussed in a forum at one of the major Amiga WEB sites a long time ago. The conclusion at that time was that the version string could not be near the bottom of a large file or it will not work with the OS4 version command. To test that hypothesis, I HEX edited the ShowGeo file and placed a version string further from the end of the file. Unfortunately, I created a file that causes the "OS4 version command" to crash! In order to confirm the version command crash I HEX edited the "C:Avail" command and removed about half of the file from the center of the command; yielding a file about half the size of the original. The OS4 version command crashes on that file too. I tried to attach the file so others could confirm the problem but uploading an attachment in this forum won't work for me. To confirm the problem just cut a couple of hundred bytes from the center of the "Avail" command and run the version command on it.
Re: c:version bug
Posted: Tue Jan 15, 2013 8:54 pm
by lazi
@Xenic:
I made similar tests with the same results.
The Hollywood generated executable links the applet to the end of the code which is far from the beginning of the file.
I think that it shouldn't be a problem for Version.
@tbreeden:
Thanks to point out to the docs. It looks like it accepts a CR too for the end of the string.
Re: c:version bug
Posted: Tue Jan 15, 2013 10:39 pm
by gazelle
@lazi:
I think it's because version uses LoadSeg() for executeable files to load them into memory. The old version command doesn't understand the ELF format, so it does use a different approach.
Maybe if you are assigning the versionstring to an actual variable inside the program it may work.
@xenic:
If you destroy the structure of the executable file, who knows what the LoadSeg() will do.
Re: c:version bug
Posted: Wed Jan 16, 2013 1:24 am
by xenic
gazelle wrote:@lazi:
I think it's because version uses LoadSeg() for executeable files to load them into memory. The old version command doesn't understand the ELF format, so it does use a different approach.
Maybe if you are assigning the versionstring to an actual variable inside the program it may work.
@xenic:
If you destroy the structure of the executable file, who knows what the LoadSeg() will do.
Regardless, it shouldn't crash. If it does use LoadSeg() then both LoadSeg() and the Version command need some additional error checking. This needs to go into the bug tracker. Files from other OS's are common now and it wouldn't be unusual to D/L a corrupt file.
Re: c:version bug
Posted: Mon Jan 21, 2013 9:57 am
by lazi
gazelle wrote:
I think it's because version uses LoadSeg() for executeable files to load them into memory. The old version command doesn't understand the ELF format, so it does use a different approach.
Maybe if you are assigning the versionstring to an actual variable inside the program it may work.
I do not know about the ELF format, but the problem look like that the Hollywood linker put the script after the scope of version. The script is whereabouts the Hollywood "coder" can put anything.
So if it is the intended behaviour of version to check only the code chunk, then Hollywood needs to hold some place in the interpreter code part for version string which the linker could alter. I don't think that Hollywood author would love to do that.
In the other case if version should check the entire file then it is a bug.
Anyway the OpenAmiga doc said this:
To add a version string to your program you must make sure that the binary contains a string of characters that represent the version string. All version tools then parse your binary, byte by byte, to find the version string that you have defined for it.
How can we define "binary" in this context?
Re: c:version bug
Posted: Mon Jan 21, 2013 12:47 pm
by tonyw
How can we define "binary" in this context?
Probably "binary" means a file which contains stuff that you can't control, like headers and checksums.
I've looked at the code for C:Version and I can assure you that it knows nothing about where in the file it is looking. It relies on DOS to LoadSeg() the file first. If the file can't be loaded fully or if the Version string is in a part of the file that is not loaded as executable code, then it won't be found.
If someone can provide a crash log for the failing case, I'll look into it. Give me the crash log or the binary of a file that causes C:Version to crash.
Re: c:version bug
Posted: Tue Jan 22, 2013 12:43 am
by xenic
@tonyw
I've looked at the code for C:Version and I can assure you that it knows nothing about where in the file it is looking. It relies on DOS to LoadSeg() the file first. If the file can't be loaded fully or if the Version string is in a part of the file that is not loaded as executable code, then it won't be found.
If someone can provide a crash log for the failing case, I'll look into it. Give me the crash log or the binary of a file that causes C:Version to crash.
Considering the size of programs for OS4 now (RA-OWB 18+ megabytes) it's absurd to LoadSeg() entire programs just to find a version string in the first couple of hundred bytes (in most cases). Apparently it also leads to the kind of proglems we are having with the OS4 version command. I've replaced mine with the OS3 version command. Here is a crashlog for the version command used on the OS4 Avail command with Hex bytes 0x44 through 0x49 corrupted:
If you want the binary (corrupt Avail command) you will need to tell me how to get it to you.
Re: c:version bug
Posted: Tue Jan 22, 2013 9:45 am
by ktadd
tonyw wrote:
I've looked at the code for C:Version and I can assure you that it knows nothing about where in the file it is looking. It relies on DOS to LoadSeg() the file first. If the file can't be loaded fully or if the Version string is in a part of the file that is not loaded as executable code, then it won't be found.
Just today....errr....yesterday now. I wrote a routine for my program using LoadSeg() to check the version of MPlayer. This method is a bit slow. Is there a better way to do it?