Page MenuHomeFreeBSD

rc: Disable pathname expansion when calling run_rc_command()
ClosedPublic

Authored by hrs on Jul 3 2024, 9:09 AM.
Tags
Referenced Files
Unknown Object (File)
Sat, Nov 22, 9:17 AM
Unknown Object (File)
Thu, Nov 20, 7:30 PM
Unknown Object (File)
Fri, Nov 7, 9:52 PM
Unknown Object (File)
Thu, Nov 6, 11:58 PM
Unknown Object (File)
Mon, Nov 3, 8:07 PM
Unknown Object (File)
Mon, Nov 3, 8:05 PM
Unknown Object (File)
Mon, Nov 3, 8:04 PM
Unknown Object (File)
Mon, Nov 3, 8:03 PM

Details

Summary

Variables for command-line options like $foo_flags can contain characters
that perform pathname expansions, such as '[', ']', and '*'. They were
passed without escaping, and the matched entries in the working directory
affected the command-line options. This change turns off the expansion
when run_rc_command() is called.

While this changes the current behavior, an invocation of a service
program should not depend on entries in the working directory.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 58472
Build 55360: arc lint + arc unit

Event Timeline

hrs requested review of this revision.Jul 3 2024, 9:09 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jun 12 2025, 6:20 PM
This revision was automatically updated to reflect the committed changes.

This change introduced a regression where my allscreens_flags settings gets ignored at boot.

This change introduced a regression where my allscreens_flags settings gets ignored at boot.

Could you explain your configuation and behavior change in more detail?

In D45855#1160497, @hrs wrote:

Could you explain your configuation and behavior change in more detail?

Sure thing. I use the following in my rc.conf which enlarges the virtual terminal fonts from being small after loading a drm-kmod driver during the booting process:

allscreens_flags="-f spleen-16x32"

After doing a src tree build upgrade today this functionality had stopped. By manually removing both set -o noglob and set +o noglob lines, I restored the original functionality.

The problem is that allscreens_flags relies on the pathname expansion in two places:
https://github.com/freebsd/freebsd-src/blob/4deb9760a9d84d5861ee45162ffebe83f13503b8/libexec/rc/rc.d/syscons#L237-L243
https://github.com/freebsd/freebsd-src/blob/4deb9760a9d84d5861ee45162ffebe83f13503b8/libexec/rc/rc.d/syscons#L381-L387

In D45855#1160497, @hrs wrote:

Could you explain your configuation and behavior change in more detail?

Sure thing. I use the following in my rc.conf which enlarges the virtual terminal fonts from being small after loading a drm-kmod driver during the booting process:

allscreens_flags="-f spleen-16x32"

After doing a src tree build upgrade today this functionality had stopped. By manually removing both set -o noglob and set +o noglob lines, I restored the original functionality.

The problem is that allscreens_flags relies on the pathname expansion in two places:
https://github.com/freebsd/freebsd-src/blob/4deb9760a9d84d5861ee45162ffebe83f13503b8/libexec/rc/rc.d/syscons#L237-L243
https://github.com/freebsd/freebsd-src/blob/4deb9760a9d84d5861ee45162ffebe83f13503b8/libexec/rc/rc.d/syscons#L381-L387

Does this patch solve your problem?

https://people.allbsd.org/~hrs/FreeBSD/f1692c.diff