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)
Wed, Oct 30, 1:53 AM
Unknown Object (File)
Mon, Oct 14, 4:29 PM
Unknown Object (File)
Oct 5 2024, 7:54 AM
Unknown Object (File)
Oct 5 2024, 12:53 AM
Unknown Object (File)
Oct 2 2024, 3:11 PM
Unknown Object (File)
Oct 2 2024, 1:44 AM
Unknown Object (File)
Oct 1 2024, 11:29 PM
Unknown Object (File)
Sep 30 2024, 3:17 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