ALT Linux Bugzilla
– Attachment 1481 Details for
Bug 9554
Problems with mounting removable disks with vfat using pmount in different locales
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Add --codepage to pmount
pmount-0.9.9-codepage.patch (text/plain), 10.74 KB, created by
serpiph
on 2006-05-13 11:16:28 MSD
(
hide
)
Description:
Add --codepage to pmount
Filename:
MIME Type:
Creator:
serpiph
Created:
2006-05-13 11:16:28 MSD
Size:
10.74 KB
patch
obsolete
>diff -Naurp pmount-0.9.9.orig/man/pmount.1 pmount-0.9.9.new/man/pmount.1 >--- pmount-0.9.9.orig/man/pmount.1 2006-02-28 21:59:14 +0300 >+++ pmount-0.9.9.new/man/pmount.1 2006-05-13 09:44:26 +0400 >@@ -159,6 +159,15 @@ support setting the character set (see > (8) for details). > > .TP >+.B \-P \fIcodepage\fR, \fB\-\-codepage \fIcodepage >+Use given I/O character set. This >+corresponds with the mount option >+.B codepage\fR. This option is ignored for file systems that do not >+support setting the codepage set (see >+.B mount >+(8) for details). >+ >+.TP > .B \-u \fIumask\fR, \fB\-\-umask \fIumask\fR > Use specified umask instead of the default one. For UDF, the default > is '007', for VFAT and NTFS the default is '077'. This value is >diff -Naurp pmount-0.9.9.orig/src/fs.c pmount-0.9.9.new/src/fs.c >--- pmount-0.9.9.orig/src/fs.c 2006-01-06 19:22:17 +0300 >+++ pmount-0.9.9.new/src/fs.c 2006-05-13 09:42:00 +0400 >@@ -19,19 +19,19 @@ > * to command line options. > */ > static struct FS supported_fs[] = { >- { "udf", "nosuid,nodev,user", 1, "007", 1 }, >- { "iso9660", "nosuid,nodev,user", 1, NULL, 1 }, >- { "vfat", "nosuid,nodev,user,quiet,shortname=mixed", 1, "077", 1 }, >- { "ntfs", "nosuid,nodev,user", 1, "077", 1 }, >- { "hfsplus", "nosuid,nodev,user", 1, NULL, 0 }, >- { "hfs", "nosuid,nodev,user", 1, NULL, 0 }, >- { "ext3", "nodev,noauto,nosuid,user", 0, NULL, 0 }, >- { "ext2", "nodev,noauto,nosuid,user", 0, NULL, 0 }, >- { "reiserfs", "nodev,noauto,nosuid,user", 0, NULL, 0 }, >- { "reiser4", "nodev,noauto,nosuid,user", 0, NULL, 0 }, >- { "xfs", "nodev,noauto,nosuid,user", 0, NULL, 0 }, >- { "jfs", "nodev,noauto,nosuid,user", 0, NULL, 1 }, >- { NULL, NULL, 0, NULL, 0} >+ { "udf", "nosuid,nodev,user", 1, "007", 1, 0 }, >+ { "iso9660", "nosuid,nodev,user", 1, NULL, 1, 0 }, >+ { "vfat", "nosuid,nodev,user,quiet,shortname=mixed", 1, "077", 1, 1 }, >+ { "ntfs", "nosuid,nodev,user", 1, "077", 1, 0 }, >+ { "hfsplus", "nosuid,nodev,user", 1, NULL, 0, 0 }, >+ { "hfs", "nosuid,nodev,user", 1, NULL, 0, 0 }, >+ { "ext3", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 }, >+ { "ext2", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 }, >+ { "reiserfs", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 }, >+ { "reiser4", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 }, >+ { "xfs", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 }, >+ { "jfs", "nodev,noauto,nosuid,user", 0, NULL, 1, 0 }, >+ { NULL, NULL, 0, NULL, 0, 0} > }; > > const struct FS* >diff -Naurp pmount-0.9.9.orig/src/fs.h pmount-0.9.9.new/src/fs.h >--- pmount-0.9.9.orig/src/fs.h 2005-10-13 18:59:06 +0400 >+++ pmount-0.9.9.new/src/fs.h 2006-05-13 09:39:05 +0400 >@@ -20,6 +20,7 @@ struct FS { > int support_ugid; /* whether the fs supports uid and gid options */ > const char* umask; /* umask value (NULL if umask is not supported) */ > int support_iocharset; /* whether the fs supports the iocharset option */ >+ int support_codepage; /* whether the fs supports the codepage option */ > }; > > /** >diff -Naurp pmount-0.9.9.orig/src/pmount.c pmount-0.9.9.new/src/pmount.c >--- pmount-0.9.9.orig/src/pmount.c 2005-12-16 14:17:25 +0300 >+++ pmount-0.9.9.new/src/pmount.c 2006-05-13 10:05:47 +0400 >@@ -65,22 +65,23 @@ usage( const char* exename ) > " Remove the lock on <device> for process <pid> again.\n\n"), > exename); > puts( _("Options:\n" >- " -r : force <device> to be mounted read-only\n" >- " -w : force <device> to be mounted read-write\n" >- " -s, --sync : mount <device> with the 'sync' option (default: 'async')\n" >- " --noatime : mount <device> with the 'noatime' option (default: 'atime')\n" >- " -e, --exec : mount <device> with the 'exec' option (default: 'noexec')\n" >- " -t <fs> : mount as file system type <fs> (default: autodetected)\n" >- " -c <charset>: use given I/O character set (default: 'utf8' if called\n" >- " in an UTF-8 locale, otherwise mount default)\n" >- " -u <umask> : use specified umask instead of the default (only for\n" >- " file sytems which actually support umask setting)\n" >+ " -r : force <device> to be mounted read-only\n" >+ " -w : force <device> to be mounted read-write\n" >+ " -s, --sync : mount <device> with the 'sync' option (default: 'async')\n" >+ " --noatime : mount <device> with the 'noatime' option (default: 'atime')\n" >+ " -e, --exec : mount <device> with the 'exec' option (default: 'noexec')\n" >+ " -t <fs> : mount as file system type <fs> (default: autodetected)\n" >+ " -c <charset> : use given I/O character set (default: 'utf8' if called\n" >+ " in an UTF-8 locale, otherwise mount default)\n" >+ " -P <codepage>: use given codepage set\n" >+ " -u <umask> : use specified umask instead of the default (only for\n" >+ " file sytems which actually support umask setting)\n" > " --passphrase <file>\n" >- " read passphrase from file instead of the terminal\n" >- " (only for LUKS encrypted devices)\n" >- " -d, --debug : enable debug output (very verbose)\n" >- " -h, --help : print help message and exit successfuly\n" >- " --version : print version number and exit successfully") ); >+ " read passphrase from file instead of the terminal\n" >+ " (only for LUKS encrypted devices)\n" >+ " -d, --debug : enable debug output (very verbose)\n" >+ " -h, --help : print help message and exit successfuly\n" >+ " --version : print version number and exit successfully") ); > } > > /** >@@ -200,6 +201,8 @@ do_mount_fstab( const char* device ) > * @param force_write 1 for forced r/w, 0 for forced r/o, -1 for kernel default > * @param iocharset charset to use for file name conversion; NULL for mount > * default >+ * @param codepage codepage to use for file name conversion; NULL for mount >+ * default > * @param umask User specified umask (NULL for default) > * @param suppress_errors: if true, stderr is redirected to /dev/null > * @return exit status of mount, or -1 on failure. >@@ -207,12 +210,13 @@ do_mount_fstab( const char* device ) > int > do_mount( const char* device, const char* mntpt, const char* fsname, int async, > int noatime, int exec, int force_write, const char* iocharset, const >- char* umask, int suppress_errors ) >+ char* codepage, const char* umask, int suppress_errors ) > { > const struct FS* fs; > char ugid_opt[100]; > char umask_opt[100]; > char iocharset_opt[100]; >+ char codepage_opt[100]; > const char* sync_opt = ",sync"; > const char* atime_opt = ",atime"; > const char* exec_opt = ",noexec"; >@@ -238,7 +242,7 @@ do_mount( const char* device, const char > } > > /* assemble option string */ >- *ugid_opt = *umask_opt = *iocharset_opt = 0; >+ *ugid_opt = *umask_opt = *iocharset_opt = *codepage_opt = 0; > if( fs->support_ugid ) > snprintf( ugid_opt, sizeof( ugid_opt ), ",uid=%i,gid=%i", > getuid(), getgid() ); >@@ -271,9 +275,17 @@ do_mount( const char* device, const char > snprintf( iocharset_opt, sizeof( iocharset_opt ), ",iocharset=%s", iocharset ); > } > >- snprintf( options, sizeof( options ), "%s%s%s%s%s%s%s%s", >+ if( codepage && fs->support_codepage ) { >+ if( !is_word_str( codepage ) ) { >+ fprintf( stderr, _("Error: invalid codepage name '%s'\n"), codepage ); >+ return -1; >+ } >+ snprintf( codepage_opt, sizeof( codepage_opt ), ",codepage=%s", codepage ); >+ } >+ >+ snprintf( options, sizeof( options ), "%s%s%s%s%s%s%s%s%s", > fs->options, sync_opt, atime_opt, exec_opt, access_opt, ugid_opt, >- umask_opt, iocharset_opt ); >+ umask_opt, iocharset_opt, codepage_opt ); > > /* go for it */ > return spawnl( SPAWN_EROOT | SPAWN_RROOT | (suppress_errors ? SPAWN_NO_STDERR : 0 ), >@@ -293,13 +305,15 @@ do_mount( const char* device, const char > * @param force_write 1 for forced r/w, 0 for forced r/o, -1 for kernel default > * @param iocharset charset to use for file name conversion; NULL for mount > * default >+ * @param codepage codepage to use for file name conversion; NULL for mount >+ * default > * @param umask User specified umask (NULL for default) > * @return last return value of do_mount (i. e. 0 on success, != 0 on error) > */ > int > do_mount_auto( const char* device, const char* mntpt, int async, > int noatime, int exec, int force_write, const char* iocharset, >- const char* umask ) >+ const char* codepage, const char* umask ) > { > const struct FS* fs; > int nostderr = 1; >@@ -310,14 +324,14 @@ do_mount_auto( const char* device, const > if( (fs+1)->fsname == NULL ) > nostderr = 0; > result = do_mount( device, mntpt, fs->fsname, async, noatime, exec, >- force_write, iocharset, umask, nostderr ); >+ force_write, iocharset, codepage, umask, nostderr ); > if( result == 0 ) > break; > > /* sometimes VFAT fails when using iocharset; try again without */ > if( iocharset ) > result = do_mount( device, mntpt, fs->fsname, async, noatime, exec, >- force_write, NULL, umask, nostderr ); >+ force_write, NULL, NULL, umask, nostderr ); > if( result <= 0 ) > break; > } >@@ -485,6 +499,7 @@ main( int argc, char** argv ) > int force_write = -1; /* 0: ro, 1: rw, -1: default */ > const char* use_fstype = NULL; > const char* iocharset = NULL; >+ const char* codepage = NULL; > const char* umask = NULL; > const char* passphrase = NULL; > int result; >@@ -502,6 +517,7 @@ main( int argc, char** argv ) > { "exec", 0, NULL, 'e' }, > { "type", 1, NULL, 't' }, > { "charset", 1, NULL, 'c' }, >+ { "codepage", 1, NULL, 'P' }, > { "umask", 1, NULL, 'u' }, > { "passphrase", 1, NULL, 'p' }, > { "read-only", 0, NULL, 'r' }, >@@ -549,6 +565,8 @@ main( int argc, char** argv ) > > case 'c': iocharset = optarg; break; > >+ case 'P': codepage = optarg; break; >+ > case 'u': umask = optarg; break; > > case 'p': passphrase = optarg; break; >@@ -684,10 +702,10 @@ main( int argc, char** argv ) > /* off we go */ > if( use_fstype ) > result = do_mount( decrypted_device, mntpt, use_fstype, async, noatime, >- exec, force_write, iocharset, umask, 0 ); >+ exec, force_write, iocharset, codepage, umask, 0 ); > else > result = do_mount_auto( decrypted_device, mntpt, async, noatime, exec, >- force_write, iocharset, umask ); >+ force_write, iocharset, codepage, umask ); > > /* unlock the mount point again */ > debug( "unlocking mount point directory\n" );
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 9554
: 1481