Comment in crontab file

Bug #1540285 reported by Y.DUPRAT
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-crontab
Invalid
Undecided
Unassigned

Bug Description

With a file as below

+-----------------------------------------------------------------------
#at reboot start ixelbox daemon
# @reboot c:\python27\python.exe C:\Users\yves\Desktop\Minerve\test\test.py --when=Once --debug

# execute each 5 mn, do test.py scripts
*/5 * * * * C:\Users\yves\Desktop\Minerve\test\test.py --when=m*/5 --user=value
---------------------------------------------------------------------------+

the second line is not perform as a comment but as a cron line (# is ignored)

Solution: in method 'parse' of class 'CronItem'

add a return before the 2 calls of metod self._set_parse

    def parse(self, line):
        """Parse a cron line string and save the info as the objects."""
        line = _unicode(line)
        if not line or line[0] == '#':
            self.enabled = False
            line = line[1:].strip()
            return # YD
        self._set_parse(ITEMREX.findall(line))
        self._set_parse(SPECREX.findall(line))

Revision history for this message
Y.DUPRAT (yvduprat) wrote :

Versions are;
python-crontab is 2.0.1
Python is 2.7.11

Revision history for this message
Martin Owens (doctormo) wrote :

Wouldn't this change break the old_job.enable() functionality that allows disabled jobs to be re-enabled?

Revision history for this message
Y.DUPRAT (yvduprat) wrote : Re: [Bug 1540285] Re: Comment in crontab file

I do not know but for me a # in crontab file means a start of comment.
Why keeps on to analyze the rest of line ?

Otherwise I will try to run the Scheduler with Win10 .... I have got
some problems around the SHELL (via COMSPEC env string and params for
cmd.exe).
I will tell you more later :-\

Le 01/02/2016 15:58, Martin Owens a écrit :
> Wouldn't this change break the old_job.enable() functionality that
> allows disabled jobs to be re-enabled?
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

Revision history for this message
Martin Owens (doctormo) wrote :

Yes, # means comment, but some comments are disabled jobs and we can only detect the difference if we parse the line and see if it parses at all.

Please do let me know about the windows side of things, I don't have too many people reporting back any tests from that side.

Revision history for this message
Martin Owens (doctormo) wrote :

Additional: Are you reporting that disabled jobs are being run?

Revision history for this message
Y.DUPRAT (yvduprat) wrote :

Ok. I will report back "win tests" soon

Le 01/02/2016 18:34, Martin Owens a écrit :
> Yes, # means comment, but some comments are disabled jobs and we can
> only detect the difference if we parse the line and see if it parses at
> all.
>
> Please do let me know about the windows side of things, I don't have too
> many people reporting back any tests from that side.
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

Revision history for this message
Y.DUPRAT (yvduprat) wrote :

No. Line is always a comment

Le 01/02/2016 18:35, Martin Owens a écrit :
> Additional: Are you reporting that disabled jobs are being run?
>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

Revision history for this message
Martin Owens (doctormo) wrote :

OK I'm assigning this incomplete so I don't forget it completely, but I don't understand the issue well enough to provide a fix at this time. Any other information you can provide might help clarify the situation would be great. Thanks for your help with testing.

Changed in python-crontab:
status: New → Incomplete
Martin Owens (doctormo)
Changed in python-crontab:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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