Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 201887 Details for
Bug 282214
sys-process/fcron-3.0.4-r2: check_system_crontabs uses wrong shebang
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch fixing most of the issues
fcron-3.0.4-shell-fixes.diff (text/plain), 6.59 KB, created by
Michał Górny
on 2009-08-21 17:29:12 UTC
(
hide
)
Description:
Patch fixing most of the issues
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2009-08-21 17:29:12 UTC
Size:
6.59 KB
patch
obsolete
>diff -durp fcron-3.0.4.orig/script/check_system_crontabs fcron-3.0.4/script/check_system_crontabs >--- fcron-3.0.4.orig/script/check_system_crontabs 2009-08-21 18:35:45.205944317 +0200 >+++ fcron-3.0.4/script/check_system_crontabs 2009-08-21 19:15:59.170946828 +0200 >@@ -85,13 +85,12 @@ FCRONTAB_FILE_TMP= > > cleanup() { > # remove temporary file (if any) >- [ -e "$FCRONTAB_FILE_TMP" ] && rm -f $FCRONTAB_FILE_TMP >+ [ -e "$FCRONTAB_FILE_TMP" ] && rm -f "$FCRONTAB_FILE_TMP" > } > trap "eval cleanup" INT TERM HUP > >-if [ -x "`type -p mktemp`" ]; then >- FCRONTAB_FILE_TMP=`mktemp /tmp/fcrontab.XXXXXX` >-else >+FCRONTAB_FILE_TMP="`mktemp /tmp/fcrontab.XXXXXX 2>/dev/null`" >+if [ $? -ne 0 ]; then > FCRONTAB_FILE_TMP=/tmp/fcrontab.$$ > fi > >@@ -136,7 +135,7 @@ VERBOSE= > FORCE= > > # read command line arguments >-while [ "$#" -gt 0 ]; do >+while [ $# -gt 0 ]; do > case "$1" in > -v) > VERBOSE=true >@@ -186,8 +185,9 @@ if [ -n "$FCRONTAB_PROG" ]; then > [ -d "$FCRONTAB_PROG" ] && FCRONTAB_PROG="$FCRONTAB_PROG/fcrontab" > [ ! -x "$FCRONTAB_PROG" ] && die "Invalid fcrontab executable or path specified with -p!" > else >- if [ -x "`type -p fcrontab`" ]; then >- FCRONTAB_PROG="`type -p fcrontab`" >+ fcrontab -V 2>/dev/null >+ if [ $? -eq 0 ]; then >+ FCRONTAB_PROG=fcrontab > elif [ -x /usr/bin/fcrontab ]; then > FCRONTAB_PROG=/usr/bin/fcrontab > elif [ -x /usr/local/bin/fcrontab ]; then >@@ -205,13 +205,11 @@ fi > # Function to scan for valid files in $CROND_DIR > crond_files() > { >- [ ! -d $CROND_DIR ] && return >- local FILES=`echo $CROND_DIR/*` >+ [ ! -d "$CROND_DIR" ] && return > local FILE >- [ "$FILES" = "$CROND_DIR/*" ] && return >- for FILE in $FILES; do >- if [ ! -d $FILE -a $FILE = "${FILE%\~}" ]; then >- echo $FILE >+ for FILE in "$CROND_DIR"/*; do >+ if [ ! -d "$FILE" -a "$FILE" = "${FILE%\~}" ]; then >+ echo "$FILE" > fi > done > } >@@ -223,37 +221,59 @@ rebuild_and_notify() > logger -i -p cron.notice -t "check_system_crontabs" "Rebuilding the system fcrontab..." > > # put a warning message at the top of the file >- echo -e "########################################" > $FCRONTAB_FILE_TMP >- echo -e "# WARNING!!! DO NOT EDIT THIS FILE!!! #" >> $FCRONTAB_FILE_TMP >- echo -e "########################################" >> $FCRONTAB_FILE_TMP >- echo -e "# Do not edit this file! It is automatically generated from" >> $FCRONTAB_FILE_TMP >- echo -e "# the $CRONTAB_FILE, the $FCRONTAB_FILE and $CROND_DIR/* files whenever one of" >> $FCRONTAB_FILE_TMP >- echo -e "# those files is changed.\n#\n\n" >> $FCRONTAB_FILE_TMP >+ cat <<_EOF_ > "$FCRONTAB_FILE_TMP" >+######################################## >+# WARNING!!! DO NOT EDIT THIS FILE!!! # >+######################################## >+# Do not edit this file! It is automatically generated from >+# the $CRONTAB_FILE, the $FCRONTAB_FILE and $CROND_DIR/* files whenever one of >+# those files is changed. >+# >+ >+_EOF_ > > # include the standard system crontab file if it exists and is not a symbolic link >- if [ -f $CRONTAB_FILE -a ! -L $CRONTAB_FILE ]; then >- echo -e "\n\n########################################\n# $CRONTAB_FILE\n########################################\n" >> $FCRONTAB_FILE_TMP >- cat $CRONTAB_FILE >> $FCRONTAB_FILE_TMP >+ if [ -f "$CRONTAB_FILE" -a ! -L "$CRONTAB_FILE" ]; then >+ cat - "$CRONTAB_FILE" <<_EOF_ >> "$FCRONTAB_FILE_TMP" >+ >+ >+######################################## >+# $CRONTAB_FILE >+######################################## >+ >+_EOF_ > fi > > # print a nice filename header for each file in /etc/cron.d/ > # and include its contents into the new fcron system crontab > for i in `crond_files` ; do >- echo -e "\n\n########################################\n# $i\n########################################\n" >> $FCRONTAB_FILE_TMP >- cat $i >> $FCRONTAB_FILE_TMP >+ cat - "$i" <<_EOF_ >> "$FCRONTAB_FILE_TMP" >+ >+ >+######################################## >+# $i >+######################################## >+ >+_EOF_ > done > > # include the system fcrontab file if it exists and is not a symbolic link >- if [ -f $FCRONTAB_FILE -a ! -L $FCRONTAB_FILE ]; then >- echo -e "\n\n########################################\n# $FCRONTAB_FILE\n########################################\n" >> $FCRONTAB_FILE_TMP >- cat $FCRONTAB_FILE >> $FCRONTAB_FILE_TMP >+ if [ -f "$FCRONTAB_FILE" -a ! -L "$FCRONTAB_FILE" ]; then >+ cat - "$FCRONTAB_FILE" <<_EOF_ >> "$FCRONTAB_FILE_TMP" >+ >+ >+######################################## >+# $FCRONTAB_FILE >+######################################## >+ >+_EOF_ > fi > > # Replace "@hourly" style Vixie cron extensions which fcron doesn't parse >- sed -i -e "s/@yearly/0 0 1 1 */g" -e "s/@annually/0 0 1 1 */g" -e "s/@monthly/0 0 1 * */g" -e "s/@weekly/0 0 * * 0/g" -e "s/@daily/0 0 * * */g" -e "s/@midnight/0 0 * * */g" -e "s/@hourly/0 * * * */g" $FCRONTAB_FILE_TMP >+ sed -i -e "s/@yearly/0 0 1 1 */g" -e "s/@annually/0 0 1 1 */g" -e "s/@monthly/0 0 1 * */g" -e "s/@weekly/0 0 * * 0/g" -e "s/@daily/0 0 * * */g" -e "s/@midnight/0 0 * * */g" -e "s/@hourly/0 * * * */g" "$FCRONTAB_FILE_TMP" > > # notify fcron about the updated file >- $FCRONTAB_PROG -c $FCRON_CONFIG_FILE $FCRONTAB_FILE_TMP -u systab >+ "$FCRONTAB_PROG" -c "$FCRON_CONFIG_FILE" "$FCRONTAB_FILE_TMP" -u systab > } > > NEED_REBUILD=0 >@@ -274,11 +294,11 @@ if [ -n "$FORCE" ]; then > > else > >- if [ -d $CROND_DIR ]; then >+ if [ -d "$CROND_DIR" ]; then > > # This test works for file creation/deletion (deletion is not detected > # by the next test) >- if [ $CROND_DIR -nt $FCRONTABS_DIR/systab.orig ]; then >+ if [ "$CROND_DIR" -nt "$FCRONTABS_DIR"/systab.orig ]; then # XXX: kshism > > info "Changes detected in $CROND_DIR" > NEED_REBUILD=1 >@@ -287,7 +307,7 @@ else > > # Test each one and see if it's newer than our timestamp file > for i in `crond_files` ; do >- if [ $i -nt $FCRONTABS_DIR/systab.orig ]; then >+ if [ "$i" -nt "$FCRONTABS_DIR"/systab.orig ]; then # XXX: kshism > > info "Changes detected in $CROND_DIR" > NEED_REBUILD=1 >@@ -300,7 +320,7 @@ else > fi > > # Test the standard /etc/crontab file and see if it has changed >- if [ -f $CRONTAB_FILE -a $CRONTAB_FILE -nt $FCRONTABS_DIR/systab.orig ]; then >+ if [ -f "$CRONTAB_FILE" -a "$CRONTAB_FILE" -nt "$FCRONTABS_DIR"/systab.orig ]; then # XXX: kshism > > info "Changes detected in $CRONTAB_FILE" > NEED_REBUILD=1 >@@ -308,7 +328,7 @@ else > fi > > # Test the standard /etc/fcrontab file and see if it has changed >- if [ -f $FCRONTAB_FILE -a $FCRONTAB_FILE -nt $FCRONTABS_DIR/systab.orig ]; then >+ if [ -f "$FCRONTAB_FILE" -a "$FCRONTAB_FILE" -nt "$FCRONTABS_DIR"/systab.orig ]; then # XXX: kshism > > info "Changes detected in $FCRONTAB_FILE" > NEED_REBUILD=1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 282214
:
201887
|
202943
|
202960