Bug 248965 - lastcomm doesn't display flags
lastcomm doesn't display flags
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: psacct (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Ivana Varekova
Depends On:
  Show dependency treegraph
Reported: 2007-07-19 17:31 EDT by Buck Huppmann
Modified: 2010-05-12 04:20 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-05-12 04:20:54 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Buck Huppmann 2007-07-19 17:31:01 EDT
Description of problem:

lastcomm doesn't show flags

Version-Release number of selected component (if applicable):


How reproducible:

run lastcomm

Steps to Reproduce:
1. lastcomm
Actual results:

no flags

Expected results:


Additional info:

here's some demo output for a forking process, first from a RH3 machine:

% rpm -q redhat-release ; rpm -q psacct ; lastcomm -f pacct
logrotate          F    root     __         0.00 secs Thu Jul 19 04:02

then from an RH4 machine

% ssh rh4machine 'rpm -q redhat-release; rpm -q psacct; set temp=`mktemp` &&
(cat > "$temp" && lastcomm -f "$temp"; rm "$temp")' < pacct
logrotate               root     __         0.00 secs Thu Jul 19 04:02

besides the ``F'' flag, i haven't seen any ``S'' flags either
Comment 1 Buck Huppmann 2007-07-20 07:25:28 EDT
the problem is with


. it replaces include-ing the system <linux/acct.h>, which contains

% grep '#define *A.*0x' /usr/include/linux/acct.h 
#define AFORK           0x01    /* ... executed fork, but did not exec */
#define ASU             0x02    /* ... used super-user privileges */
#define ACOMPAT         0x04    /* ... used compatibility mode (VAX only not
used) */
#define ACORE           0x08    /* ... dumped core */
#define AXSIG           0x10    /* ... was killed by a signal */

with its own acct.h, which defines the flag constants as enums instead of
preprocessor macros:

% sed -n '/enum/,/^[-+]*$/p' ../SOURCES/psacct-6.3.2-large-uid.patch
+  {
+    AFORK = 0x01,              /* Has executed fork, but no exec.  */
+    ASU = 0x02,                        /* Used super-user privileges.  */
+    ACORE = 0x08,              /* Dumped core.  */
+    AXSIG = 0x10               /* Killed by a signal.  */
+  };

thus, when the below compiles

% sed -n '/AFORK/,/endif/p' acct-6.3.2/lastcomm.c
#ifdef AFORK
          if (rec->ac_flag & AFORK)
            putchar ('F');

there's no defined C preprocessor AFORK macro, so the code isn't compiled in
Comment 2 Ivana Varekova 2007-07-25 08:47:04 EDT
Thanks for your bug report, the accounting flags should be defined as macros
here, you are right.
Comment 3 Ivana Varekova 2010-05-12 04:20:54 EDT
Only important issues like performance and security are fixed in RHEL 4.9 and
later. This bug does not meet necessary criteria and is therefore closed. The bug does not affect RHEL 5.

Note You need to log in before you can comment on or make changes to this bug.