Re: Case un-sensitive filetypes

On Sun, 6 Jan 2008 15:28:47 +1100
<tpgww@xxxxxxxxxxx> wrote:

> On Sat, 5 Jan 2008 19:10:20 -0800 (PST)
> Caballero Rojo <pampeano@xxxxxxxxxxxxxx> wrote:
> 
> > Hi all, just a little patch in case anyone moves files from windows to
> > linux like me, I usually end up with some files with upper case.
> > I modified e2_filetype_get_default_action function in e2_filetype.c,
> > adding ext = g_utf8_strdown(ext,-1); before calling
> > g_hash_table_lookup. That converts file extention to lower case and
> > then goes to compare. I hope someone can tell me if I should allocate a
> > new gchar to get the result of that function, since regarding to the
> > manual, it allocates new space to return, that would make the first
> > reference of ext to get lost.
> > Hope this helps.
> > Keep up with emelfm2, it's the best norton commander style fm that I
> > found on Linux.
> > 
> > Best regards,
> >     Guillermo Bonvehí
> 
> Thanks Guillermo. These sorts of contributions are always welcome.
> 
> The problem you're addressing has been discussed before. In summary, there's 
> no good solution (well, unless we go to mime-type management or something) 
> that meets everyone's needs, except to determine at runtime which 
> file-systems are case-insensitive, and only in such cases would you ignore 
> case of the filetype.
> 
> IIRC there's not many fs's that are insensitive - maybe only FAT* and one old 
> one from Apple? Does any of you have, or can any of you discover, a 
> comprehensive list of case-insensitive fs's?
> 
> If the situation could be confirmed, then I think it would be easy enough to 
> check the fs type and then apply the sort of masking that you propose. But 
> otherwise, I'm quite reluctant to make such change, at risk of breaking the 
> reasonable expectations of users of a case-sensitive fs.

Now I have ...

/**
@brief check whether the filesystem associated with @a view uses 
case-senssitive paths/names

MS-DOS/Windows FAT* are case-insensitive, but so-called "long" names are
case-preserving.
NTFS can be fully case sensitive or just case preserving.
Classic Mac OS was case-insensitive but case-preserving. HFS+ on Mac OS X is
probably the same. Mac HFSX is fully case senstive.
Samba servers usually exhibit case-insensitive behaviour, regardless of the
actual fs properties.
For our purposes here, probably best to treat treat -preserving as -sensitive, 
except for FAT.

@param view pointer to view data struct

@return TRUE if paths/names are case-sensitive (usually the case)
*/
gboolean e2_fs_mount_is_cased (ViewInfo *view)
{
 <code omitted>
}

In some cases, the name of a filesystem, as expressed in fstab/mtab, is needed 
for the test. Here, for windows it's "vfat", but I hove no idea whether that's 
distro-specific or linux-specific. Samba gets what ? Too bad about the "auto" 
values ... All feedback welcome.

AND this discovery process is a bit "expensive", so the property is cached, and 
that creates a new dilemma, how to determine which devices are removable (in 
which case cacheing is too risky), for all supported OS's. Linux could do 
hal/dbus, at a cost of imposing extra dependencies for building/using e2. Some 
other OS's also have hal, but I've no idea how to implement it. Again, all 
contributions welcome.

Regards
Tom


--
Users can unsubscribe from the list by sending email to 
emelfm2-request@xxxxxxxxxxxxx with 'unsubscribe' in the subject field or by 
logging into the web interface.

Other related posts: