Page MenuHomeFreeBSD

os-release: Quote variables as documented in the manual
ClosedPublic

Authored by 0mp on Nov 23 2021, 10:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 10 2024, 9:09 PM
Unknown Object (File)
Nov 24 2023, 5:16 AM
Unknown Object (File)
Nov 5 2023, 4:49 AM
Unknown Object (File)
Sep 11 2023, 1:46 PM
Unknown Object (File)
Aug 10 2023, 1:03 PM
Unknown Object (File)
Jun 20 2023, 11:07 AM
Unknown Object (File)
Jun 15 2023, 7:24 AM
Unknown Object (File)
Nov 28 2022, 7:15 PM
Subscribers
None

Details

Reviewers
imp
glebius
Summary

Variables must be quoted if they contain non-alphanumeric characters.

MFC after: 7 days

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42933
Build 39821: arc lint + arc unit

Event Timeline

0mp requested review of this revision.Nov 23 2021, 10:29 AM
0mp created this revision.

From the standard:

The application shall quote the following characters if they are to represent themselves:

& ; < > ( ) $ ` \ " ' <space> <tab> <newline>

and the following may need to be quoted under certain circumstances. That is, these characters may be special depending on conditions described elsewhere in this volume of POSIX.1-2017:

  • ? [ # ˜ = %

None of these are possible with the freebsd-version -u output. A number of other things break if people use 'custom' release names with spaces in them...
I'm OK with this change, but the need to do it seems quite low and edge-casey.

This revision is now accepted and ready to land.Nov 23 2021, 3:52 PM

Seems legit, but I'm not expert in this area.

In D33092#747700, @imp wrote:

From the standard:

The application shall quote the following characters if they are to represent themselves:

& ; < > ( ) $ ` \ " ' <space> <tab> <newline>

and the following may need to be quoted under certain circumstances. That is, these characters may be special depending on conditions described elsewhere in this volume of POSIX.1-2017:

  • ? [ # ˜ = %

None of these are possible with the freebsd-version -u output. A number of other things break if people use 'custom' release names with spaces in them...
I'm OK with this change, but the need to do it seems quite low and edge-casey.

I absolutely agree that it does not matter from sh(1) perspective, but the manual page says that non-alphanumeric values must be quoted. Maybe there is software out there that relies on that. This is rather unlikely. Nevertheless, being consistent with out own documentation is definitely worth the effort. Ubuntu for example quotes those values as documented.

In D33092#748046, @0mp wrote:
In D33092#747700, @imp wrote:

From the standard:

The application shall quote the following characters if they are to represent themselves:

& ; < > ( ) $ ` \ " ' <space> <tab> <newline>

and the following may need to be quoted under certain circumstances. That is, these characters may be special depending on conditions described elsewhere in this volume of POSIX.1-2017:

  • ? [ # ˜ = %

None of these are possible with the freebsd-version -u output. A number of other things break if people use 'custom' release names with spaces in them...
I'm OK with this change, but the need to do it seems quite low and edge-casey.

I absolutely agree that it does not matter from sh(1) perspective, but the manual page says that non-alphanumeric values must be quoted. Maybe there is software out there that relies on that. This is rather unlikely. Nevertheless, being consistent with out own documentation is definitely worth the effort. Ubuntu for example quotes those values as documented.

I guess I'm not clear which documentation you are referring to...