public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Friedrich Weber <f.weber@proxmox.com>
To: Gabriel Goller <g.goller@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH proxmox-backup v2] client: mount: flush output before exiting
Date: Tue, 18 Jun 2024 13:20:31 +0200	[thread overview]
Message-ID: <c4d28f1d-bc85-46c4-bc5b-f4aa61b5051c@proxmox.com> (raw)
In-Reply-To: <20240614093940.149087-1-g.goller@proxmox.com>

Thanks for tackling this! I ran into this issue (sometimes missing error
output) when I was running `sudo proxmox-backup-client mount [...]` and
forgot that PBS_REPOSITORY was not passed through by sudo. It looks like
in this case, the patch doesn't completely fix this issue -- seems like
I'm still missing the error output sometimes:

$ sudo ./proxmox-backup-client mount \
        "$SNAPSHOT" $FILE $PATH \
        --keyfile $KEYFILE --ns $NS
$ sudo ./proxmox-backup-client mount \
        "$SNAPSHOT" $FILE $PATH \
        --keyfile $KEYFILE --ns $NS
$ sudo ./proxmox-backup-client mount \
        "$SNAPSHOT" $FILE $PATH \
        --keyfile $KEYFILE --ns $NS
Error: unable to get (default) repository

On 14/06/2024 11:39, Gabriel Goller wrote:
> When using the `proxmox-backup-client mount` command, the parent sometimes
> exits before we can print any error message. Most notably this happens
> when no PBS_REPOSITORY is passed, as this is the first option checked.
> Flush the stdout and stderr so that we can guarantee the output.
> 
> Reported-by: Friedrich Weber <f.weber@proxmox.com>
> Suggested-by: Christian Ebner <c.ebner@proxmox.com>
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
> 
> v2, thanks @Christian:
>  - Removed unneeded pw.try_clone()
> 
>  proxmox-backup-client/src/mount.rs | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/proxmox-backup-client/src/mount.rs b/proxmox-backup-client/src/mount.rs
> index b69e7e80..e7718b84 100644
> --- a/proxmox-backup-client/src/mount.rs
> +++ b/proxmox-backup-client/src/mount.rs
> @@ -1,6 +1,7 @@
>  use std::collections::HashMap;
>  use std::ffi::OsStr;
>  use std::hash::BuildHasher;
> +use std::io::{self, Write};
>  use std::os::unix::io::{AsRawFd, OwnedFd};
>  use std::path::{Path, PathBuf};
>  use std::sync::Arc;
> @@ -189,7 +190,10 @@ fn mount(
>          Ok(ForkResult::Child) => {
>              drop(pr);
>              nix::unistd::setsid().unwrap();
> -            proxmox_async::runtime::main(mount_do(param, Some(pw)))
> +            let result = proxmox_async::runtime::main(mount_do(param, Some(pw)));
> +            io::stdout().flush()?;
> +            io::stderr().flush()?;
> +            result
>          }
>          Err(_) => bail!("failed to daemonize process"),
>      }


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  parent reply	other threads:[~2024-06-18 11:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14  9:39 Gabriel Goller
2024-06-14  9:54 ` Christian Ebner
2024-06-18 11:20 ` Friedrich Weber [this message]
2024-06-18 11:41   ` Christian Ebner
2024-06-18 12:29     ` Gabriel Goller
2024-06-18 13:00       ` Christian Ebner
2024-06-18 13:10         ` Gabriel Goller
2024-06-18 12:32     ` Friedrich Weber
2024-06-18 12:42       ` Christian Ebner
2024-06-18 12:53       ` Gabriel Goller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4d28f1d-bc85-46c4-bc5b-f4aa61b5051c@proxmox.com \
    --to=f.weber@proxmox.com \
    --cc=g.goller@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal