From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pve-devel] [RFC PATCH storage] pvesm export: convert dd's \r in status=progress output to \n
Date: Thu, 16 Jan 2025 10:21:01 +0100 [thread overview]
Message-ID: <bb833188-4219-4cc8-92d2-fc37a84221fa@proxmox.com> (raw)
In-Reply-To: <27ec7af2-cfa8-4202-9137-eb9182b80e52@proxmox.com>
Am 16.01.25 um 09:13 schrieb Dominik Csapak:
>> FWIW, you could test with `-t STDERR` if the std error FD is a terminal
>> and differ between replacing \r or not.
>>
> not sure if that would work here since we do quite some redirection for
> the worker task (to be able to display + putting it in the task log at
> the same time), but yes, I'll try that
>
>>> AFAICS there is no easy way to only do this for the task log, since
>>> we simply pipe the output fh of the worker task to the task log fh.
>>>
>>> Alternatively we could patch the task log api to parse \r as newlines or
>>> patch the yew widget toolkit to replace \r with \n.
>> Wouldn't be one alternative also be to do that in the UI?
> thats what i meant in that sentence. (replacing in yew widget toolkit)
Ah OK, seems I sorta skipped reading after the first half of the
sentence, sorry.
Well, I see some merit in having this done at backend side, having some
consistency and avoiding that other API consumer need to to such
transformations, but it then might be worth thinking about doing it more
generally.
I shortly looked into that (fork_worker and run_command) and I initiially
got slightly confused, as in run_command we already do
`print STDERR "$laststderr\n" if $laststderr;` for the case there is no
errfunc defined, with $laststderr being a single line without any limiter
(\r and/or \n or \b, fwiw), but that's only called if there is a errmsg
parameter; bleh, run_command should really be reworked (or die).
So FWIW, this could be also "fixed" by passing something like
errmsg => "failed to write file '$file'" ... <.<
Another completely different option, skip DD and do the write ourself,
might be even be done relatively easily with the sendfile syscall in
a loop of 64K blocks and some output every few seconds, i.e. not
totally trivial, but also not _that_ hard, just mentioning for sake
of completeness, even if we want to go in that direction we can employ
transforming the \r to \n as a stop gap.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-01-16 9:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 9:59 Dominik Csapak
2025-01-15 10:04 ` Dominik Csapak
2025-01-15 11:28 ` Thomas Lamprecht
2025-01-16 8:13 ` Dominik Csapak
2025-01-16 8:51 ` Fabian Grünbichler
2025-01-16 9:21 ` Thomas Lamprecht [this message]
2025-01-16 9:38 ` Dominik Csapak
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=bb833188-4219-4cc8-92d2-fc37a84221fa@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=d.csapak@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