All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/10] mount.nfs: Support double-wide characters in printed strings
@ 2007-08-03 17:23 Chuck Lever
  2007-08-03 21:50 ` Neil Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Chuck Lever @ 2007-08-03 17:23 UTC (permalink / raw)
  To: neilb; +Cc: nfs

Previous NLS changes missed a spot or two.  This patch tries to get
most of them, but probably misses a few more.

In errors.c:mount_errors() I've removed a period at the end of the error
messages; this is consistent with other error messages I've examined.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mount/error.c     |   34 +++++++++++++++++++++++-----------
 utils/mount/mount.c     |   35 +++++++++++++++++------------------
 utils/mount/nfs4mount.c |    4 ++--
 utils/mount/nfsmount.c  |    3 +--
 utils/mount/nfsumount.c |   22 +++++++++++-----------
 5 files changed, 54 insertions(+), 44 deletions(-)

diff --git a/utils/mount/error.c b/utils/mount/error.c
index bf056af..cab84c9 100644
--- a/utils/mount/error.c
+++ b/utils/mount/error.c
@@ -67,9 +67,11 @@ static int rpc_strerror(int spos)
 		tmp = &errbuf[spos];
 		if (cf_stat == RPC_SYSTEMERROR)
 			pos = snprintf(tmp, (erreob - tmp),
-				"System Error: %s", strerror(cf_errno));
+					_("System Error: %s"),
+						strerror(cf_errno));
 		else
-			pos = snprintf(tmp, (erreob - tmp), "RPC Error:%s", estr);
+			pos = snprintf(tmp, (erreob - tmp),
+					_("RPC Error:%s"), estr);
 	}
 	return pos;
 }
@@ -83,30 +85,40 @@ void mount_errors(char *server, int will_retry, int bg)
 	tmp = &errbuf[pos];
 	if (bg)
 		pos = snprintf(tmp, (erreob - tmp),
-			"mount to NFS server '%s' failed: ", server);
+				_("mount to NFS server '%s' failed: "),
+					server);
 	else
 		pos = snprintf(tmp, (erreob - tmp),
-			       "%s: mount to NFS server '%s' failed: ",
-			       progname, server);
+				_("%s: mount to NFS server '%s' failed: "),
+					progname, server);
 
 	tmp = &errbuf[pos];
 	if (rpc_createerr.cf_stat == RPC_TIMEDOUT) {
-		pos = snprintf(tmp, (erreob - tmp), "timed out %s",
-			will_retry ? "(retrying)" : "(giving up)");
+		if (will_retry)
+			pos = snprintf(tmp, (erreob - tmp),
+					_("timed out, retrying"));
+		else
+			pos = snprintf(tmp, (erreob - tmp),
+					_("timed out, giving up"));
 	} else {
 		pos += rpc_strerror(pos);
 		tmp = &errbuf[pos];
 		if (bg) {
-			pos = snprintf(tmp, (erreob - tmp), " %s",
-				will_retry ? "(retrying)" : "(giving up)");
+			if (will_retry)
+				pos = snprintf(tmp, (erreob - tmp),
+						_(", retrying"));
+			else
+				pos = snprintf(tmp, (erreob - tmp),
+						_(", giving up"));
 		}
 	}
+
 	if (bg) {
 		if (onlyonce++ < 1)
 			openlog("mount", LOG_CONS|LOG_PID, LOG_AUTH);
-		syslog(LOG_ERR, "%s.", errbuf);
+		syslog(LOG_ERR, "%s", errbuf);
 	} else
-		fprintf(stderr, "%s.\n", errbuf);
+		fprintf(stderr, "%s\n", errbuf);
 }
 
 void mount_error(const char *spec, const char *mount_point, int error)
diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index d6d527c..a7ad035 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -174,14 +174,13 @@ static void discover_nfs_mount_data_version(void)
 
 static void print_one(char *spec, char *node, char *type, char *opts)
 {
-	if (verbose) {
-		printf("%s on %s type %s", spec, node, type);
+	if (!verbose)
+		return;
 
-		if (opts != NULL)
-			printf(" (%s)", opts);
-
-		printf("\n");
-	}
+	if (opts)
+		printf(_("%s on %s type %s (%s)\n"), spec, node, type, opts);
+	else
+		printf(_("%s on %s type %s\n"), spec, node, type);
 }
 
 /*
@@ -268,18 +267,18 @@ fail_unlock:
 
 void mount_usage(void)
 {
-	printf("usage: %s remotetarget dir [-rvVwfnh] [-o nfsoptions]\n",
+	printf(_("usage: %s remotetarget dir [-rvVwfnh] [-o nfsoptions]\n"),
 		progname);
-	printf("options:\n");
-	printf("\t-r\t\tMount file system readonly\n");
-	printf("\t-v\t\tVerbose\n");
-	printf("\t-V\t\tPrint version\n");
-	printf("\t-w\t\tMount file system read-write\n");
-	printf("\t-f\t\tFake mount, do not actually mount\n");
-	printf("\t-n\t\tDo not update /etc/mtab\n");
-	printf("\t-s\t\tTolerate sloppy mount options rather than failing.\n");
-	printf("\t-h\t\tPrint this help\n");
-	printf("\tnfsoptions\tRefer to mount.nfs(8) or nfs(5)\n\n");
+	printf(_("options:\n"));
+	printf(_("\t-r\t\tMount file system readonly\n"));
+	printf(_("\t-v\t\tVerbose\n"));
+	printf(_("\t-V\t\tPrint version\n"));
+	printf(_("\t-w\t\tMount file system read-write\n"));
+	printf(_("\t-f\t\tFake mount, do not actually mount\n"));
+	printf(_("\t-n\t\tDo not update /etc/mtab\n"));
+	printf(_("\t-s\t\tTolerate sloppy mount options rather than failing.\n"));
+	printf(_("\t-h\t\tPrint this help\n"));
+	printf(_("\tnfsoptions\tRefer to mount.nfs(8) or nfs(5)\n\n"));
 }
 
 static void parse_opt(const char *opt, int *mask, char *extra_opts, int len)
diff --git a/utils/mount/nfs4mount.c b/utils/mount/nfs4mount.c
index e1b2c3b..2126db4 100644
--- a/utils/mount/nfs4mount.c
+++ b/utils/mount/nfs4mount.c
@@ -321,8 +321,8 @@ int nfs4mount(const char *spec, const char *node, int flags,
 			else if (!strcmp(opt, "sharecache"))
 				unshared = !val;
 			else if (!sloppy) {
-				printf(_("unknown nfs mount option: "
-					 "%s%s\n"), val ? "" : "no", opt);
+				printf(_("unknown nfs mount option: %s%s\n"),
+						val ? "" : _("no"), opt);
 				goto fail;
 			}
 		}
diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c
index bd3403c..a56bfe1 100644
--- a/utils/mount/nfsmount.c
+++ b/utils/mount/nfsmount.c
@@ -190,7 +190,6 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
 		if ((opteq = strchr(opt, '=')) && isdigit(opteq[1])) {
 			int val = atoi(opteq + 1);	
 			*opteq = '\0';
-/* printf("opt=%s\n", opt); */
 			if (!strcmp(opt, "rsize"))
 				data->rsize = val;
 			else if (!strcmp(opt, "wsize"))
@@ -432,7 +431,7 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
 						val ? "" : "no", opt);
 				goto out_bad;
 			}
-			sprintf(cbuf, val ? "%s,":"no%s,", opt);
+			sprintf(cbuf, val ? "%s," : "no%s,", opt);
 		}
 		len += strlen(cbuf);
 		if (len >= opt_size) {
diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c
index 0c66717..e8814a3 100644
--- a/utils/mount/nfsumount.c
+++ b/utils/mount/nfsumount.c
@@ -67,7 +67,7 @@ static int del_mtab(const char *spec, const char *node)
                 res = umount2 (node, MNT_FORCE);
                 if (res == -1) {
                         int errsv = errno;
-                        perror("umount2");
+                        perror(_("umount2"));
                         errno = errsv;
                         if (errno == ENOSYS) {
                                 if (verbose)
@@ -93,7 +93,7 @@ static int del_mtab(const char *spec, const char *node)
                                 update_mtab(node, &remnt);
                         return 0;
                 } else if (errno != EBUSY) {    /* hmm ... */
-                        perror("remount");
+                        perror(_("remount"));
                         nfs_error(_("%s: could not remount %s read-only"),
                                 	progname, spec);
                 }
@@ -102,7 +102,7 @@ static int del_mtab(const char *spec, const char *node)
         if (res >= 0) {
                 /* Umount succeeded */
                 if (verbose)
-                        printf (_("%s umounted\n"), spec ? spec : node);
+                        printf(_("%s umounted\n"), spec ? spec : node);
         }
 
  writemtab:
@@ -212,13 +212,13 @@ static struct option umount_longopts[] =
 
 static void umount_usage(void)
 {
-	printf("usage: %s dir [-fvnrlh]\n", progname);
-	printf("options:\n\t-f\t\tforce unmount\n");
-	printf("\t-v\t\tverbose\n");
-	printf("\t-n\t\tDo not update /etc/mtab\n");
-	printf("\t-r\t\tremount\n");
-	printf("\t-l\t\tlazy unmount\n");
-	printf("\t-h\t\tprint this help\n\n");
+	printf(_("usage: %s dir [-fvnrlh]\n"), progname);
+	printf(_("options:\n\t-f\t\tforce unmount\n"));
+	printf(_("\t-v\tverbose\n"));
+	printf(_("\t-n\tDo not update /etc/mtab\n"));
+	printf(_("\t-r\tremount\n"));
+	printf(_("\t-l\tlazy unmount\n"));
+	printf(_("\t-h\tprint this help\n\n"));
 }
 
 int nfsumount(int argc, char *argv[])
@@ -282,7 +282,7 @@ int nfsumount(int argc, char *argv[])
 
 	if (mc && strcmp(mc->m.mnt_type, "nfs") != 0 &&
 	    strcmp(mc->m.mnt_type, "nfs4") != 0) {
-		nfs_error(_("%s: %s on %s it not an nfs filesystem"),
+		nfs_error(_("%s: %s on %s is not an NFS filesystem"),
 				progname, mc->m.mnt_fsname, mc->m.mnt_dir);
 		return EX_USAGE;
 	}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 01/10] mount.nfs: Support double-wide characters in printed strings
  2007-08-03 17:23 [PATCH 01/10] mount.nfs: Support double-wide characters in printed strings Chuck Lever
@ 2007-08-03 21:50 ` Neil Brown
  2007-08-04  0:04   ` Chuck Lever
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Brown @ 2007-08-03 21:50 UTC (permalink / raw)
  To: Chuck Lever; +Cc: nfs

On Friday August 3, chuck.lever@oracle.com wrote:
> Previous NLS changes missed a spot or two.  This patch tries to get
> most of them, but probably misses a few more.
> 
> In errors.c:mount_errors() I've removed a period at the end of the error
> messages; this is consistent with other error messages I've examined.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
....
> --- a/utils/mount/nfs4mount.c
> +++ b/utils/mount/nfs4mount.c
> @@ -321,8 +321,8 @@ int nfs4mount(const char *spec, const char *node, int flags,
>  			else if (!strcmp(opt, "sharecache"))
>  				unshared = !val;
>  			else if (!sloppy) {
> -				printf(_("unknown nfs mount option: "
> -					 "%s%s\n"), val ? "" : "no", opt);
> +				printf(_("unknown nfs mount option: %s%s\n"),
> +						val ? "" : _("no"), opt);
>  				goto fail;

I removed the _() around the "no".  Translating the 'no' without
translating the option doesn't make any sense to me.
You would run
  mount -o nocoffee .....
and get an error
   Option inconnue de mount du nfs: noncoffee

(or something - my French non-existent, I just played with
google-translate).  Which is wrong.  'noncoffee' isn't the bad
option.  'nocoffee' is.

> --- a/utils/mount/nfsumount.c
> +++ b/utils/mount/nfsumount.c
> @@ -67,7 +67,7 @@ static int del_mtab(const char *spec, const char *node)
>                  res = umount2 (node, MNT_FORCE);
>                  if (res == -1) {
>                          int errsv = errno;
> -                        perror("umount2");
> +                        perror(_("umount2"));
>                          errno = errsv;
>                          if (errno == ENOSYS) {
>                                  if (verbose)
> @@ -93,7 +93,7 @@ static int del_mtab(const char *spec, const char *node)
>                                  update_mtab(node, &remnt);
>                          return 0;
>                  } else if (errno != EBUSY) {    /* hmm ... */
> -                        perror("remount");
> +                        perror(_("remount"));
>                          nfs_error(_("%s: could not remount %s read-only"),
>                                  	progname, spec);
>                  }

And I'm not at all convinced about the _() in perror - In the first
case it is a syscall name.  How would you translate that?  The second
is possibly less doubtful, but it would probably be best to discard
the perror calls and pass strerror(errno) to nfs_error with an
appropriate format - What do you think?

NeilBrown

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 01/10] mount.nfs: Support double-wide characters in printed strings
  2007-08-03 21:50 ` Neil Brown
@ 2007-08-04  0:04   ` Chuck Lever
  0 siblings, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2007-08-04  0:04 UTC (permalink / raw)
  To: Neil Brown; +Cc: nfs

[-- Attachment #1: Type: text/plain, Size: 2742 bytes --]

Neil Brown wrote:
> On Friday August 3, chuck.lever@oracle.com wrote:
>> Previous NLS changes missed a spot or two.  This patch tries to get
>> most of them, but probably misses a few more.
>>
>> In errors.c:mount_errors() I've removed a period at the end of the error
>> messages; this is consistent with other error messages I've examined.
>>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ....
>> --- a/utils/mount/nfs4mount.c
>> +++ b/utils/mount/nfs4mount.c
>> @@ -321,8 +321,8 @@ int nfs4mount(const char *spec, const char *node, int flags,
>>  			else if (!strcmp(opt, "sharecache"))
>>  				unshared = !val;
>>  			else if (!sloppy) {
>> -				printf(_("unknown nfs mount option: "
>> -					 "%s%s\n"), val ? "" : "no", opt);
>> +				printf(_("unknown nfs mount option: %s%s\n"),
>> +						val ? "" : _("no"), opt);
>>  				goto fail;
> 
> I removed the _() around the "no".  Translating the 'no' without
> translating the option doesn't make any sense to me.
> You would run
>   mount -o nocoffee .....
> and get an error
>    Option inconnue de mount du nfs: noncoffee
> 
> (or something - my French non-existent, I just played with
> google-translate).  Which is wrong.  'noncoffee' isn't the bad
> option.  'nocoffee' is.

OK.

>> --- a/utils/mount/nfsumount.c
>> +++ b/utils/mount/nfsumount.c
>> @@ -67,7 +67,7 @@ static int del_mtab(const char *spec, const char *node)
>>                  res = umount2 (node, MNT_FORCE);
>>                  if (res == -1) {
>>                          int errsv = errno;
>> -                        perror("umount2");
>> +                        perror(_("umount2"));
>>                          errno = errsv;
>>                          if (errno == ENOSYS) {
>>                                  if (verbose)
>> @@ -93,7 +93,7 @@ static int del_mtab(const char *spec, const char *node)
>>                                  update_mtab(node, &remnt);
>>                          return 0;
>>                  } else if (errno != EBUSY) {    /* hmm ... */
>> -                        perror("remount");
>> +                        perror(_("remount"));
>>                          nfs_error(_("%s: could not remount %s read-only"),
>>                                  	progname, spec);
>>                  }
> 
> And I'm not at all convinced about the _() in perror - In the first
> case it is a syscall name.  How would you translate that?  The second
> is possibly less doubtful, but it would probably be best to discard
> the perror calls and pass strerror(errno) to nfs_error with an
> appropriate format - What do you think?

Adding _() for perror is consistent with the other perror calls already 
in the code.  I suppose if those are objectionable, you should remove 
them all.

[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 315 bytes --]

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group
adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA
email;internet:chuck dot lever at nospam oracle dot com
title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 140 bytes --]

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-04  0:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-03 17:23 [PATCH 01/10] mount.nfs: Support double-wide characters in printed strings Chuck Lever
2007-08-03 21:50 ` Neil Brown
2007-08-04  0:04   ` Chuck Lever

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.