[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#609162: debian-policy: package names with dots/periods ('.') and crontab files: packagers beware



Hi!

On Tue, Mar 01, 2011 at 09:22:22PM -0600, Jonathan Nieder wrote:
> Hi Karl,
> 
> Karl E. Jorgensen wrote:
> 
> > The debian policy section 9.5 [1] suggests using the package name as a
> > file name when creating files in /etc/cron.d, /etc/cron.hourly,
> > /etc/cron.daily etc.  This works well *unless* the package name
> > includes a dot ('.'), as this forces the file name to include a
> > dot. And cron will ignore the files as a result.
> 
> Thanks for raising this.  I agree that we should change the advice
> 
> 	If a certain job has to be executed at some other frequency or
> 	at a specific time, the package should install a file
> 	/etc/cron.d/<package>
> 
> to reflect the run-parts rule
> 
> 	If neither the --lsbsysinit option nor the --regex option is
> 	given then the names must consist entirely of ASCII upper- and
> 	lower-case letters, ASCII digits, ASCII underscores, and ASCII
> 	minus-hyphens.
> 
> The current rule for package names (from §5.6.1) is
> 
> 	[a-z0-9][-+a-z0-9.]+
> 
> so the problematic characters are dot ('.'), which you mentioned,
> and plus ('+').

Oh - I hadn't spotted that one. You are quite correct.

> You proposed to advocate substituting hyphens for dots, but that
> would create problems when the names of two packages differ only
> by punctuation:
> 
> 	great-package
> 	great.package
> 
> Maybe we don't have to worry about such an insane case.  In any event,
> it's easy to avoid that problem by substituting underscores for dots
> and P for plus signs.

That _would_ be an almost insane case, and I hope that the packages
avoid having such nearly-indistinguishable package names. Not only
will it cause problems for the crontab entries, but (more importantly)
affect the sanity of users...

One thing that should be considered here is other implementations of
cron... I'm not familiar with any, if you know of any please flag it
up.

> Sensible?  If so, would you like to propose wording for this?

Can do. are two sentences in secion 9.5 which will need to be changed. 

The 2nd sentence in 9.5, which currently reads:

    If a package wants to install a job that has to be executed via
    cron, it should place a file with the name of the package in one
    or more of the following directories:

could be changed to:

    If a package wants to install a job that has to be executed via
    cron, it should place a file with the name of the package (with a
    file name as specified in section 9.5.1) in one or more of the
    following directories:

And further down, the sentence which currently reads:

    If a certain job has to be executed at some other frequency or at
    a specific time, the package should install a file
    /etc/cron.d/package

could be changed to:

    If a certain job has to be executed at some other frequency or at
    a specific time, the package should install a file
    /etc/cron.d/package (with a file name as specified in section
    9.5.1)

and a new section:

    9.5.1 File Names for Cron Jobs

    File names representing cron jobs should generally be named
    according to the package from which it comes.

    If a package supplies multiple crontab files in the same
    directory, the file names should all start with the name of the
    package followed by a hyphen ('-') and a suitable suffix.

    The resulting file name must not include any '.' or '+' characters
    as this will cause cron to ignore them.  Underscores ('_') should
    be used instead of '.' and '+' characters.

How does that sound?

-- 
Karl E. Jorgensen



Reply to: