Package:  debianutils
Version:  4.8.1
Severity: minor
Tags:     patch

        As currently implemented, the -D option does not match its
        documentation.  Specifically, savelog(8) reads:

    -D dateformat
        override date format, in the form of [MMDDhhmm[[CC]YY][.ss]]

        While in fact -D argument is passed to date(1) ‘+’ (see below),
        and as such follows (a superset of) the strftime(3) format.

$ nl -ba < savelog 
…
    87  DOT_Z=".gz"
    88  DATUM=`date +%Y%m%d%H%M%S`
    89  
…
   153          d) datum=1 ;;
   154          D) DATUM=$(date +$OPTARG) ;;
   155          t) touch=1 ;;

        On a related note, while savelog has some extraneous quoting in
        assignments (a="$b" is no different to a=$b), the lack of double
        quotes around $OPTARG above means trouble.

        Please thus consider the patches MIMEd.

  * savelog.8: Refer to date(1) for -D option format.  closes: #XXX.
  * savelog: Fix missing quotes around -D option argument.

-- 
FSF associate member #7257  np. На дальней станции сойду — Гражданская Оборона
--- a/savelog.8
+++ b/savelog.8
@@ -135,8 +135,13 @@
 use standard date for rolling
 .TP
 .B "\-D dateformat"
-override date format, in the form of
-.I [MMDDhhmm[[CC]YY][.ss]]
+override date format, in the form accepted by
+.BR date (1)
+(default:
+.BR "%Y%m%d%H%M%S" ","
+provided
+.B -d
+is used)
 .TP
 .B \-r
 use
--- a/savelog
+++ b/savelog
@@ -151,7 +151,7 @@ while getopts m:u:g:c:r:CdD:tlphjJ123456789x:nq opt ; do
 	r) rolldir="$OPTARG" ;;
 	C) forceclean=1 ;;
 	d) datum=1 ;;
-	D) DATUM=$(date +$OPTARG) ;;
+	D) DATUM=$(date +"$OPTARG") ;;
 	t) touch=1 ;;
 	j) COMPRESS="bzip2"; COMPRESS_OPTS="-f"; COMPRESS_STRENGTH_DEF="-9"; DOT_Z=".bz2" ;;
 	J) COMPRESS="xz"; COMPRESS_OPTS="-f"; COMPRESS_STRENGTH_DEF=""; DOT_Z=".xz" ;;

Reply via email to