Your message dated Mon, 04 Dec 2006 12:47:02 +0000
with message-id <[EMAIL PROTECTED]>
and subject line Bug#262583: fixed in acct 6.4~pre1-3
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: acct
Version: 6.3.5

it's always annoyed me i can't use bzcat or zcat to pipe old logs to
lastcomm.  so i've added support for "-f -", which requires reading the
log in the forwards direction... i also added --forwards for completeness.

it's a bit of a hack, i'd have preferred if i could specify the
forwards/backwards distinction to the common library code at a later
point... as it is, i require -f - to be first, or --forwards to be first
so that pacct_init() can be called with the forwards direction prior to
the first add_pacct_file() call.

-dean

#! /bin/sh -e
## 50-lastcomm-forwards.dpatch by dean gaudet <[EMAIL PROTECTED]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: lastcomm support for --forwards and -f - to read from pipes/stdin

if [ $# -lt 1 ]; then
    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"

case "$1" in
    -patch) patch -p1 ${patch_opts} < $0;;
    -unpatch) patch -R -p1 ${patch_opts} < $0;;
    *)
        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
        exit 1;;
esac

exit 0

@DPATCH@
diff -urNad /home/dean/tmp/acct/acct-6.3.5/lastcomm.1 acct-6.3.5/lastcomm.1
--- /home/dean/tmp/acct/acct-6.3.5/lastcomm.1   1998-03-22 22:26:12.000000000 
-0800
+++ acct-6.3.5/lastcomm.1       2004-07-31 14:55:41.000000000 -0700
@@ -23,6 +23,10 @@
 ]
 .br
 [
+.B \-\-forwards
+]
+.br
+[
 .BI \-f " filename"
 |
 .BI \-\-file " filename"
@@ -126,11 +130,26 @@
 List records for tty
 .I name.
 .TP
+.BI \-\-forwards
+Read file forwards instead of backwards.  This avoids trying to seek
+on the file and can be used to read from a pipe.  This must be specified
+prior to any
+.BI \-f
+arguments.
+.TP
 .BI \-f " filename, " \-\-file " filename"
 Read from the file
 .I filename
 instead of
-.I acct
+.I acct.
+A filename of "-" will result in reading from stdin.
+This must either be the first
+.BI \-f
+option, or
+.BI \-\-forwards
+must precede all
+.BI \-f
+options.
 .TP
 .BI \-\-ahz " hz"
 Use this flag to tell the program what
diff -urNad /home/dean/tmp/acct/acct-6.3.5/lastcomm.c acct-6.3.5/lastcomm.c
--- /home/dean/tmp/acct/acct-6.3.5/lastcomm.c   1998-04-08 16:24:49.000000000 
-0700
+++ acct-6.3.5/lastcomm.c       2004-07-31 14:55:41.000000000 -0700
@@ -97,13 +97,10 @@
   int c;
   int other_pacct_file_specified = 0; /* nonzero if the user used the
                                         `-f' or `--file' flag */
+  int backwards = 1; /* default to reading backwards */

   program_name = argv[0];

-  /* Tell the pacct reader that we want to do things backwards! */
-
-  pacct_init (1);
-
   while (1)
     {
       int option_index = 0;
@@ -119,6 +116,7 @@
        { "tty", required_argument, NULL, 8 },
        { "command", required_argument, NULL, 9 },
        { "ahz", required_argument, NULL, 10 },
+       { "forwards", no_argument, NULL, 11 },
        { 0, 0, 0, 0 }
       };

@@ -140,6 +138,18 @@
          break;
        case 'f':
        case 4:
+         if (strcmp(optarg, "-") == 0)
+           {
+             if (backwards && other_pacct_file_specified)
+               {
+                 printf ("%s: -f - must be specified first, or --forwards must 
precede the first -f\n", program_name);
+                 exit (1);
+               }
+             backwards = 0;
+             optarg = "/proc/self/fd/0";
+           }
+         if (other_pacct_file_specified == 0)
+           pacct_init(backwards);
          add_pacct_file (optarg);
          other_pacct_file_specified = 1;
          break;
@@ -174,6 +184,14 @@
            }

          break;
+       case 11:
+         if (other_pacct_file_specified)
+           {
+             printf ("%s: --forwards must come before -f\n", program_name);
+             exit (1);
+           }
+         backwards = 0;
+         break;
        case 'h':
        case 3:
          /* This should fall through to default! */
@@ -184,6 +202,9 @@
        }
     }

+  if (other_pacct_file_specified == 0)
+    pacct_init(backwards);
+
   /* if we get here, we expect everything else to be a username,
      terminal name, or command name */

@@ -259,7 +280,7 @@
 {
   char *usage = "\
 Usage: %s [-hV] [-f file] [command] ... [user] ... [terminal] ...\n\
-       [--file <file>] [--strict-match] [--print-controls]\n\
+       [--forwards] [--file <file>] [--strict-match] [--print-controls]\n\
        [--user <name>] [--tty <name>] [--command <name>] [--debug]\n\
        [--version] [--help]\n\
 ";


--- End Message ---
--- Begin Message ---
Source: acct
Source-Version: 6.4~pre1-3

We believe that the bug you reported is fixed in the latest version of
acct, which is due to be installed in the Debian FTP archive:

acct_6.4~pre1-3.diff.gz
  to pool/main/a/acct/acct_6.4~pre1-3.diff.gz
acct_6.4~pre1-3.dsc
  to pool/main/a/acct/acct_6.4~pre1-3.dsc
acct_6.4~pre1-3_i386.deb
  to pool/main/a/acct/acct_6.4~pre1-3_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Daniel Baumann <[EMAIL PROTECTED]> (supplier of updated acct package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [EMAIL PROTECTED])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Sun, 5 Nov 2006 13:55:00 +0100
Source: acct
Binary: acct
Architecture: source i386
Version: 6.4~pre1-3
Distribution: unstable
Urgency: medium
Maintainer: Daniel Baumann <[EMAIL PROTECTED]>
Changed-By: Daniel Baumann <[EMAIL PROTECTED]>
Description: 
 acct       - The GNU Accounting utilities for process and login accounting
Closes: 51796 262583
Changes: 
 acct (6.4~pre1-3) unstable; urgency=medium
 .
   * Adapted the patch from Dean Gaudet <[EMAIL PROTECTED]> to add
     lastcomm -f - stdin and --forwards support to current acct
     (Closes: #262583).
   * Fixed cron.monthly to not process the non-rotated logfile twice if the
     rotated one isn't existing (Closes: #51796).
Files: 
 3ae559197fee77811b1f1a615b890b9a 590 admin optional acct_6.4~pre1-3.dsc
 aa59667396c4dcc2bf9404ba5337bbf3 22198 admin optional acct_6.4~pre1-3.diff.gz
 46f28e68e65005316a00c639d86419a1 109148 admin optional acct_6.4~pre1-3_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFdBVJ+C5cwEsrK54RAvEEAJ42svsuqc4gy8LWidGPdVjSfqvVlwCgtVUH
8+3IQco/DMHki3e6UG6hjJM=
=6huc
-----END PGP SIGNATURE-----


--- End Message ---

Reply via email to