Don't require tasks to begin with an executable file
Needs ReviewPublic

Authored by mcbits on Oct 29 2017, 4:17 AM.

Details

Reviewers
cfeck
Summary

BUG: 367782

It's normal for a cronjob to begin with text that doesn't correspond to an executable file--for example, to set an environment variable. This patch removes the validation logic that currently prevents users from creating or modifying such jobs through the GUI.

Diff Detail

Repository
R350 KCron
Lint
Lint Skipped
Unit
Unit Tests Skipped
mcbits created this revision.Oct 29 2017, 4:17 AM
anthonyfieroni added a subscriber: anthonyfieroni.
anthonyfieroni added inline comments.
src/taskEditorDialog.cpp
745

It's good to inform user that it'll interpret like environment variable. Something like

if (!QStandardPaths::findExecutable(binaryCommand, QStringList() << path).isEmpty() || specialValidCommands.contains(binaryCommand)) {
    setupTitleWidget(i18n("<i>Command will NOT be treated like executable.</i>"), KTitleWidget::InfoMessage);
}

Even without patch you can hijack like this

ENVIR=test; echo 'setting'
unset ENVIR; echo 'unsetting'
ngraham retitled this revision from Don't require tasks to begin with an executable file. to Don't require tasks to begin with an executable file.Nov 7 2017, 10:01 PM
ngraham edited the summary of this revision. (Show Details)
mcbits added inline comments.Jan 13 2018, 1:18 AM
src/taskEditorDialog.cpp
745

Without the patch, you can't set ENVIR like that through the GUI because ENVIR isn't an executable and KCron bafflingly requires every cron entry to begin with an executable (which cron doesn't require). The patch makes it work as expected. What's the purpose of "Warning: this will work as expected"?