Bug 225389 - mount_msdosfs: msdosfs_iconv: Operation not permitted
Summary: mount_msdosfs: msdosfs_iconv: Operation not permitted
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 11.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-22 21:15 UTC by aeuii
Modified: 2018-05-11 15:02 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description aeuii 2018-01-22 21:15:30 UTC
"mount_msdosfs: msdosfs_iconv: Operation not permitted" occurs when mounting mounting msdosfs with flags "-L=en_GB.UTF-8".

I confirmed can confirm it on 11.1-RELEASE-p6 and in a VirtualBox using FreeBSD-11.1-RELEASE-amd64.vhd image.

Environment and steps to reproduce:

% uname -a
FreeBSD myhost 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64


% locale
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_ALL=en_GB.UTF-8


% cat /boot/loader.conf | grep iconv
msdosfs_iconv_load="YES"
libiconv_load="YES"


% cat /etc/fstab | grep UTF-8
/dev/da1        /home/myuser/mnt/u0      msdosfs rw,noauto,noexec,-L=en_GB.UTF-8,-m=600,-M=700   0       0
/dev/da1s1      /home/myuser/mnt/u1      msdosfs rw,noauto,noexec,-L=en_GB.UTF-8,-m=600,-M=700   0       0


% sysctl vfs.usermount
vfs.usermount: 1



% cat /etc/rc.conf | grep kiconv
kiconv_preload="YES"
kiconv_local_charset="UTF-8"
kiconv_foreign_charset="UTF-16BE UTF-8"
kiconv_fstypes="msdosfs"


% pkg info|grep kiconv
kiconvtool-0.98                Tool to preload kernel iconv charset tables



** initially loaded tables

% kiconvtool -d
UTF-8 -> UTF-16BE
UTF-16BE -> UTF-8


** try to mount as a regular user

% mount /home/user/mnt/u1
mount_msdosfs: msdosfs_iconv: Operation not permitted



** mount fs as root

# mount /home/user/mnt/u1
# umount /home/user/mnt/u1


** tables after root mounted the fs

% kiconvtool -d
UTF-8 -> UTF-16BE
UTF-16BE -> UTF-8
UTF-8 -> _wctype


** now a regular user can mount too

% mount /home/user/mnt/u1
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2018-01-23 23:30:44 UTC
On HEAD the tool does seem to load the _wctype table when loading that pair:

$ kiconvtool -d
UTF-8 -> UTF-16BE
UTF-16BE -> UTF-8

$ kiconvtool -p UTF-8:UTF-16BE

$ kiconvtool -d
UTF-8 -> UTF-16BE
UTF-16BE -> UTF-8
UTF-8 -> _wctype

It looks like some layer is missing needed UTF-8 -> _wctype table in 11.x.  It doesn't seem possible to manually load this pair with kiconvtool:

$ kiconvtool -p UTF-8:_wctype
kiconvtool: kiconv_add_xlat16_cspairs(UTF-8:_wctype): Invalid argument
Comment 2 Conrad Meyer freebsd_committer freebsd_triage 2018-01-23 23:34:38 UTC
Hm, I believe kiconvtool should already be loading the wctype table explicitly here:

https://github.com/AMDmi3/kiconvtool/blob/master/kiconvtool.c#L166

So I am confused.
Comment 3 Dmitry Marakasov freebsd_committer freebsd_triage 2018-05-08 13:15:43 UTC
> kiconv_local_charset="UTF-8"
> kiconv_foreign_charset="UTF-16BE UTF-8"

This is incorrect, it should be "*_charsets", not "*_charset". For some reason I've had the same problem in my config, which is strange as all the docs do mention "*_charsets".