extfs: make the open_archive stat() optional

Pavel Roskin proski at gnu.org
Fri Dec 6 17:32:41 UTC 2002


Hello!

> Here is a patch that removes the need of the ':' within the extfs.ini and
> also handles the stat() failure conveniently.

This patch makes the code less reliable.  We know that some filesystems
always need a valid archive and some filesystems never need it.  There are
no filesystems that use an archive optionally.

Your patch derives the properties of the filesystem from the existence of
a file with a certain name.  That the wrong approach.  The properties of
an extfs filesystem are encoded in the corresponding script.

What if the archive disappears for some other reason?  What if the archive
name is used in an "archiveless" filesystem and that file happens to
exist?

The right solution would be to avoid mc_stat() in the "archiveless"
filesystems.

By the way, please don't use C++ comments in C code.

Answering your other e-mail, that's an example how to split the drive name
from path using sed:

#!/bin/sh
fullpath=/a/dos/format.com
drive=`echo $fullpath | sed 's,^/\([a-z]\)/.*$,\1,'`
path=`echo $fullpath | sed 's,^/[a-z]\(/.*\)$,\1,'`
if test -z "$drive"; then
    exit 1
fi
echo "drive=$drive"
echo "path=$path"

-- 
Regards,
Pavel Roskin



More information about the mc-devel mailing list