diff -Nru ntfs-3g-2012.1.15AR.1/debian/changelog ntfs-3g-2012.1.15AR.1/debian/changelog --- ntfs-3g-2012.1.15AR.1/debian/changelog 2012-08-25 20:19:22.000000000 +0000 +++ ntfs-3g-2012.1.15AR.1/debian/changelog 2012-09-11 03:51:11.000000000 +0000 @@ -1,3 +1,10 @@ +ntfs-3g (1:2012.1.15AR.1-1ubuntu1.2) precise-proposed; urgency=low + + * Add readonly-devices.patch: Mount read-only devices as read-only instead + of failing. Thanks to Jean Pierre Andre for the patch! (LP: #435192) + + -- Martin Pitt Tue, 11 Sep 2012 05:49:00 +0200 + ntfs-3g (1:2012.1.15AR.1-1ubuntu1.1) precise-proposed; urgency=low * ntfs-3g-junction-point-fix.patch: Return the correct type (DT_LINK) for diff -Nru ntfs-3g-2012.1.15AR.1/debian/patches/readonly-devices.patch ntfs-3g-2012.1.15AR.1/debian/patches/readonly-devices.patch --- ntfs-3g-2012.1.15AR.1/debian/patches/readonly-devices.patch 1970-01-01 00:00:00.000000000 +0000 +++ ntfs-3g-2012.1.15AR.1/debian/patches/readonly-devices.patch 2012-09-11 03:51:11.000000000 +0000 @@ -0,0 +1,66 @@ +Description: Mount read-only devices as read-only instead of failing. +Author: Jean Pierre Andre (https://launchpad.net/~jean-pierre-andre) +Bug-Ubuntu: https://launchpad.net/bugs/435192 +Bug-Debian: http://bugs.debian.org/686914 + +Index: ntfs-3g-2012.1.15AR.1/src/lowntfs-3g.c +=================================================================== +--- ntfs-3g-2012.1.15AR.1.orig/src/lowntfs-3g.c 2012-02-01 11:02:41.000000000 +0100 ++++ ntfs-3g-2012.1.15AR.1/src/lowntfs-3g.c 2012-09-10 07:49:47.833583959 +0200 +@@ -4090,6 +4090,12 @@ + if (err) + goto err_out; + ++ /* Force read-only mount if the device was found read-only */ ++ if (!ctx->ro && NVolReadOnly(ctx->vol)) { ++ ctx->ro = TRUE; ++ if (ntfs_strinsert(&parsed_options, ",ro")) ++ goto err_out; ++ } + /* We must do this after ntfs_open() to be able to set the blksize */ + if (ctx->blkdev && set_fuseblk_options(&parsed_options)) + goto err_out; +Index: ntfs-3g-2012.1.15AR.1/src/ntfs-3g.c +=================================================================== +--- ntfs-3g-2012.1.15AR.1.orig/src/ntfs-3g.c 2012-02-01 11:02:41.000000000 +0100 ++++ ntfs-3g-2012.1.15AR.1/src/ntfs-3g.c 2012-09-10 07:49:47.837583959 +0200 +@@ -3739,6 +3739,12 @@ + if (err) + goto err_out; + ++ /* Force read-only mount if the device was found read-only */ ++ if (!ctx->ro && NVolReadOnly(ctx->vol)) { ++ ctx->ro = TRUE; ++ if (ntfs_strinsert(&parsed_options, ",ro")) ++ goto err_out; ++ } + /* We must do this after ntfs_open() to be able to set the blksize */ + if (ctx->blkdev && set_fuseblk_options(&parsed_options)) + goto err_out; +Index: ntfs-3g-2012.1.15AR.1/libntfs-3g/volume.c +=================================================================== +--- ntfs-3g-2012.1.15AR.1.orig/libntfs-3g/volume.c 2012-02-01 11:02:41.000000000 +0100 ++++ ntfs-3g-2012.1.15AR.1/libntfs-3g/volume.c 2012-09-10 07:49:47.837583959 +0200 +@@ -513,8 +513,20 @@ + + /* ...->open needs bracketing to compile with glibc 2.7 */ + if ((dev->d_ops->open)(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) { +- ntfs_log_perror("Error opening '%s'", dev->d_name); +- goto error_exit; ++ if (!NVolReadOnly(vol) && (errno == EROFS)) { ++ if ((dev->d_ops->open)(dev, O_RDONLY)) { ++ ntfs_log_perror("Error opening read-only '%s'", ++ dev->d_name); ++ goto error_exit; ++ } else { ++ ntfs_log_info("Can only open '%s' as read-only\n", ++ dev->d_name); ++ NVolSetReadOnly(vol); ++ } ++ } else { ++ ntfs_log_perror("Error opening '%s'", dev->d_name); ++ goto error_exit; ++ } + } + /* Attach the device to the volume. */ + vol->dev = dev; diff -Nru ntfs-3g-2012.1.15AR.1/debian/patches/series ntfs-3g-2012.1.15AR.1/debian/patches/series --- ntfs-3g-2012.1.15AR.1/debian/patches/series 2012-08-25 20:16:54.000000000 +0000 +++ ntfs-3g-2012.1.15AR.1/debian/patches/series 2012-09-11 03:51:11.000000000 +0000 @@ -1,2 +1,3 @@ syncio-compat.patch ntfs-3g-junction-point-fix.patch +readonly-devices.patch