[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
** Also affects: cron (CentOS) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/118168 Title: Crontab accepts files with no newline before EOL/EOF. Cron ignores file To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/cron/+bug/118168/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
This bug was fixed in the package cron - 3.0pl1-113ubuntu1 --- cron (3.0pl1-113ubuntu1) maverick; urgency=low * Merge from debian unstable. Fixes: - LP: #46493 (this should have been fixed way back in 3.0pl1-87, and I confirmed it is no longer a problem) - LP: #118168 (Debian #79037) - LP: #151231 (Debian #155109, #443615) - LP: #308341 (Debian #437180) * Remaining changes: - debian/control: + Build-Depends on debhelper >= 7.3.15ubuntu2, for Upstart + Drop MTA and lockfile-args to Suggests - add debian/cron.upstart - debian/postinst: remove calls to update-rc.d, invoke-rc.d and /etc/init.d/cron - debian/postrm: remove call to update-rc.d - debian/prerm: remove calls to invoke-rc.d and /etc/init.d/cron - debian/rules: install Upstart job * Drop the following changes, now in debian: - popen.c: check return code of initgroups() in cron_popen() - debian/control: add missing ${misc:Depends} - debian/control: Depends bump on lsb to >= 3.2.12ubuntu2. No longer required now that we use Upstart - debian/cron.pam: switch from including common-session to including the new common-session-noninteractive - pathnames.h: use sensible-editor cron (3.0pl1-113) unstable; urgency=medium [ Christian Kastner / Javier Fernandez-Sanguino ] * debian/postinst: - Now that permissions and ownership of crontabs are changed unconditionally, do not attempt to chown user crontabs if none are present. Closes: #585636 - Only change permissions if the crontabs directory exist cron (3.0pl1-112) unstable; urgency=low [ Christian Kastner ] * do_command.c: - Don't send mail when a job exits non-zero, only send mail if the job sent output to stderr. This behaviour was introduced erroneously; while it does have merit, it is completly against standard cron behaviour. Closes: #581612 * debian/compat: - Bumped debhelper compatibility to 7 * debian/control: - Bumped Standards-Version to 3.8.4 (no change needed) - Build-Depend on debhelper (>= 7.0.50~) - Added dependency on ${misc:Depends} to package cron * debian/cron.init: - Changed Default-Stop from (1) to (empty). rc0 and rc6 were removed in 3.0pl1-101 because the stop action -- sending SIGTERM/SIGKILL to cron on shutdown/reboot -- was redundant. This, however, also applies to rc1, because killprocs will do that for us. * debian/postinst: - Removed obsolete dpkg file backup code, this has been handed over to dpkg in 3.0pl1-109 - Removed last remaining stop action (for rc1) from upate-rc.d (see above) - Add dpkg-statoverride for /usr/bin/crontab, and unconditionally change permissions of /var/spool/cron/crontabs. Closes: #304036, #460095 * debian/standard.monthly: - Removed because it had been empty for years and therefore served no purpose * debian/cron.bug-{control,script} - Added to extend information submitted by reportbug * debian/rules: - Applied changes for standard.monthly and cron.bug-{control,script} above * debian/copyright: - Updated to reflect recent contributions * debian/README: - Updated ancient information with the current status (PAM support, SELinux support, etc.) * debian/TODO: - Added new entry regarding clarification of the purpose behind /etc/cron.d * debian/REFS: - Summary of links to relevant development threads; re-added for informational purposes. [ Javier Fernandez-Sanguino ] * debian/cron.init: - Fix typo (Closes: #585399) cron (3.0pl1-111) unstable; urgency=low [ Christian Kastner ] * debian/cron.init: - When both /etc/environment and /etc/default/locale contain locale information, warn that variables from /etc/environment will be ignored. Closes: #543895, #580942 - Add autofs and NIS+ to Should-Starts, because especially NIS+ must be run before cron, if present. Closes: #511757 - init script should be stopped in runlevel 0 and 6, too [ Javier Fernandez-Sanguino ] * do_command.c: Revert change so that mails are not sent if MAILTO is null. Closes: #580938 cron (3.0pl1-110) unstable; urgency=medium [ Christian Kastner ] * user.c - Fix broken parsing and handling of crontabs with no-newline-before-EOF - Refuse to install such crontabs via crontab(1). Closes: #79037 - Log crontabs missing newline before EOF to syslog. This is only relevant for crontabs not installed via crontab(1), ie. /etc/cron.d/* and /etc/crontab. Closes: #76625 - Add a log message explicitly stating that all jobs of crontabs with syntax errors will not be run (ie, all-or-nothing). See #555954 * crontab.c - Tell the user which chars are expected on retry, too * cron.c - Don't let the daemon die when directories disappear, eg. when moving directories around. Patch provided by Justin Pryzby (thanks!).
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
Nick Hill, are you still working on this? Thanks! -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
Unsubscribing main sponsors team for now. Please resubscribe once there is a patch to upload. Thanks for your work on this! -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
Hello Colin Being new to general-release code modifications, I suppose I have a starting point of taking a minimally-invasive approach; to take an approach least likely to introduce bugs. Eg if ported to Windows or OSX with different EOL conventions. \r \r\n That isn't to say I have any reason to believe the solution you and technomancy mentioned will introduce any bugs in Ubuntu, so I guess a consensus is growing around file modification. I'll take a look at that. -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
Nick, I don't think this makes sense. Why add a warning when crontab could just silently add the newline (assuming the text it's given has non-zero length), as a previous commenter suggested? It's always better to silently do the right thing, if possible, than to issue a warning. (Also, please always use 'diff -u' rather than plain diff; plain diff's output is not suitable for source code changes as it breaks as soon as the code it might be applied to changes.) -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
Here is an debdiff with the Patch from Nick Hill (the second one) ** Attachment added: "cron.debdiff" http://launchpadlibrarian.net/17352849/cron.debdiff -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
** Changed in: cron (Ubuntu) Assignee: (unassigned) => Nick_Hill (nick-nickhill) Status: Triaged => In Progress -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
Perhaps this version would be better. Adds extra lines to make warning clearer. ** Attachment added: "Slightly clearer warning for missing new line at EOF" http://launchpadlibrarian.net/17195340/crontab.c.diff -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
I have created a patch for crontab.c which adds a warning if there is no newline at the end of the file. I have followed the original author's example of generating a diagnostic if any file function breaks. Please consider integrating upstream. ** Attachment added: "Add warning if there is no newline at end of file, resulting in crontab being ignored." http://launchpadlibrarian.net/17195330/crontab.c.diff -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
** Changed in: cron (Ubuntu) Importance: Undecided => Medium Status: Confirmed => Triaged -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 118168] Re: Crontab accepts files with no newline before EOL/EOF. Cron ignores file
Setting the EDITOR to something that will solve the problem is a workaround. It's helpful, but really it's just a band-aid; cron needs to be fixed. If it weren't written in C I would submit the patch myself. There is no reason to silently ignore user input. Adding a newline silently would save a lot of frustration, and nobody is relying on the current behaviour. BTW, in Emacs just add this to your .emacs file: (setq require-final- newline t) -- Crontab accepts files with no newline before EOL/EOF. Cron ignores file https://bugs.launchpad.net/bugs/118168 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs