[CentOS] How to change an executable into a directory
William L. Maltby
CentOS4Bill at triad.rr.com
Tue Dec 30 19:09:13 UTC 2008
On Tue, 2008-12-30 at 10:36 -0800, MHR wrote:
> On Tue, Dec 30, 2008 at 10:09 AM, Kai Schaetzl <maillists at conactive.com> wrote:
> > Mhr wrote on Tue, 30 Dec 2008 09:57:11 -0800:
> >> I just discovered that a couple of files on my system are ELF
> >> executables when they should be directories. How do I change a file
> >> into a directory? I don't think I've ever run into this one
> >> before....
> > I think you should really explain that a bit.
> Yes, quite.
> I save a fair number of web pages (receipts, bill payments, etc.) for
> what should be obvious reasons.
> Usually, these come down as an html file and a directory (of "sub-html" files).
> I have two files that correspond to two html files in the right file
> name format that seem as though they should be the _files directories,
> but they are ELF files:
> [mrichter at swordfish mhrdocs]$ file *_files
> chv81128_files: ELF 32-bit LSB shared object, Intel 80386, version 1
> (SYSV), stripped
> chX81125_files: ELF 32-bit LSB shared object, Intel 80386, version 1
> (SYSV), stripped
Since "file" works by examining a few initial bytes/lines, it can be
fooled. You might want to examine them by "strings" or, if they really
are executables, readelf. This might give a clue as to what went wrong.
I know when I save web pages a related directory is created that
contains images and whatnot that are referenced by the page. I presume
this is what you expected?
AFAIK there is no way to make a directory out of a file on Linux (unlike
real UNIX(TM) which has "standard" i-nodes regardless of file or
directory being mapped).
How did it happen? I could only guess that something ran removed the
directory and put a file there or something in the save process went
awry and made a file, possibly the real files concatenated.
If you can see the structure of the file, maybe some kind of manual edit
will let you break out the files.
If there's images of various types in there, I wouldn't bet on it.
> [mrichter at swordfish mhrdocs]$ ll *_files
> -r--r--r-- 1 mrichter RnD 596460 May 29 2008 chv81128_files
> -r--r--r-- 1 mrichter RnD 43756 May 29 2008 chX81125_files
See what readelf says about those files.
> These correspond to two html files which do not display correctly
> (because the files that are supposed to be in those directories are
> not because the directories appear to be executables. I don't really
> think I want to try running them....
> So, is there a way to change a file into a directory? Or am I crazy?
Not mutually exclusive are they? ;-)
No way that I know of. The rename, mkdir, manual breakout is the only
possible way I can envision ATM.
> <snip sig stuff>
More information about the CentOS