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)
Sat, Sep 21, 5:05 AM
Unknown Object (File)
Mon, Sep 16, 2:27 PM
Unknown Object (File)
Sun, Sep 8, 9:42 AM
Unknown Object (File)
Sat, Sep 7, 7:40 PM
Unknown Object (File)
Wed, Sep 4, 11:03 PM
Unknown Object (File)
Tue, Sep 3, 1:15 AM
Unknown Object (File)
Aug 10 2024, 8:26 PM
Unknown Object (File)
Jul 27 2024, 10:15 AM
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