Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cron: Consume blanks in system crontabs before options. #456

Closed
wants to merge 1 commit into from

Commits on Feb 19, 2021

  1. cron: Consume blanks in system crontabs before options.

    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] options.
    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 like:
    
      * * * * * 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.
    eborisch committed Feb 19, 2021
    Configuration menu
    Copy the full SHA
    bda54b6 View commit details
    Browse the repository at this point in the history