Package: cron
Version: 3.0pl1-127
Severity: wishlist
Tags: patch
I recently had a Bad Time because the following syntax to specify an
empty environment variable is not supported:
VAR=
Rather, it should be:
VAR=""
This is, of course, well-documented (!) but it would be a little more
user-friendly if this Just Worked. This is especially so as it is
not--in my experience--widespread practice to quote non-empty variables,
so one is likely to simply remove the *value* resulting in an invalid
file.. which is then not executed whatsoever.
Patch attached. (An alternative solution would be to test *c within the
EQ1 case, but this looked inferior when I tried it IMHO.)
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/crontab.5 b/crontab.5
index 66ba2e4..c0041a1 100644
--- a/crontab.5
+++ b/crontab.5
@@ -55,7 +55,7 @@ The
.I value
string may be placed in quotes (single or double, but matching) to preserve
leading or trailing blanks. To define an empty variable, quotes
-.B must
+can
be used. The
.I value
string is
diff --git a/env.c b/env.c
index 76238ce..6644d6b 100644
--- a/env.c
+++ b/env.c
@@ -231,7 +231,8 @@ load_env(envstr, f)
abort();
}
}
- if (state != FINI && !(state == VALUE && !quotechar)) {
+ if (state != FINI && !(state == VALUE && !quotechar)
+ && !(state == EQ2 && !quotechar)) {
Debug(DPARS, ("load_env, not an env var, state = %d\n", state))
fseek(f, filepos, 0);
Set_LineNum(fileline);