public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Christoph Heiss" <c.heiss@proxmox.com>
To: "Daniel Kral" <d.kral@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH installer v2] auto: allow a binary executable as the first boot executable
Date: Fri, 13 Dec 2024 11:00:09 +0100	[thread overview]
Message-ID: <D6AHH8D940P7.3M53T2TUAZGMN@proxmox.com> (raw)
In-Reply-To: <20241211092436.69088-1-d.kral@proxmox.com>

LGTM. Tested with a shell script and a compiled binary, w/ and w/o
sending the `Content-Length` header in the response.

The "Automated Installation" page needs to be updated though, to
reflect:

a) that either shell-scripts or compiled binaries can be used and
b) that the compiled binaries must be (obviously) x86_64 and best case
   statically linked, as there otherwise no guarantees that it will run
   on the target system and might just fail blindly.

Please consider this patch:

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>

FWIW, just thinking out loud here: Maybe the fetching of the first-boot
hook should be moved into `proxmox-fetch-answer` altogether. In a sense
that `proxmox-fetch-answer` would fetch all the needed things in
advance, such that the auto-installer, post-hook etc. doesn't have to do
that anymore.
But that's really not pressing of any kind, rather a long-term thing.

On Wed Dec 11, 2024 at 10:24 AM CET, Daniel Kral wrote:
> As the initial use case for the first boot feature request [0] was for
> running shell scripts, the auto installer retrieved the binary as a
> `String`. Unfortunately, this tries to interpret binary data as UTF-8
> and will transform 'invalid' characters to replacement characters [1].
>
> This causes the auto-installer to create an invalid binary when fetching
> from an URL, and error with a `stream did not contain valid UTF-8` error
> when fetching from the ISO image.
>
> To allow binary executables to be used as a first boot executable, this
> commit changes the fetching from being read as a `String` to being read
> as a `Vec<u8>` to not interfere with the content of the executable.
>
> [0] https://bugzilla.proxmox.com/show_bug.cgi?id=5579
> [1] https://doc.rust-lang.org/src/alloc/string.rs.html#635
>
> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
> ---
> changes from v1:
>   - remove explicit handling of `std::io::ErrorKind::UnexpectedEof`
>
>  .../src/bin/proxmox-auto-installer.rs          | 12 ++++++++----
>  proxmox-installer-common/src/http.rs           | 18 ++++++++++++++----
>  2 files changed, 22 insertions(+), 8 deletions(-)
> [..]


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


  reply	other threads:[~2024-12-13 10:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11  9:24 Daniel Kral
2024-12-13 10:00 ` Christoph Heiss [this message]
2024-12-18  7:29   ` Daniel Kral

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=D6AHH8D940P7.3M53T2TUAZGMN@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=d.kral@proxmox.com \
    --cc=pve-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