* Return status of mnt_context_mount when helper is used
@ 2012-09-18 23:08 Amit
2012-09-19 10:06 ` Karel Zak
0 siblings, 1 reply; 4+ messages in thread
From: Amit @ 2012-09-18 23:08 UTC (permalink / raw)
To: util-linux
Hello,
When trying to mount samba shares using *mnt_context_mount*, the
*mount.cifs* helper is called and used. This allows for automatic
resolving of hostnames.
However, if the hostname is not valid and the resolve fails,
the call *mnt_context_mount* is still successful. Using
*mnt_init_debug*, the mount.cifs helper returns an error code but this
is not propagated to the status of mnt_context_mount or
mnt_context_get_status.
This has been tried with util-linux 2.20.1 and the latest util-linux
from git (as of today).
Is there a way to check the return status of the helper?
START TRACE
mount error: could not resolve address for pmanalo-pc2: Unknown error
libmount: CXT: [0x811010]: /sbin/mount.cifs executed [status=1]
libmount: CXT: [0x811010]: don't update: external helper
mount_cifs: mnt_context_mount return code = 0 status = 1
mount_cifs: error:
libmount: CXT: [0x811010]: <---- reset [status=1] ---->
libmount: CACHE: [0x811350]: free
libmount: CXT: [0x811010]: <---- free
END TRACE
Thanks,
Amit
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Return status of mnt_context_mount when helper is used
2012-09-18 23:08 Return status of mnt_context_mount when helper is used Amit
@ 2012-09-19 10:06 ` Karel Zak
2012-09-19 22:14 ` Amit Uttamchandani
0 siblings, 1 reply; 4+ messages in thread
From: Karel Zak @ 2012-09-19 10:06 UTC (permalink / raw)
To: Amit; +Cc: util-linux
On Tue, Sep 18, 2012 at 11:08:16PM +0000, Amit wrote:
> Hello,
>
> When trying to mount samba shares using *mnt_context_mount*, the
> *mount.cifs* helper is called and used. This allows for automatic
> resolving of hostnames.
>
> However, if the hostname is not valid and the resolve fails,
> the call *mnt_context_mount* is still successful. Using
> *mnt_init_debug*, the mount.cifs helper returns an error code but this
> is not propagated to the status of mnt_context_mount or
> mnt_context_get_status.
docs:
* mnt_context_get_status:
* @cxt: mount context
*
* Global libmount status.
*
* The real exit code of the mount.type helper has to be tested
* by mnt_context_get_helper_status(). The mnt_context_get_status()
* only inform that exec() has been successful.
> This has been tried with util-linux 2.20.1 and the latest util-linux
> from git (as of today).
>
> Is there a way to check the return status of the helper?
>
> START TRACE
>
> mount error: could not resolve address for pmanalo-pc2: Unknown error
> libmount: CXT: [0x811010]: /sbin/mount.cifs executed [status=1]
> libmount: CXT: [0x811010]: don't update: external helper
> mount_cifs: mnt_context_mount return code = 0 status = 1
> mount_cifs: error:
> libmount: CXT: [0x811010]: <---- reset [status=1] ---->
> libmount: CACHE: [0x811350]: free
> libmount: CXT: [0x811010]: <---- free
See sys-utils/mount.c: mk_exit_code()
if (mnt_context_helper_executed(cxt))
mnt_context_get_helper_status(cxt);
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Return status of mnt_context_mount when helper is used
2012-09-19 10:06 ` Karel Zak
@ 2012-09-19 22:14 ` Amit Uttamchandani
2012-09-20 10:12 ` Karel Zak
0 siblings, 1 reply; 4+ messages in thread
From: Amit Uttamchandani @ 2012-09-19 22:14 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
On Wed, Sep 19, 2012 at 12:06:38PM +0200, Karel Zak wrote:
[snip]
>
> docs:
>
> * mnt_context_get_status:
> * @cxt: mount context
> *
> * Global libmount status.
> *
> * The real exit code of the mount.type helper has to be tested
> * by mnt_context_get_helper_status(). The mnt_context_get_status()
> * only inform that exec() has been successful.
>
I guess this was implemented after util-linux-2.20.1 since the docs in
that version does not mention it. Also, it is not implemented in the
code.
What would you recommend as a work around? Should I statically link
libmount and bundle it with the application?
Thanks,
Amit
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Return status of mnt_context_mount when helper is used
2012-09-19 22:14 ` Amit Uttamchandani
@ 2012-09-20 10:12 ` Karel Zak
0 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2012-09-20 10:12 UTC (permalink / raw)
To: Amit Uttamchandani; +Cc: util-linux
On Wed, Sep 19, 2012 at 03:14:27PM -0700, Amit Uttamchandani wrote:
> On Wed, Sep 19, 2012 at 12:06:38PM +0200, Karel Zak wrote:
>
> [snip]
>
> >
> > docs:
> >
> > * mnt_context_get_status:
> > * @cxt: mount context
> > *
> > * Global libmount status.
> > *
> > * The real exit code of the mount.type helper has to be tested
> > * by mnt_context_get_helper_status(). The mnt_context_get_status()
> > * only inform that exec() has been successful.
> >
>
> I guess this was implemented after util-linux-2.20.1 since the docs in
> that version does not mention it. Also, it is not implemented in the
> code.
>
> What would you recommend as a work around?
Hmm... the status from mount.<type> is stored in cxt->helper_status,
but this variable is nowhere exported in v2.20.
> Should I statically link
> libmount and bundle it with the application?
Yes, or update to 2.21.2 or v2.22 :-)
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-20 10:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-18 23:08 Return status of mnt_context_mount when helper is used Amit
2012-09-19 10:06 ` Karel Zak
2012-09-19 22:14 ` Amit Uttamchandani
2012-09-20 10:12 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).