Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3AA2451A.24DE1704@phekda.freeserve.co.uk> Date: Sun, 04 Mar 2001 13:37:30 +0000 From: Richard Dawe X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.17 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: DJGPP workers Subject: Fileutils 4.0 port and ginstall Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Eli, a while back you told me of a bug in ginstall from Fileutils. Here is what you said: "There is a problem with `install': if you say something like "install foo /bin/foo", and `foo' already has a stub loader prepended to it, you get `foo' installed in the target directory instead of `foo.exe'. I think `install' should be changed to make sure that executable files in the target directory have an executable extension (can be .com or .bat, in addition to .exe), since otherwise stock DOS shells will refuse to run them." I've fixed the problem with stubbed COFF exectuables with no file extension, i.e.: ginstall a b now creates b.exe not b, if a is a stubbed COFF exe. It also now handles non-COFF executables in the same way, e.g. ginstall c:/windows/command.com b creates b.exe. I haven't yet written code to distinguish between .exe and .com formats. I am unsure how to decide that a file is a DOS batch file. The patches to ginstall for DJGPP currently modify the target filename, depending on the source file's file format. Here's some pseudo-code: if (_check_v2_prog returns valid data) { if (unstubbed COFF) { stubify append .exe to target filename } else if (stubbed COFF) { append .exe to target filename } else { if (file header contains "MZ") { /* FIXME: Distinguish between .exe and .com */ append .exe to target filename } } Target filenames for Unix scripts (.sh, .pl, ones using hash-bang notation, etc.) will be passed straight through, which seems like correct behaviour. Can I assume that a non-MZ file is a batch file in the outer else clause? That is, if a file does not have valid _check_v2_prog() data and is not an MZ executable, must it be a batch file? It seems to me that this is a bad assumption - which batch file extension should be used? .bat, .cmd, etc.? I don't think batch can be treated correctly automatically and it should be down to the user to sort it out. How many people use ginstall to install batch files anyway? Should _check_v2_prog() succeed on ordinary DOS executables such as command.com? _check_v2_prog() from 2.03 seems to fail for me. Out of interest, has anyone been testing alpha 2 of Fileutils that I prepared in October last year? See: http://www.phekda.freeserve.co.uk/richdawe/djgpp/fileutils I've been using it for several months and it seems to work OK. Once I've finished working on ginstall, I'll test dd, SFN builds and then I think Fileutils 4.0 port is ready for a beta. Please note that I'm targetting building with DJGPP 2.03. I think using DJGPP CVS's new goodies will be quite some work. Bye, Rich =] -- Richard Dawe http://www.bigfoot.com/~richdawe/ "The soul is the mirror of an indestructible universe." --- Gottfried W. Leibniz