Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Feb 2021 18:23:20 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 253699] cron: Fix options parsing in system crontabs.
Message-ID:  <bug-253699-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253699

            Bug ID: 253699
           Summary: cron: Fix options parsing in system crontabs.
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: eborisch+FreeBSD@gmail.com

Pull request up on GitHub; comment copied here.

https://github.com/freebsd/freebsd-src/pull/456

This change makes the state consistent between user and system crontabs
before processing options:  blanks have been consumed and the next
get_char() returns '-' or the start of the command.

Details:

On system crontabs, multiple blanks are not being consumed after reading the
username. This change adds blank consumption before parsing any -[qn] optio=
ns.
Without this change, an entry like:

  * * * * * username  -n true  # Two spaces between username and option.

will fail, as the shell will try to execute (' -n true'), while an entry li=
ke:

  * * * * * username -n true   # One space between username and option.

works as expected (executes 'true').

For entries without options, this is not an issue, as the leading blanks are
ignored by the shell when executing the command.

For entries with only one blank character between the username and options,
this is also not an issue, as the next get_char() returns '-' and option
processing occurs.

For user crontabs, this is not an issue as the preceding (day of week or
@shortcut) processing consumes any leading whitespace.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-253699-227>