Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 282214 - sys-process/fcron-3.0.4-r2: check_system_crontabs uses wrong shebang
Summary: sys-process/fcron-3.0.4-r2: check_system_crontabs uses wrong shebang
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Wolfram Schlich (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-21 16:08 UTC by Michał Górny
Modified: 2016-05-19 17:46 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch fixing most of the issues (fcron-3.0.4-shell-fixes.diff,6.59 KB, patch)
2009-08-21 17:29 UTC, Michał Górny
Details | Diff
Patch fixing all issues except -nt (fcron-3.0.4-shell-fixes-r1.diff,6.78 KB, patch)
2009-09-02 10:24 UTC, Michał Górny
Details | Diff
Patch fixing all the issues (fcron-3.0.4-shell-fixes-r2.diff,6.97 KB, patch)
2009-09-02 13:41 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-08-21 16:08:58 UTC
check_system_crontabs installed with =sys-process/fcron-3.0.4-r2 contains '#!/bin/sh' shebang line although it relies on bash features. This results in fcron being unable to update systab based on cron.d/ files when /bin/sh is not bash.

As the script doesn't rely on bash in a way hard to replace, I think the preferred solution would be to replace remaining bashisms with more portable replacements.

The bashisms seem to be:
 * use of 'type -p' command (can be replaced by 'which'),
 * use of 'echo -e' (with \n-s, can be replaced either with 'printf' or by splitting into several echos),
 * use of 'local' variables (acceptable although assignments should be moved below 'local' declaration).

I'll create a patch in a while and forward a copy of it upstream.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-08-21 17:29:12 UTC
Created attachment 201887 [details, diff]
Patch fixing most of the issues

I've fixed most of compatibility issues including not quoting variables. This makes the script work well with dash but still needs few polishes to get full SUS compat & one more to support spaces in cron.d/ filenames.
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-08-22 17:55:14 UTC
(In reply to comment #0)

> I'll create a patch in a while and forward a copy of it upstream.
> 

Please provide the upstream reference, thanks.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-09-01 21:30:48 UTC
(In reply to comment #2)
> Please provide the upstream reference, thanks.

I've submitted the patch directly to the author ( as stated in http://fcron.free.fr/contact.php#bug ) and still didn't get any reply.
Comment 4 Wolfram Schlich (RETIRED) gentoo-dev 2009-09-02 09:55:06 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Please provide the upstream reference, thanks.
> 
> I've submitted the patch directly to the author ( as stated in
> http://fcron.free.fr/contact.php#bug ) and still didn't get any reply.

ok, what about creating a patch that fixes *all* issues and sending
it to me instead? I'd then include that version in our package, hoping
that Thibault will include it upstream sometime soon...
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-09-02 10:24:21 UTC
Created attachment 202943 [details, diff]
Patch fixing all issues except -nt
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-09-02 10:31:39 UTC
(In reply to comment #4)
> ok, what about creating a patch that fixes *all* issues and sending
> it to me instead? I'd then include that version in our package, hoping
> that Thibault will include it upstream sometime soon...

For the filename bug, I've chosen to inline crond_files(). The only issue left then is use of -nt test but I really don't know what to replace it with.

In my opinion, You could review this version and use it as temporary solution, and in the meantime I'll try to find something better. It's still better than the current version which doesn't work even with dash.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2009-09-02 13:41:46 UTC
Created attachment 202960 [details, diff]
Patch fixing all the issues

This patch should fix all the issues and have exact the same behavior as old one.

The change detection part could be compacted a little but I wrote it in such way that the output will be exactly the same as with old methods.
Comment 8 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-03-10 01:42:19 UTC
Closing this UPSTREAM… it seems like 3.0.5 hasn't fixed this.

Now, the symptom _should_ be fixed (as I've changed the script to use bash, and added a bash dependency to fcron), but of course this is not the optimal solution. Unfortunately, given the patch is about 7KB in size for a 10KB script, I'd rather not apply that in Gentoo directly…

Can you please see if upstream would consider releasing this in 3.0.6, given he seems to be active again?
Comment 9 SpanKY gentoo-dev 2016-05-19 17:46:31 UTC
looks like fcron-3.1+ ships a POSIX-shell version now which we install