Page MenuHomeFreeBSD

bsdinstall: Add quotes around error message argument
ClosedPublic

Authored by thj on Jan 17 2022, 4:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 27, 1:51 AM
Unknown Object (File)
Thu, Apr 24, 1:17 AM
Unknown Object (File)
Sat, Apr 19, 7:15 PM
Unknown Object (File)
Sat, Apr 5, 12:27 PM
Unknown Object (File)
Mar 27 2025, 10:03 AM
Unknown Object (File)
Mar 26 2025, 4:48 PM
Unknown Object (File)
Mar 22 2025, 4:27 AM
Unknown Object (File)
Mar 20 2025, 6:01 PM
Subscribers

Details

Summary

bsdinstall: Add quotes around error message argument

When error is called with a message with spaces (and probably multiple lines)
these are passed into dialog unquoted and an error message is presented in the
form:

"Expected no more than 3 tokens for --msgbox have 9"

This has been seen on recent snapshots which also suffer from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261272

Test Plan

The following script shows the bug and the fix

	#!/bin/sh

	error()                                                                       
	{                                                                             
		dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox $1 0 0
	}                                                                             

	error_fixed()                                                                       
	{                                                                             
		dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox "$1" 0 0
	}                                                                             

	error "bug not fixed"
	read tmp
	error_fixed "bug fixed"

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

thj requested review of this revision.Jan 17 2022, 4:54 PM

yeah, --msgbox complains "Expected no more than 3 tokens for --msgbox, have 9." or however many words there were in your error message, plus the "0 0" parameters.

It seems we just didn't encounter this very often previously.

This revision is now accepted and ready to land.Jan 17 2022, 5:03 PM

Did this end up being EN'd for currently supported RELEASE's ?

We've been seeing increasing reports of this issue for people customising the distribution list or similar