From: drew@hamlet.cs.colorado.edu (Drew Eckhardt) Subject: Re: executing files on msdos filesystem + more'ing 8bit files Date: Fri, 25 Sep 1992 21:28:00 GMT
In article <shrchin.717402196@reading> shrchin@csug.cs.reading.ac.uk (Jonathan H. N. Chin) writes:
>Sorry if I sound stupid. I got the bash and kernel sources, but I don't know
>where to look; don't even know if it is anything to do with bash in the first
>place.
>
>Basically, if I mount an msdos filesystem, ie. an unmodified dos HD, what is
>the reason that I get "<filename>: cannot execute binary file" if I try to
>execute a file (I mean a linux binary, not a DOS one of course)?
Linux demand pages all executables. When a program tries
to access a page flagged as not present, a page fault is triggered
by the MMU. The kernel recieves this interrupt, computes
where that page is in the file, and uses the bmap() function of
the file system code to convert those blocks in the file to
absolute disk blocks.
However, MS-DOS file systems that have blocks that are not aligned on
1K boundaries do not support the bmap function, and consequently
you cannot run programs from such file systems.
>If I cp, say, "sync" from /bin onto a directory on the msdos filesystem and
>chmod +x then run, I get the above error. If I then cp it onto a directory on
>the root partition it will run again.
>
>Is it something inherent in the msdos filesystem that disallows binaries to be
>run, or is it something else?
Yes, when blocks are not aligned to 1K boundaries.
>The second thing is that, perversely, I tried to list the files in /etc/lilo
>using more. As expected, I got garbage printed to the screen. However upon
>returning me to the prompt, the garbage remained: extended ascii characters
>(mostly graphics stuff) instead of alphabetics. Numerics did not seem to be
>affected. Is this due to some known feature (a parallel to ansi.sys say)
>or something else?
>
If you cat binaries to the screen, you could get control codes that
send the console into some mode, such as the VT-100 graphics mode.
-- Microsoft is responsible for propogating the evils it calls DOS and Windows, IBM for AIX (appropriately called Aches by those having to administer it), but marketing's sins don't come close to those of legal departments. Boycott AT&T for their absurd anti-BSDI lawsuit.