Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 205901 - sys-apps/hal-0.5.10 : breaks ntfs usb storage mount under KDE
Summary: sys-apps/hal-0.5.10 : breaks ntfs usb storage mount under KDE
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor with 1 vote (vote)
Assignee: Tony Vroon
URL: https://bugs.freedesktop.org/show_bug...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-14 22:31 UTC by Guillaume ZITTA
Modified: 2009-10-30 09:12 UTC (History)
12 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix ntfs mount (hal-ntfs-mount.patch,725 bytes, patch)
2008-09-19 11:27 UTC, Ambroz Bizjak
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume ZITTA 2008-01-14 22:31:50 UTC
After upgrade to hal-0.5.10, I could not open my NTFS HD automaticaly with KDE 3.5.8

Reproducible: Always

Steps to Reproduce:
1.Use kde
2.plug an ntfs usb hard drive
3.

Actual Results:  
Amessage box : "TODO: HAVE TO RETHINK EXTRA OPTIONS"

Expected Results:  
Open my HD in konqueror

I found that the message is from a portion of code in tools/hal-storage-mount.c :

was 

	/* Check privilege */
	pol_is_fixed = TRUE;
	if (libhal_drive_is_hotpluggable (drive) || libhal_drive_uses_removable_media (drive))
		pol_is_fixed = FALSE;

	pol_change_uid = FALSE;
	/* don't consider uid= on non-pollable drives for the purpose of policy 
	 * (since these drives normally use vfat)
	 */
	if (volume != NULL) {
		/* don't consider uid= on vfat, iso9660, udf change-uid for the purpose of policy
		 * (since these doesn't contain uid/gid bits) 
		 */
		if (strcmp (libhal_volume_get_fstype (volume), "vfat") != 0 &&
		    strcmp (libhal_volume_get_fstype (volume), "iso9660") != 0 &&
		    strcmp (libhal_volume_get_fstype (volume), "udf") != 0) {
			pol_change_uid = wants_to_change_uid;
		}
	}

	if (pol_is_fixed) {
		if (pol_change_uid) {
			privilege = "hal-storage-fixed-mount-all-options";
		} else {
			privilege = "hal-storage-fixed-mount";
		}
	} else {
		if (pol_change_uid) {
			privilege = "hal-storage-removable-mount-all-options";
		} else {
			privilege = "hal-storage-removable-mount";
		}
	}

is now :

	/* Check privilege */
	pol_is_fixed = TRUE;
	if (libhal_drive_is_hotpluggable (drive) || libhal_drive_uses_removable_media (drive))
		pol_is_fixed = FALSE;

	pol_change_uid = FALSE;
	/* don't consider uid= on non-pollable drives for the purpose of policy 
	 * (since these drives normally use vfat)
	 */
	if (volume != NULL) {
		/* don't consider uid= on vfat, iso9660, hfs and udf change-uid for the purpose of policy
		 * (since these doesn't contain uid/gid bits) 
		 */
		if (strcmp (libhal_volume_get_fstype (volume), "vfat") != 0 &&
		    strcmp (libhal_volume_get_fstype (volume), "iso9660") != 0 &&
		    strcmp (libhal_volume_get_fstype (volume), "hfs") != 0 &&
		    strcmp (libhal_volume_get_fstype (volume), "udf") != 0) {
			pol_change_uid = wants_to_change_uid;
		}
	}


	char *mount_option_commasep = NULL;
	char *mount_do_fstype = "auto";

	/* construct arguments to mount */
	na = 0;
	args[na++] = MOUNT;
	if (strlen (mount_fstype) > 0) {
		mount_do_fstype = (char *) map_fstype (mount_fstype);
	} else if (volume == NULL) {
		/* non-pollable drive; force auto */
		mount_do_fstype = "auto";
	} else if (libhal_volume_get_fstype (volume) != NULL && strlen (libhal_volume_get_fstype (volume)) > 0) {
		mount_do_fstype = (char *) map_fstype (libhal_volume_get_fstype (volume));
	}
	args[na++] = MOUNT_TYPE_OPT;
	args[na++] = mount_do_fstype;

	args[na++] = "-o";
#ifdef HAVE_UMOUNT_HAL
	mount_option_str = g_string_new (MOUNT_OPTIONS ",uhelper=hal");
#else
	mount_option_str = g_string_new (MOUNT_OPTIONS);
#endif
	for (i = 0; given_options[i] != NULL; i++) {
		g_string_append (mount_option_str, ",");
		g_string_append (mount_option_str, given_options[i]);
	}
	mount_option_commasep = g_string_free (mount_option_str, FALSE); /* leak! */
	args[na++] = mount_option_commasep;
	args[na++] = (char *) device;
	args[na++] = mount_dir;
	args[na++] = NULL;

	if (pol_is_fixed) {
		if (pol_change_uid) {
			action = NULL; /* "hal-storage-mount-fixed-extra-options"; TODO: rethink */
		} else {
			action = "org.freedesktop.hal.storage.mount-fixed";
		}
	} else {
		if (pol_change_uid) {
			action = NULL; /* "hal-storage-mount-removable-extra-options"; TODO: rethink "extra-options" */
		} else {
			action = "org.freedesktop.hal.storage.mount-removable";
		}
	}
        if (action == NULL) {
                unknown_error ("TODO: have to rethink extra options");
        }

----
I'm not a c coder but it seems to be two options to make it work :
- replace (the two lines)	action = NULL;  by the old value (in comments)
- add ntfs in the :
		if (strcmp (libhal_volume_get_fstype (volume), "vfat") != 0 &&
		    strcmp (libhal_volume_get_fstype (volume), "iso9660") != 0 &&
		    strcmp (libhal_volume_get_fstype (volume), "hfs") != 0 &&
		    strcmp (libhal_volume_get_fstype (volume), "udf") != 0) {
			pol_change_uid = wants_to_change_uid;
		}

Perhaps it could be masked to let the author "rethink" :)
Comment 1 Cody Harris 2008-05-15 01:48:46 UTC
Same problem.  hal-0.5.10

emerge --info:
Portage 2.1.5 (default-linux/x86/2007.0, gcc-4.2.3, glibc-2.7-r2, 2.6.25-gentoo-r3-qb i686)
=================================================================
System uname: 2.6.25-gentoo-r3-qb i686 Genuine Intel(R) CPU T2500 @ 2.00GHz
Timestamp of tree: Thu, 15 May 2008 00:06:01 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.5.2-r3
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.4
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.62
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1-r1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.25-r2
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer -fno-ident"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer -fno-ident"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LDFLAGS=""
MAKEOPTS=""
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/ibm-internal"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acl acpi alsa apache2 apm avahi avi bash-completion bcmath berkdb bl bonjour bzip2 cdinstall cdparanoia cdr cg cisco cli cracklib crypt cups cups-arts curl dbus devil dillo divx4linux doc double-precision dri dts dv dvb dvd dvdr dvdread encode evo exif extrafilters fame fat ffmpeg fftw firefox flac foomaticdb fortran fuse gdbm gif gimp glut gphoto2 gpm gtk hal hfs iconv ieee1394 imap imlib innodb ipod ipv6 isdnlog jpeg jpeg2k kde lame laptop latex libnotify lm_sensors lua mdnsresponder-compat midi mime mmap mmx mono moonlight mp2 mp3 mpeg mplayer msn mudflap musicbrainz mysql ncurses network networkmanager nls nptl nptlonly nsplugin ntfs nvidia offensive ogg openal openexr opengl openmp pam pcre perl png ppds pppd python qt-static qt3 qt3support qt4 quicktime readline reflection samba sdl session slang smp spell spl sqlite sqlite3 sse sse2 ssl subtitles subversion svg tcpd theora threads truetype unicode usb v4l v4l2 visualization vorbis wifi win32codecs wxwindows x x264 x86 xcomposite xft xml xorg xpm xv xvid zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1    emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m       maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="adc65 agfa_cl20 aox barbie canon casio_qv clicksmart310 digigr8 digita dimagev dimera3500 directory enigma13 fuji gsmart300 hp215 iclick jamcam jd11 kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica konica_qm150 largan lg_gsm mars mustek panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 pccam300 pccam600 polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ptp2 ricoh ricoh_g3 samsung sierra sipix_blink sipix_blink2 sipix_web2 smal sonix sony_dscf1 sony_dscf55 soundvision spca50x sq905 stv0674 stv0680 sx330z template toshiba_pdrm11" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 2 Ambroz Bizjak 2008-09-19 11:27:16 UTC
Created attachment 165831 [details, diff]
Fix ntfs mount

This also happens with the stable version 0.9.11-r1.
This patch properly fixes the bug by adding ntfs to the list of filesystems that don't store unix permissions. An entry is also added for ntfs-3g because the newest ntfs-3g installs a hal config file which changes the fstype from "ntfs" to "ntfs-3g".
Comment 3 Marcin Kurek 2008-09-21 18:37:13 UTC
Ha, nice catch. It cause same problem in Gnome here.
Comment 4 Jean-Marc Beaune 2008-09-22 10:46:38 UTC
I can mount with line including "ntfs" but it's only read access.

Adding "ntfs-3g" doesn't help, doesn't seem to work with stable ntfs-3g 1.2531.
Comment 5 Ambroz Bizjak 2008-09-22 17:40:49 UTC
(In reply to comment #4)
> I can mount with line including "ntfs" but it's only read access.
> 
> Adding "ntfs-3g" doesn't help, doesn't seem to work with stable ntfs-3g 1.2531.
> 
This has nothing to do with this bug. The in-kernel driver only allows read access. To use ntfs-3g with HAL you need to install the unstable ntfs3g and enable the "hal" flag.
As far as the bug is concerned, my patch fixes it properly.
Comment 6 William V 2008-09-22 23:59:04 UTC
I just wanted to say that I applied this patch and now ntfs-3g cooperates with hal, finally. I guess this needs to be reported upstream?

Thanks Ambroz!
Comment 7 Ambroz Bizjak 2008-09-23 10:56:42 UTC
(In reply to comment #6)
> I just wanted to say that I applied this patch and now ntfs-3g cooperates with
> hal, finally. I guess this needs to be reported upstream?
> 
> Thanks Ambroz!
> 

I have already reported it:
https://bugs.freedesktop.org/show_bug.cgi?id=17684
Comment 8 Christian Wiegele 2008-10-23 12:38:28 UTC
same problem here. any solution?
Comment 9 subs 2008-11-27 13:59:16 UTC
The same problem exists under gnome as well. I have to use hal-0.5.11-r1, any newer version will not mount ntfs drives. Is there a solution in the works?
Comment 10 Filippo Turato 2008-12-08 19:43:37 UTC
Same problem....
After downgrading to 0.5.9.1-r3 all works again :)

Comment 11 subs 2008-12-23 06:48:33 UTC
This bug was opened almost a full year ago, is there going to be any fix issued? 
Comment 12 Guillaume ZITTA 2008-12-23 07:30:16 UTC
Upstream said that it is fixed as of 2008-12-12 in git.
But I can't find what version will contain the fix.
Comment 13 subs 2009-01-16 04:15:06 UTC
(In reply to comment #12)
> Upstream said that it is fixed as of 2008-12-12 in git.
> But I can't find what version will contain the fix.
> 

Adding the following to /etc/hal/fdi/policy/10-ntfs3g.fdi makes it work for me:


<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
    <device>
        <match key="volume.fstype" string="ntfs">
	    <merge key="volume.fstype" type="string">ntfs-3g</merge>
    	    <merge key="volume.policy.mount_filesystem" type="string">ntfs-3g</merge>
	    <append key="volume.mount.valid_options" type="strlist">locale=</append>
        </match>
    </device>
</deviceinfo>
Comment 14 Tony Vroon gentoo-dev 2009-02-04 19:44:23 UTC
Will consider for -r8. Please update the bug if 0.5.11-r7 already addresses this for you. Sorry for the lack of response you have seen to HAL bugs in Gentoo lately.
Comment 15 Tony Vroon gentoo-dev 2009-02-04 22:59:28 UTC
+*hal-0.5.11-r8 (04 Feb 2009)
+
+  04 Feb 2009; <chainsaw@gentoo.org> +hal-0.5.11-r8.ebuild:
+  Revive a patch by Cardoe to fix test failures, closes bug #176535. Enable
+  support for MacBook/MacBook Pro if USE="laptop", closes bug #200643. Patch
+  from Ambroz Bizjak <ambro@b4ever.net> removes ill-conceived UID checks so
+  NTFS volumes can be automounted, closes bug #205901. Upstream commits
+  scavenged by Ricardo Salveti <ricardo.salveti@openbossa.org> allow
+  mac80211-based wireless devices to be detected properly, closes bug
+  #246026. Reverted partition unhiding from bug #247025, it was already
+  controversial but has been proven to automount recovery partitions.