Package: debianutils
Version: 2.13.0
Severity: normal
File: /usr/bin/savelog
Tags: patch
The fix for 295850 broke hyphens with -p.
# touch -- -a
# chown -- mail.adm -a
# /usr/bin/savelog -p -c 10 -- -a
chown: invalid option -- a
Try `chown --help' for more information.
chmod: invalid option -- .
Try `chmod --help' for more information.
Rotated `-a' at Sun Feb 27 16:14:52 PST 2005.
-rw------- 1 root root 0 Feb 27 16:14 -a
-rw------- 1 mail adm 0 Feb 27 16:14 -a.0
The problem with the patch I provided for 295021 was that I stupidly put
the '--' between an option and that option's argument (I was thinking of
it as a regular argument because it was a filename). Of course, it
should go after all options.
The new patch (attached) does just that. (I also put the '=' in to
match the usage given in the manual and to make someone less likely to
make my mistake of separating those two words in the future.) The
results:
# touch foo
# chown mail.adm foo
# ./savelog -p -c 10 foo
Rotated `foo' at Sun Feb 27 16:16:26 PST 2005.
# ls -l foo*
-rw------- 1 mail adm 0 Feb 27 16:16 foo
-rw------- 1 mail adm 0 Feb 27 16:16 foo.0
# touch -- -a
# chown -- mail.adm -a
# ./savelog -p -c 10 -- -a
Rotated `-a' at Sun Feb 27 16:16:40 PST 2005.
# ls -l -- -a*
-rw------- 1 mail adm 0 Feb 27 16:16 -a
-rw------- 1 mail adm 0 Feb 27 16:16 -a.0
I don't know much about the lives of Debian maintainers, but does the
debianutils package have any sort of unit tests? If so, it'd be great
to add test cases to catch regressions of this bug and the previous
ones. I'd be happy to help write them.
Unfortunately, I searched for information to see if there was any
testing framework for Debian packages but found none, so I'm guessing
the answer to my question is going to be "no."
Thanks!
--Alan
-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages debianutils depends on:
ii coreutils 5.2.1-2 The GNU core utilities
ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an
-- no debconf information
--- savelog.orig 2005-02-27 15:59:58.683172248 -0800
+++ savelog 2005-02-27 16:02:06.582606010 -0800
@@ -266,8 +266,8 @@
if [ -n "$preserve" ]; then
(umask 077
touch -- "$filename.new"
- chown --reference "$filename" "$filename.new"
- chmod --reference "$filename" "$filename.new")
+ chown --reference="$filename" -- "$filename.new"
+ chmod --reference="$filename" -- "$filename.new")
filenew=1
elif [ -n "$touch$user$group$mode" ]; then
touch -- "$filename.new"