From nobody@FreeBSD.org  Sat Feb 10 16:18:46 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 581D216A408
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 10 Feb 2007 16:18:46 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 47D2C13C471
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 10 Feb 2007 16:18:46 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l1AGIjO2006946
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 10 Feb 2007 16:18:45 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l1AGIjGO006944;
	Sat, 10 Feb 2007 16:18:45 GMT
	(envelope-from nobody)
Message-Id: <200702101618.l1AGIjGO006944@www.freebsd.org>
Date: Sat, 10 Feb 2007 16:18:45 GMT
From: Rechistov Grigory<ggg_mail@inbox.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: mount_msdosfs: msdosfs_iconv: Operation not permitted
X-Send-Pr-Version: www-3.0

>Number:         109024
>Category:       kern
>Synopsis:       [msdosfs] [iconv] mount_msdosfs: msdosfs_iconv: Operation not permitted
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-fs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 10 16:20:15 GMT 2007
>Closed-Date:    Tue Apr 17 09:46:58 UTC 2012
>Last-Modified:  Tue Apr 17 09:46:58 UTC 2012
>Originator:     Rechistov Grigory
>Release:        6.2-STABLE
>Organization:
>Environment:
FreeBSD ipv82-180.rt.private.mipt.ru 6.2-STABLE FreeBSD 6.2-STABLE #3: Thu Jan 25 15:50:36 MSK 2007     GGG@ipv82-180.rt.private.mipt.ru:/usr/obj/usr/src/sys/DELL_v4  i386

>Description:
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.
>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.
>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)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: maxim 
State-Changed-When: Sat Feb 10 18:38:55 UTC 2007 
State-Changed-Why:  
Preloading msdosfs_iconv.ko at startup e.g. via /boot/loader.conf  
should help. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109024 

From: Alexander Pyhalov <alp@rsu.ru>
To: bug-followup@FreeBSD.org, ggg_mail@inbox.ru
Cc:  
Subject: Re: kern/109024: [msdosfs] mount_msdosfs: msdosfs_iconv: Operation
 not permitted
Date: Thu, 21 Jun 2007 16:49:06 +0400

 <!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>
 

From: Remko Lodder <remko@FreeBSD.org>
To: Alexander Pyhalov <alp@rsu.ru>
Cc: freebsd-bugs@FreeBSD.org,  freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/109024: [msdosfs] mount_msdosfs: msdosfs_iconv: Operation
 not permitted
Date: Thu, 21 Jun 2007 18:19:54 +0200

 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 */

From: Alexander Pyhalov <alp@rsu.ru>
To: bug-followup@FreeBSD.org, ggg_mail@inbox.ru
Cc:  
Subject: Re: kern/109024: [msdosfs] mount_msdosfs: msdosfs_iconv: Operation
 not permitted
Date: Fri, 22 Jun 2007 09:18:37 +0400

 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.
 
 
State-Changed-From-To: closed->open 
State-Changed-By: linimon 
State-Changed-When: Fri Jun 22 08:07:29 UTC 2007 
State-Changed-Why:  
Reopen at submitter request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109024 
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon May 18 04:30:20 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109024 
State-Changed-From-To: open->closed 
State-Changed-By: kevlo 
State-Changed-When: Tue Apr 17 09:45:06 UTC 2012 
State-Changed-Why:  
I believe that with recent HEAD and releases of 8 and 9  
that this is no longer true. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=109024 
>Unformatted:
