[Bug 435192] Re: Automatic mounting of read only ntfs partition on usb device fails
Jean-Pierre
435192 at bugs.launchpad.net
Fri Sep 7 08:01:44 UTC 2012
Please test the attached patch
** Patch added: "Patch for mounting a read-only device"
https://bugs.launchpad.net/ubuntu/+source/ntfs-3g/+bug/435192/+attachment/3297662/+files/readonly.patch
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ntfs-3g in Ubuntu.
https://bugs.launchpad.net/bugs/435192
Title:
Automatic mounting of read only ntfs partition on usb device fails
Status in OEM Priority Project:
In Progress
Status in OEM Priority Project precise series:
In Progress
Status in abstraction for enumerating and managing block devices:
Confirmed
Status in “ntfs-3g” package in Ubuntu:
Triaged
Status in “udisks” package in Ubuntu:
Invalid
Status in “udisks2” package in Ubuntu:
In Progress
Status in “ntfs-3g” source package in Precise:
Triaged
Status in “udisks” source package in Precise:
Confirmed
Status in “ntfs-3g” source package in Quantal:
Triaged
Status in “udisks” source package in Quantal:
Invalid
Status in “udisks2” source package in Quantal:
In Progress
Status in “ntfs-3g” package in Debian:
Unknown
Bug description:
[Impact]
OEM customers raise this issue, thinking that the error message can be misleading to inexperienced users.
[Fix]
fixed by below patch:
diff --git a/precise/src/device.c b/precise/src/device.c
index a7f8880..8b48612 100644
--- a/precise/src/device.c
+++ b/precise/src/device.c
@@ -6407,6 +6407,7 @@ device_filesystem_mount_authorized_cb (Daemon *daemon,
const FSMountOptions *fsmo;
char **options;
char uid_buf[32];
+ int access_changed;
fstype = NULL;
options = NULL;
@@ -6414,6 +6415,7 @@ device_filesystem_mount_authorized_cb (Daemon *daemon,
mount_point = NULL;
remove_dir_on_unmount = FALSE;
error = NULL;
+ access_changed = 0;
/* If the user requests the filesystem type, error out unless the
* filesystem type is
@@ -6516,6 +6518,7 @@ device_filesystem_mount_authorized_cb (Daemon *daemon,
for (n = 0; options[n] != NULL; n++)
{
const char *option = options[n];
+ char *start;
/* avoid attacks like passing "shortname=lower,uid=0" as a single mount option */
if (strstr (option, ",") != NULL)
@@ -6533,9 +6536,23 @@ device_filesystem_mount_authorized_cb (Daemon *daemon,
goto out;
}
+ if (start = strstr(option, "rw")) {
+ if (device->priv->device_is_read_only) {
+ start[1] = 'o';
+ access_changed = 1;
+ }
+ }
+
g_string_append_c (s, ',');
g_string_append (s, option);
}
+
+ if (!access_changed && device->priv->device_is_read_only)
+ {
+ g_string_append_c (s, ',');
+ g_string_append (s, "ro");
+ }
+
mount_options = g_string_free (s, FALSE);
g_print ("**** USING MOUNT OPTIONS '%s' FOR DEVICE %s\n", mount_options, device->priv->device_file);
[Test Case]
Format a SD card with NTFS, lock the SD card as write-protected, insert the card into the SD card slot. If the card is mounted as read-only, the bug is fixed.
[Regression Potential]
The fix posted looks shouldn't cause regression.
[Original Report]
Mounting of read only NTFS filesystem gives a following error popup:
Cannot mount volume.
Unable to mount the volume '<Volume name>'.
Details:
Error opening '/dev/sdb2': Read-only file system
Failed to mount '/dev/sdb2': Read-only file system
I believe this should be mounted as read-only instead of an error
message.
Mounting by hand with the "-o ro" argument works as expected.
---
Architecture: i386
DistroRelease: Ubuntu 10.04
NonfreeKernelModules: fglrx
Package: mountall 2.15
PackageArchitecture: i386
ProcEnviron:
PATH=(custom, user)
LANG=en_US.utf8
SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.32-24.39-generic 2.6.32.15+drm33.5
Tags: lucid
Uname: Linux 2.6.32-24-generic i686
UserGroups: adm admin audio cdrom dialout dip fax fuse lpadmin netdev plugdev sambashare tape video
To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/435192/+subscriptions
More information about the foundations-bugs
mailing list