Bug 109024 - [msdosfs] [iconv] mount_msdosfs: msdosfs_iconv: Operation not permitted
Summary: [msdosfs] [iconv] mount_msdosfs: msdosfs_iconv: Operation not permitted
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 6.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-10 16:20 UTC by Rechistov Grigory
Modified: 2012-04-17 10:46 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rechistov Grigory 2007-02-10 16:20:15 UTC
I want to use automounter application thunar-volman (Xfce desktop)
powered by HAL. I have a line in my /etc/fstab, which corresponds to my
flash drive: 

/dev/da0s1              /mnt/FLASH0     msdosfs rw,noauto,-u=GGG,-L=ru_RU.KOI8-R,-D=CP866       0       0

but when I plug it in an error appears: mount_msdosfs: msdosfs_iconv:
Operation not permitted. I have sysctl vfs.usermount set to 1, kernel
modules msdosfs.ko and msdosfs_iconv.ko loaded. So I try to mount the
device by hand as an ordinary user:

$ mount -t msdosfs -o-L=ru_RU.KOI8-R,-D=CP866 /dev/da0s1 /mnt/FLASH0

all rights on folder are set correctly so I should be able to perform
the operation. But the same error raises. When I try to mount cd9660 and
ntfs volumes with "-C koi8-r" option everything is just fine (though they
perform  different conversion from unicode). When I try to mount the same
msdosfs disk without any locale options - it works. When mount_msdosfs
is run from root user - no errors. So the problem is somewhere in kernel
iconv mechanism.

Fix: 

The only way to continue use the automounter in this case is to set suid
bit to mount_msdosfs. This is not the very best solution obviously. In
my case there is also a bug in exo-mount (program which actually calls
mount program - it handles HAL specification in incomplete way, elsewhere
there would have been a elegant and robust workaround, I've also sent a
PR to developers)
How-To-Repeat: [check that sysctl vfs.usermount is set to 1, and mountpoint is owned by user]
$ mount -t msdosfs -o-L=ru_RU.KOI8-R,-D=CP866 /dev/da0s1 /mnt/FLASH0
mount_msdosfs: msdosfs_iconv: Operation not permitted
$ mount -t msdosfs /dev/da0s1 /mnt/FLASH0
This works fine.
Comment 1 Maxim Konovalov freebsd_committer freebsd_triage 2007-02-10 18:38:55 UTC
State Changed
From-To: open->closed

Preloading msdosfs_iconv.ko at startup e.g. via /boot/loader.conf  
should help.
Comment 2 Alexander Pyhalov 2007-06-21 13:49:06 UTC
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor=3D"#ffffff" text=3D"#000000">
<font face=3D"Courier New, Courier, monospace">Bug was wrongly closed,
because with loaded module msdosfs_iconv.ko mount says mount_msdosfs:
msdosfs_iconv: Operation not permitted. <br>
The reason, as I understand, is in kiconv. If you compile and run the
following code at sturtup=9A ( you should run it as root, for example,
using rc.d), everything works correctly.<br>
<br>
#include &lt;sys/stat.h&gt;<br>
#include &lt;stdio.h&gt;<br>
#include &lt;sys/iconv.h&gt;<br>
<br>
int main()<br>
{<br>
=9A=9A=9A=9A=9A=9A=9A int er;<br>
=9A=9A=9A=9A=9A=9A=9A er=3Dkiconv_add_xlat16_cspairs("UTF-16BE", "UTF-8")=
;<br>
=9A=9A=9A=9A=9A=9A=9A if(er)<br>
=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A printf("Er=3D%d\n",er);<br>=

=9A=9A=9A=9A=9A=9A=9A er=3Dkiconv_add_xlat16_cspairs("cp866","UTF-8");<br=
>
=9A=9A=9A=9A=9A=9A=9A if(er)<br>
=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A=9A printf("Er2=3D%d\n",er);<br=
>
=9A=9A=9A=9A=9A=9A=9A return 0;<br>
}<br>
<br>
<br>
</font>
<pre class=3D"moz-signature" cols=3D"72">--=20
=F3 =D5=D7=C1=D6=C5=CE=C9=C5=CD,=20
=E1=CC=C5=CB=D3=C1=CE=C4=D2 =F0=D9=C8=C1=CC=CF=D7,
=D3=C9=D3=D4=C5=CD=CE=D9=CA =C1=C4=CD=C9=CE=C9=D3=D4=D2=C1=D4=CF=D2 =E0=E7=
=E9=EE=E6=EF =E0=E6=F5.
</pre>
</body>
</html>
Comment 3 Remko Lodder freebsd_committer freebsd_triage 2007-06-21 17:19:54 UTC
Alexander Pyhalov wrote:
> The following reply was made to PR kern/109024; it has been noted by GNATS.
> 

Hello, your mailer messed up, please reply without HTML text so that
the output is readable and we might be able to use the information
you provided. Thanks for the reply though!

-- 
Kind regards,

     Remko Lodder               ** remko@elvandar.org
     FreeBSD                    ** remko@FreeBSD.org

     /* Quis custodiet ipsos custodes */
Comment 4 Alexander Pyhalov 2007-06-22 06:18:37 UTC
Bug was wrongly closed, because with loaded module msdosfs_iconv.ko=20
mount says mount_msdosfs: msdosfs_iconv: Operation not permitted.
The reason, as I understand, is in kiconv. If you compile and run the=20
following code at startup  ( you should run it as root, for example,=20
using rc.d), everything works correctly.

#include <sys/stat.h>
#include <stdio.h>
#include <sys/iconv.h>

int main()
{
        int er;
        er=3Dkiconv_add_xlat16_cspairs("UTF-16BE", "UTF-8");
        if(er)
                printf("Er=3D%d\n",er);
        er=3Dkiconv_add_xlat16_cspairs("cp866","UTF-8");
        if(er)
                printf("Er2=3D%d\n",er);
        return 0;
}


--=20
=F3 =D5=D7=C1=D6=C5=CE=C9=C5=CD,=20
=E1=CC=C5=CB=D3=C1=CE=C4=D2 =F0=D9=C8=C1=CC=CF=D7,
=D3=C9=D3=D4=C5=CD=CE=D9=CA =C1=C4=CD=C9=CE=C9=D3=D4=D2=C1=D4=CF=D2 =E0=E7=
=E9=EE=E6=EF =E0=E6=F5.
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2007-06-22 09:07:29 UTC
State Changed
From-To: closed->open

Reopen at submitter request.
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2009-05-18 05:30:20 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 7 Kevin Lo freebsd_committer freebsd_triage 2012-04-17 10:45:06 UTC
State Changed
From-To: open->closed

I believe that with recent HEAD and releases of 8 and 9  
that this is no longer true.