Skip to content

Spinner in core.func scrolls the terminal instead of redrawing when msg_info text exceeds terminal width (update-apps.sh)Β #17021

Description

@alecmeelan

βœ… Have you read and understood the above guidelines?

yes

πŸ”Ž Did you run the script with verbose mode enabled?

Yes, verbose mode was enabled and the output is included below

πŸ“œ What is the name of the script you are using?

PVE LXC Apps Update

πŸ“‚ What was the exact command used to execute the script?

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/update-apps.sh)"

βš™οΈ What settings are you using?

  • Default Settings
  • Advanced Settings

πŸ–₯️ Which Linux distribution are you using?

Debian 12

🧱 Is this Proxmox host running arm64?

No

πŸ“ˆ Which Proxmox version are you on?

pve-manager/9.2.11/f6997e698c7933ea (running kernel: 7.0.14-15-pve)

πŸ“ Provide a clear and concise description of the issue.

spinner() in misc/core.func redraws each frame with:

printf "\r\033[2K%s %b" "${CS_YWB}${chars[$index]}${CS_CL}" "${CS_YWB}${msg}${CS_CL}"

\r returns to column 0 of the current row and \033[2K erases only that
row. Neither is width-aware, so when the message is wider than the terminal it
soft-wraps: the cursor ends up on the wrapped second row, the next frame clears
and rewrites that row, wraps again onto a new row, and so on β€” one new line
every 0.1s until the operation completes.

tools/pve/update-apps.sh reliably triggers this. Its container-loading
message is:

Loading all possible LXC containers from Proxmox VE with tags: community-script, proxmox-helper-scripts. This may take a few seconds...

With the spinner glyph and space that's ~137 columns, so it wraps on any
terminal narrower than that β€” including the default Proxmox web shell and most
SSH windows. It looks like a regression: the ${tags_formatted} interpolation
added with the var_tags option pushed a previously-fitting message past the
usual width.

This affects core.func generally, not just this script β€” any msg_info string
long enough to wrap will behave the same way.

πŸ”„ Steps to reproduce the issue.

  1. Size a terminal to 120 columns (or use the default Proxmox web shell).
  2. Run: bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/update-apps.sh)"
  3. Confirm the whiptail prompt.
  4. Watch the "Loading all possible LXC containers..." step β€” instead of one
    animated line, a new line is printed per spinner frame and the screen scrolls.

Environment: Proxmox VE 9.2.11, bash, run from the web shell. Reproduces at any width below ~140 columns; does not
reproduce at 140+.

❌ Paste the full error output (if available).

Note that verbose mode does not reproduce this
issue: is_verbose_mode() in msg_info() takes the static hourglass branch and
spinner() is never started, so the spinner code path is skipped entirely.
The tool's own log file has the same limitation β€” log_msg() records one
[INFO] line per message, not the redraw frames.

This is a terminal rendering bug in spinner(), so the evidence is the raw
terminal capture (attached, recorded with script(1)) plus tput cols = 130.

Verbose log included for completeness.
20260904_145910.log

Shell output
update-apps-terminal.txt

πŸ–ΌοΈ Additional context (optional).

Suggested fix

 spinner() {
   local chars=(β ‹ β ™ β Ή β Έ β Ό β ΄ β ¦ β § β ‡ ⠏)
   local msg="${SPINNER_MSG:-Processing...}"
-  local i=0
+  local cols max i=0
+  cols=$(tput cols 2>/dev/null || echo 80)
+  max=$((cols - 4))
+  ((${#msg} > max)) && msg="${msg:0:max}"
   while true; do
     local index=$((i++ % ${#chars[@]}))
     printf "\r\033[2K%s %b" "${CS_YWB}${chars[$index]}${CS_CL}" "${CS_YWB}${msg}${CS_CL}"
     sleep 0.1
   done
 }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions