You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When anacron parses a line in anacrontab it accidentally ignores any backslashes which are not followed by a newline and so they are removed from the command that is run. I came across this whilst trying to use the -exec action of the find command which requires a backslash semi-colon \; to terminate it correctly.
As an example consider an anacrontab line such as:
1 0 report echo "Can you see these backslashes? \\\\"
The backslashes are never output. Looking in anacron/readtab.c, function read_tab_line looks like this:
staticchar*read_tab_line (void)
/* Read one line and return a pointer to it.Return NULL if no more lines. */
{
intc, prev=0;
if (feof(tab)) returnNULL;
while (1)
{
c=getc(tab);
if ((c=='\n'&&prev!='\\') ||c==EOF)
{
if (0!=prev) obstack_1grow(&input_o, (char)prev);
break;
}
if ('\\'!=prev&&0!=prev&&'\n'!=prev) obstack_1grow(&input_o, (char)prev);
elseif ('\n'==prev) obstack_1grow(&input_o, ' ');
prev=c;
}
if (ferror(tab)) die_e("Error reading %s", anacrontab);
obstack_1grow(&input_o, '\0');
returnobstack_finish(&input_o);
}
As far as I can tell whenever we examine a backslash i.e. prev == '\\' there's no way if can be added to input_o due to all the guards against it. So it just gets skipped over?
The text was updated successfully, but these errors were encountered:
When anacron parses a line in anacrontab it accidentally ignores any backslashes which are not followed by a newline and so they are removed from the command that is run. I came across this whilst trying to use the
-exec
action of thefind
command which requires a backslash semi-colon\;
to terminate it correctly.As an example consider an anacrontab line such as:
The backslashes are never output. Looking in anacron/readtab.c, function read_tab_line looks like this:
As far as I can tell whenever we examine a backslash i.e.
prev == '\\'
there's no way if can be added to input_o due to all the guards against it. So it just gets skipped over?The text was updated successfully, but these errors were encountered: