Joey Hess wrote:
> joey@gnu:~>touch foo
> joey@gnu:~>savelog -p -C foo
> ls: cannot access .//foo.[0-9]*.gz: No such file or directory
> Rotated `foo' at Sun Jan  1 15:36:05 JEST 2012.

Here is a minimum patch that addresses this issue.  (It has been
annoying to me for a while now too.)  I kept the same style as the
original code around it.

Thanks for maintaining the debianutils!

Bob

--- savelog
+++ savelog.original
@@ -299,9 +299,15 @@ while [ $# -gt 0 ]; do
        if [ -n "$forceclean" ]; then
                cycle=$(( $count - 1))
                if [ -z "$COMPRESS" ]; then
-                       rm -f -- `ls -t -- $newname.[0-9]* | sed -e 1,${cycle}d`
+                       list=$(ls -t -- $newname.[0-9]* 2>/dev/null | sed -e 
1,${cycle}d)
+                       if [ -n "$list" ]; then
+                               rm -f -- $list
+                       fi
                else
-                       rm -f -- `ls -t -- $newname.[0-9]*$DOT_Z | sed -e 
1,${cycle}d`
+                       list=$(ls -t -- $newname.[0-9]*$DOT_Z 2>/dev/null | sed 
-e 1,${cycle}d)
+                       if [ -n "$list" ]; then
+                               rm -f -- $list
+                       fi
                fi
        fi
 

Attachment: signature.asc
Description: Digital signature

Reply via email to