🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.bugs
Article #463

[Bug 299413] sysrc fails with $

#463
From: bugzilla-noreply
Date: Sat, 14 Nov 2026 17:55
42 lines
3626 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=299413

--- Comment #1 from Kushagra Chauhan <zenzesama@gmail.com> ---
Hi,

I reproduced this with the sysrc and sysrc.subr from current main, and
read the code in usr.sbin/sysrc/sysrc and sysrc.subr.

The cause is in the plain-assignment case. "before" comes from
f_sysrc_get, which sources the rc.conf files in a subshell and returns
the expanded value. "new" is the raw text from the command line
(${1#*=}). The -c check then does [ "$new" != "$before" ]. With
cron_flags="$cron_flags -J 15" in the file, before is " -J 15" and new
is "$cron_flags -J 15", so they can never match.

Before c97460c4d97d (PR 279200) the check also compared the
f_sysrc_get output against ${1#*=}. APPEND and REMOVE build "new" from
the expanded "before", so only plain assignment mixes expanded and raw
text.

sysrc(8) says -c on an assignment succeeds "if no changes are
required". Running the same assignment without -c would rewrite the
line as it already is, so I think -c should compare against the raw
text in the file, not the expanded value. Is that intended?

If so, I'm happy to prepare a patch with a test in
tests/sysrc_test.sh. My idea is to leave the current comparison alone
and, only when it reports a difference, check whether the last
assignment in the file sysrc would edit is exactly NAME="<new>", and
treat that as unchanged.

Thanks,
Kushagra

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <bug-299413-227-5VpgSZ6MUG@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
References: <bug-299413-227@https.bugs.freebsd.org/bugzilla/>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: bugzilla-noreply@freebsd.org
Newsgroups: muc.lists.freebsd.bugs
Subject: [Bug 299413] sysrc fails with $
Date: Sat, 14 Nov 2026 17:55:19 +0000
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <bug-299413-227-5VpgSZ6MUG@https.bugs.freebsd.org/bugzilla/>
References: <bug-299413-227@https.bugs.freebsd.org/bugzilla/>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="79889"; mail-complaints-to="news-admin@muc.de"
X-Original-To: bugs@mlmmj.nyi.freebsd.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1794678920;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=vStlwp7hmNosRwlJiMFgdvsA8MvvqqqZD3F/vx8K+Zs=;
	b=XG6bIKtxKhQ9FOOOXX5r5ch34EjWrgWgn/dkQCRNDBOWNlC5U0hvnlBQollmf83/5z5a42
	OB0R2oBWF3K0Km9iTGfvMSjLKVQlbuURJtnOrDcxsDP/KXF6al4SnnRrOGsJoIFAMmnrPo
	6Qr98bgWclXQWDevSqwyl/l6On63m+L/GXX4X13W//6amNmki+flvmfDn+C8cZ5xlj4pn3
	YkIeKy8EaOMFB12TEeq2Wi1QRE/63hq3235/QHKwpoIwDioS0ZxcgxVSbdAmWhnDQSGpP/
	bJ/fcslw36h9hmBWbgT80Gs5TQT2Sxj1gYg+zPH4p1Z84+uTUGbqxi+3EqMu4Q==
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
In-Reply-To: <bug-299413-227@https.bugs.freebsd.org/bugzilla/>
Auto-Submitted: auto-generated
Precedence: list
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes