All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix umount.nfs exit status
@ 2007-07-14  9:18 Steinar H. Gunderson
  2007-07-16  0:59 ` Neil Brown
  2007-07-16 17:07 ` Chuck Lever
  0 siblings, 2 replies; 3+ messages in thread
From: Steinar H. Gunderson @ 2007-07-14  9:18 UTC (permalink / raw)
  To: nfs

Hi,

As per a bug report from a user:

mount.c seems to assume that nfsumount() uses standard C true/false
return values, and inverts them for the exit status (where 0 is
traditionally considered success). However, nfsumount() consistently
seems to use 0 for success, and thus a success gets returned as exit
status 1 and a failure as exit status 0. This confuses at least
the GNOME drive manager applet, and probably others as well.

Signed-off-by: Steinar H. Gunderson <sesse@debian.org>

Index: nfs-utils-1.1.0/utils/mount/mount.c
===================================================================
--- nfs-utils-1.1.0.orig/utils/mount/mount.c
+++ nfs-utils-1.1.0/utils/mount/mount.c
@@ -371,7 +371,7 @@ int main(int argc, char *argv[])
                        umount_usage();
                        exit(1);
                }
-               exit(nfsumount(argc, argv) ? 0 : 1);
+               exit(nfsumount(argc, argv));
        }

        if(argv[1] && argv[1][0] == '-') {

/* Steinar */
-- 
Homepage: http://www.sesse.net/

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* Re: [PATCH] Fix umount.nfs exit status
  2007-07-14  9:18 [PATCH] Fix umount.nfs exit status Steinar H. Gunderson
@ 2007-07-16  0:59 ` Neil Brown
  2007-07-16 17:07 ` Chuck Lever
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Brown @ 2007-07-16  0:59 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: nfs

On Saturday July 14, sesse@debian.org wrote:
> Hi,
> 
> As per a bug report from a user:
> 
> mount.c seems to assume that nfsumount() uses standard C true/false
> return values, and inverts them for the exit status (where 0 is
> traditionally considered success). However, nfsumount() consistently
> seems to use 0 for success, and thus a success gets returned as exit
> status 1 and a failure as exit status 0. This confuses at least
> the GNOME drive manager applet, and probably others as well.
> 
> Signed-off-by: Steinar H. Gunderson <sesse@debian.org>

Thanks.  Applied.

NeilBrown

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* Re: [PATCH] Fix umount.nfs exit status
  2007-07-14  9:18 [PATCH] Fix umount.nfs exit status Steinar H. Gunderson
  2007-07-16  0:59 ` Neil Brown
@ 2007-07-16 17:07 ` Chuck Lever
  1 sibling, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2007-07-16 17:07 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: nfs

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

Hi Steinar-

Steinar H. Gunderson wrote:
> Hi,
> 
> As per a bug report from a user:
> 
> mount.c seems to assume that nfsumount() uses standard C true/false
> return values, and inverts them for the exit status (where 0 is
> traditionally considered success). However, nfsumount() consistently
> seems to use 0 for success, and thus a success gets returned as exit
> status 1 and a failure as exit status 0. This confuses at least
> the GNOME drive manager applet, and probably others as well.
> 
> Signed-off-by: Steinar H. Gunderson <sesse@debian.org>
> 
> Index: nfs-utils-1.1.0/utils/mount/mount.c
> ===================================================================
> --- nfs-utils-1.1.0.orig/utils/mount/mount.c
> +++ nfs-utils-1.1.0/utils/mount/mount.c
> @@ -371,7 +371,7 @@ int main(int argc, char *argv[])
>                         umount_usage();
>                         exit(1);
>                 }
> -               exit(nfsumount(argc, argv) ? 0 : 1);
> +               exit(nfsumount(argc, argv));
>         }
> 
>         if(argv[1] && argv[1][0] == '-') {
> 
> /* Steinar */

Reviewing the NFS umount return path, I see other problems:

1.  nfsumount.c does not contain the string "EX_" which means it doesn't 
use the normal mount error return codes (and it probably should?).  For 
example, del_mtab() should return EX_FILEIO on error.  The use of 
improper umount options should return EX_USAGE.  A failure or negative 
result of the MNT RPC call should return EX_FAIL.

2.  _nfsumount returns an integer result which is ignored by it's only 
caller.  If the result truly doesn't matter (which I doubt), then 
_nfsumount should return void; otherwise the caller should be fixed to 
return _nfsumount's return code.

3.  nfs_call_umount returns an integer, but appears to be confused about 
whether one is success or zero is success.  In fact, it returns the 
value of "res" which is an enum clnt_stat, not a valid mount return code.

4.  There is one place where nfsumount.c needlessly uses exit(1) instead 
of returning.

I agree with removing the logic you eliminated, but more needs to be 
done in nfsumount.c to make this a complete fix.

[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 290 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
title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
url:http://oss.oracle.com/~cel
version:2.1
end:vcard


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

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

[-- 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-07-16 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-14  9:18 [PATCH] Fix umount.nfs exit status Steinar H. Gunderson
2007-07-16  0:59 ` Neil Brown
2007-07-16 17:07 ` 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.