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

Conversation

eborisch
Copy link

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<space><space>-n true

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

* * * * * username<space>-n true

works as expected (executes 'true').

Working cases (with or without this change)

  • 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 options and only one blank character between the username and the 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.

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 added a commit to eborisch/cron that referenced this pull request Feb 19, 2021
@eborisch
Copy link
Author

@eborisch
Copy link
Author

eborisch commented Mar 6, 2021

Resolved by upstream commit.

@eborisch eborisch closed this Mar 6, 2021
@eborisch
Copy link
Author

Re-opening for tracking until MFCed.

@eborisch eborisch reopened this Mar 22, 2021
@gonzoua gonzoua self-assigned this Jun 1, 2021
@gonzoua
Copy link
Contributor

gonzoua commented Jun 5, 2021

The fix has been MFCed to stable/13

@gonzoua gonzoua closed this Jun 5, 2021
hardenedbsd-services pushed a commit to HardenedBSD/hardenedBSD that referenced this pull request Feb 10, 2023
This adds the full set of jemalloc functions that FreeBSD's libc
exposes, including some (the `*allocm` family) that are gone from newer
versions of jemalloc and the `*allocx` family that replaced them.  These
are not necessarily efficient implementations but they should allow
snmalloc to replace jemalloc without any ABI breakage (in the loosest
possible sense).

Jemalloc provides a very generic sysctl-like mechanism for setting and
getting some values.  These are all implemented to return the
not-supported error code.  This may break code that expects that they
will succeed.

In particular, these APIs are used to register custom backing-store
allocators and to manage caches and arenas.  These concepts don't map
directly onto snmalloc and attempting to do so would almost certainly
not provide the same performance characteristics and so it's better to
`LD_PRELOAD` jemalloc (or explicitly link to it) for programs that gain
a significant speedup from this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants