crontab cuts off file names at 100 characters

Bug #826702 reported by Aaron Isotton
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
cron (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

The crontab command silently cuts off file names after 100 characters. This means that it won't work if you have a file with a path longer than 100 characters, and want to feed it into crontab. Example:

$ crontab _123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_this_will_be_cut_off
_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_12345678: No such file or directory

This is due to a MAX_FNAME constant set to 100 characters in cron.h. I updated the code to use PATH_MAX instead. This will still cut off the paths, but at least after a more reasonable number of characters.

Tags: patch

Related branches

Revision history for this message
Aaron Isotton (aisotton) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cron (Ubuntu):
status: New → Confirmed
Revision history for this message
Christian Kastner (ckk) wrote :

In the mean time, this limit has been raised to 1000 chars.

Revision history for this message
Christian Kastner (ckk) wrote :

A fix has been prepared that recognizes too long commands and produces an error message when attempting to create one, both via crontab(1) and cron(8). Furthermore, this limit has been documented in the man pages.

Changed in cron (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "vixiecron-pathmax.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cron - 3.0pl1-127ubuntu1

---------------
cron (3.0pl1-127ubuntu1) vivid; urgency=low

  * Merge from Debian unstable. Remaining changes:
    - debian/control:
      + Move MTA to Suggests field.
    - debian/cron.upstart: Add Upstart script.
    - debian/rules: Call dh_installinit to install Upstart job properly.
    - d/cron.default: change to a deprecated message to make it clear
      that the file is no longer in use.

cron (3.0pl1-127) unstable; urgency=medium

  * Drop $READ_ENV from cron's command line. It does not belong there.
    Closes: #766779

cron (3.0pl1-126) unstable; urgency=low

  * Packaging (general): removed unused files from the source that had been
    already removed in 3.0pl1-117 but got reintroduced due to a merge.

cron (3.0pl1-125) unstable; urgency=medium

  * Acknowledge NMUs. Thanks, Laurent Bigonville and Ansgar Burchardt.
    Closes: #749271

  [ Christian Kastner ]
  * debian/control:
    - Bump Standards-Version to 3.9.6 (no changes needed)
    - Canonicalize Vcs-* URLs
  * debian/copyright:
    - Bump years
    - Don't use spaces in License short name
  * debian/source/lintian-overrides:
    - Drop overrides from pre-UTF-8 debian/control era
  * debian/rules:
    - Extend documentation
  * debian/cron.init:
    - Include winbind in Should-Start/Stop. Closes: #732203
  * crontab.5:
    - Don't use hyphen as a minus sign
  * cron.8:
    - Drop stray words in cron.8. Thanks, Regid Ichira! Closes: #702091
    - Fix misspelled 'sytem'. Thanks, green! Closes: #753775
  * cron.c,crontab.c:
    - Use basename of argv[0] as syslog tag. Closes: #752750
  * cron.c:
     - Use case-insensitive comparison in charset selection. Thanks,
       Malcolm Scott! LP: #1169160
  * entry.c:
    - Detect invalid entry: step specified without a range. Thanks,
      Justin T. Pryzby! Closes: #733478
    - Error out when a command field is too long instead of silently
      truncating it. Closes: #686223, LP: #826702
  * do_command.c:
    - Fix initialization and increment of mailed bytes counter.
      Closes: #691488
  * cron.c, do_command.c:
    - Add an option -n to include FQDN in mail subject. Closes: #570423

  [ brian m. carlson ]
  * config.h, do_command.c:
    - Send proper 8-bit emails by including an appropriate MIME-Version and
      adjusting the Content-Transfer-Encoding header accordingly.
      Closes: #694686

  [ Javier Fernández-Sanguino ]
  * Change systemd definition in order for the daemon to read an honor
    /etc/default/cron (Closes: #754279)

cron (3.0pl1-124.2) unstable; urgency=medium

  * Non-maintainer upload.
  * debian/cron.service: Set IgnoreSIGPIPE=false. (Closes: #756047)
  * debian/cron.service: Add Documentation field.
 -- Michael Vogt <email address hidden> Mon, 27 Oct 2014 10:19:21 +0100

Changed in cron (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.