--- atop-1.23.orig/acctproc.c +++ atop-1.23/acctproc.c @@ -126,7 +126,7 @@ #include "photoproc.h" #include "acctproc.h" -#define ACCTDIR "/tmp/atop.d" +#define ACCTDIR "/var/run/atop" #define ACCTFILE "atop.acct" #define ACCTENV "ATOPACCT" @@ -144,6 +144,7 @@ char *name; struct stat stat; } pacctadm[] = { + { "/var/log/account/pacct", {0, }, }, { "/var/log/pacct", {0, }, }, { "/var/account/pacct", {0, }, } }; @@ -330,7 +331,7 @@ if (semctl(semid, 1, GETVAL, 0) == SEMTOTAL) { /* - ** create a new separate directory below /tmp + ** create a new separate directory below /var/run ** for the accounting file; ** if this directory exists (e.g. previous atop-run killed) ** it will be cleaned and newly created --- atop-1.23.orig/Makefile +++ atop-1.23/Makefile @@ -28,7 +28,7 @@ cc atop.o $(ALLMODS) -o atop $(LDFLAGS) clean: - rm -f *.o + rm -f *.o atop install: atop if [ ! -d $(DESTDIR)$(LOGPATH) ]; then mkdir -p $(DESTDIR)$(LOGPATH); fi --- atop-1.23.orig/rawlog.c +++ atop-1.23/rawlog.c @@ -122,7 +122,7 @@ #include "photoproc.h" #include "photosyst.h" -#define BASEPATH "/var/log/atop/" +#define BASEPATH "/var/log/" /* ** structure which describes the raw file contents @@ -424,7 +424,7 @@ timenow = time(0); tp = localtime(&timenow); - snprintf(rawname, RAWNAMESZ, "%s/atop_%04d%02d%02d", + snprintf(rawname, RAWNAMESZ, "%s/atop.log", BASEPATH, tp->tm_year+1900, tp->tm_mon+1, @@ -477,18 +477,18 @@ */ fprintf(stderr, "Decompressing logfile ....\n"); - snprintf(tmpname2, sizeof tmpname2, "/tmp/atopwrk%d", getpid()); - snprintf(command, sizeof command, "gunzip -c %s > %s", - tmpname1, tmpname2); - system (command); + snprintf(tmpname2, sizeof tmpname2, "/tmp/atopwrkXXXXXX"); - if ( (rawfd = open(tmpname2, O_RDONLY)) == -1) + if ( (rawfd = mkstemp(tmpname2)) == -1) { fprintf(stderr, "%s - ", rawname); perror("open decompressed raw file"); cleanstop(7); } + snprintf(command, sizeof command, "gunzip -c %s > %s", + tmpname1, tmpname2); + system (command); unlink(tmpname2); } --- atop-1.23.orig/man/atop.1 +++ atop-1.23/man/atop.1 @@ -496,13 +496,12 @@ A raw file can be read and visualized again with the flag .B -r followed by the filename. If no filename is specified, the file -.BI /var/log/atop/atop_ YYYYMMDD -is opened for input (where -.I YYYYMMDD -are digits representing the current date). -If a filename is specified in the format YYYYMMDD (representing any valid -date), the file -.BI /var/log/atop/atop_ YYYYMMDD +.BI /var/log/atop.log +is opened for input. +If a filename is specified in the format yyyymmdd (where +.I yyyymmdd +are digits representing any valid date), the file +.BI /var/log/atop/atop_ yyyymmdd is opened. .br The samples from the file can be viewed interactively by using the key 't' @@ -518,44 +517,11 @@ (end time) followed by a time argument of the form HH:MM, a certain time period within the raw file can be selected. .PP -When -.B atop -is installed, the script -.B atop.daily -is stored in the -.I /etc/atop -directory. -This scripts takes care that -.B atop -is activated every day at midnight to write compressed binary data to the file -.BI /var/log/atop/atop_ YYYYMMDD -with an interval of 10 minutes. -.br -Furthermore the script removes all raw files which are older than four weeks. -.br -The script is activated via the -.B cron -daemon using the file -.I /etc/cron.d/atop -with the contents -.br -.B \ \ \ \ \ \ \ \ 0 0 * * * root /etc/atop/atop.daily -.PP -When the RPM `psacct' is installed, the process accounting is -automatically restarted via the -.B logrotate -mechanism. The file -.B /etc/logrotate.d/psaccs_atop -takes care that -.B atop -is finished just before the rotation of the process accounting file -and the file -.B /etc/logrotate.d/psaccu_atop -takes care that -.B atop -is restarted again after the rotation. -When the RPM `psacct' is not installed, these logrotate-files -have no effect. +The Debian package automatically starts up +.I atop +via init, rotation of the logfiles is done with logrotate. Therefore, the +suggested layout with cron scripts in /etc/atop as described in the upstream +package is not necessary for Debian. .SH OUTPUT DESCRIPTION The first sample shows the system level activity since boot (the elapsed time in the header shows the number of seconds since boot). @@ -1515,13 +1481,11 @@ Configuration file containing personal default values. .PP .TP 5 -.BI /var/log/atop/atop_ YYYYMMDD +.BI /var/log/atop.log[.X] Raw file, where -.I YYYYMMDD -are digits representing the current date. -This name is used by the script -.B atop.daily -as default name for the output file, and by +.I X +is the age in days as added by logrotate(1). +This name is used by .B atop as default name for the input file when using the .B -r @@ -1534,5 +1498,7 @@ .B logrotate(8) .br .B http://www.ATComputing.nl/Tools/atop -.SH AUTHOR -Gerlof Langeveld, AT Computing (gerlof@ATComputing.nl) +.SH "AUTHOR" +Gerlof Langeveld, AT Computing (gerlof@ATComputing.nl), +Debian package by Edelhard Becker. + --- atop-1.23.orig/debian/changelog +++ atop-1.23/debian/changelog @@ -0,0 +1,182 @@ +atop (1.23-1+squeeze1build0.10.04.1) lucid-security; urgency=low + + * fake sync from Debian + + -- Tyler Hicks Fri, 10 Feb 2012 12:59:05 -0600 + +atop (1.23-1+squeeze1) stable; urgency=high + + * Non-maintainer upload. + * Fix CVE-2011-XXXX: Insecure use of temporary files in rawlog.c and + acctproc.c (Closes: #622794) + + -- Jonathan Wiltshire Mon, 01 Aug 2011 15:35:16 +0100 + +atop (1.23-1) unstable; urgency=low + + * fixed typo (Closes: #467447) + * last release was built as native package + + -- Edelhard Becker Fri, 07 Mar 2008 22:07:27 +0100 + +atop (1.23) unstable; urgency=low + + * new upstream release + * bump standards to 3.7.3 (no changes) + * moved homepage from description to control field + + -- Edelhard Becker Fri, 07 Mar 2008 16:16:15 +0100 + +atop (1.22) unstable; urgency=low + + * new upstream release + + -- Edelhard Becker Tue, 20 Nov 2007 17:44:47 +0100 + +atop (1.21-1) unstable; urgency=low + + * new upstream release + * made rules and init.d script lintian clean + + -- Edelhard Becker Fri, 31 Aug 2007 15:55:33 +0200 + +atop (1.20-2) unstable; urgency=low + + * do not install upstream's crontab file + + -- Edelhard Becker Thu, 03 May 2007 00:12:59 +0200 + +atop (1.20-1) unstable; urgency=low + + * New upstream release (Closes: #411133, #372935) + * include upstream Changelog (Closes: #340093) + * bumped standards to 3.7.2 + * applied patch to cooperate with sa from acct package, thanks Dominique + (Closes: #420676) + * restart daemon by logrotate via invoke-rc.d (Closes: #393545) + + -- Edelhard Becker Wed, 02 May 2007 02:30:09 +0200 + +atop (1.16-2) unstable; urgency=low + + * depend on logrotate (Closes: #362893), thanks Tommi + + -- Edelhard Becker Mon, 17 Apr 2006 15:00:20 +0200 + +atop (1.16-1) unstable; urgency=low + + * New upstream release. Most notable upstream changes: + + - New line with system-level counters called PAG (paging-related counters + like scan, stall, swin and swout). + - For network-interfaces the effective line-speed in bits-per-second for + incoming and outgoing traffic is shown now (so Kbps/Mbps/Gbps). + - New function '1': show averages *per second* where applicable. + - Improved output that is easier to parse (fixed number of fields per + line). + + -- Edelhard Becker Fri, 7 Apr 2006 11:59:46 +0200 + +atop (1.15-2) unstable; urgency=low + + * remove log files on purge (Closes: #359083), thanks Justin + + -- Edelhard Becker Tue, 28 Mar 2006 16:29:27 +0200 + +atop (1.15-1) unstable; urgency=low + + * New upstream release + + -- Edelhard Becker Mon, 7 Nov 2005 23:08:01 +0100 + +atop (1.14.99-1) unstable; urgency=low + + * New upstream release (upcoming 1.15 preview) + * removed /etc/atop/ stuff (not necessary) and the corresponding section + from the man page + * removed /etc/rc.d/ stuff (not necessary) + + -- Edelhard Becker Sun, 30 Oct 2005 11:56:20 +0100 + +atop (1.14-1) unstable; urgency=low + + * New upstream release + * added URL of the new website where appropriate (copyright, control, README + and watch) + + -- Edelhard Becker Sat, 18 Dec 2004 14:01:42 +0100 + +atop (1.13-1) unstable; urgency=low + + * New upstream release (added recognition of thread-groups and scheduling + information) + * fixed missing options in manpage and help-screen + + -- Edelhard Becker Fri, 24 Sep 2004 11:09:04 +0200 + +atop (1.12-1) unstable; urgency=low + + * New upstream release + + -- Edelhard Becker Wed, 2 Jun 2004 10:44:36 +0200 + +atop (1.10-2) unstable; urgency=low + + * changed default for raw data filename to /var/log/atop.1 to reflect the + Debian layout (Closes: #217387); adapted man page + * bumped policy to 3.6.1 (no changes needed) + + -- Edelhard Becker Fri, 24 Oct 2003 14:48:11 +0200 + +atop (1.10-1) unstable; urgency=low + + * New upstream release + * increased storage for a number of resources to allow larger values (like + reported in #197626) + * new commands (see /usr/share/doc/atop/NEWS.Debian.gz for details) + * upstream replaced sys/acct.h by linux/acct.h (Closes: #198890) + * trailing `pidof atop` removed from init.d/atop (Closes: #199330) + + -- Edelhard Becker Wed, 9 Jul 2003 15:57:14 +0200 + +atop (1.9-6) unstable; urgency=low + + * changed some 'long's to 'long long's to prevent overflows at 2GB + (Closes: #197626) + * bumped standards to 3.5.10 + + -- Edelhard Becker Mon, 16 Jun 2003 21:23:21 +0200 + +atop (1.9-5) unstable; urgency=low + + * changed Architecture to any (Closes: #192620) + * logrotate now should work - seems that atop needs more time after stopping + via start-stop-daemon than logrotate waits + * changed maintainer e-mail to my debian account + * force inclusion of orig.tar.gz via dpkg-buildpackage -sa + + -- Edelhard Becker Mon, 26 May 2003 18:30:02 +0200 + +atop (1.9-4) unstable; urgency=low + + * improved logrotate (again) + * new upload should include atop-1.9.orig.tar.gz (Closes: #192344) + + -- Edelhard Becker Thu, 8 May 2003 12:38:51 +0200 + +atop (1.9-2) unstable; urgency=low + + * added -oknodo to start-stop-deamon to allow smooth upgrade + * improved upgrade / logrotate handling + + -- Edelhard Becker Fri, 2 May 2003 16:56:19 +0200 + +atop (1.9-1) unstable; urgency=low + + * Initial Release. + * removed atop.{daily,24hours,cron}, rely on init.d/atop instead + * add support for logrotate + * Initial upload (Closes: #190729) + + -- Edelhard Becker Fri, 25 Apr 2003 14:27:39 +0200 + --- atop-1.23.orig/debian/docs +++ atop-1.23/debian/docs @@ -0,0 +1 @@ +README --- atop-1.23.orig/debian/control +++ atop-1.23/debian/control @@ -0,0 +1,23 @@ +Source: atop +Section: admin +Priority: optional +Maintainer: Edelhard Becker +Build-Depends: debhelper (>= 4), zlib1g-dev, libncurses5-dev +Standards-Version: 3.7.3 +Homepage: http://www.atconsultancy.nl/atop/home.html + +Package: atop +Architecture: any +Depends: ${shlibs:Depends}, logrotate +Description: Monitor for system resources and process activity + Atop is an ASCII full-screen performance monitor, similar to the top command, + but atop only shows the active system-resources and processes, and only shows + the deviations since the previous interval. At regular intervals, it shows + system-level activity related to the CPU, memory, swap, disks and network + layers, and it shows for every active process the CPU utilization in system + and user mode, the virtual and resident memory growth, priority, username, + state, and exit code. The process level activity is also shown for processes + which finished during the last interval, to get a complete overview about the + consumers of things such as CPU time. + . + Author: Gerlof Langeveld --- atop-1.23.orig/debian/compat +++ atop-1.23/debian/compat @@ -0,0 +1 @@ +4 --- atop-1.23.orig/debian/logrotate +++ atop-1.23/debian/logrotate @@ -0,0 +1,18 @@ +# atop logrotate configuration file + +/var/log/atop.log { + rotate 14 + daily + nocompress + nocreate + missingok + prerotate + if pidof atop 2>&1 > /dev/null; then + invoke-rc.d --quiet atop stop 2>&1 > /dev/null + fi + endscript + postrotate + invoke-rc.d --quiet atop start 2>&1 > /dev/null + endscript +} + --- atop-1.23.orig/debian/postrm +++ atop-1.23/debian/postrm @@ -0,0 +1,11 @@ +#! /bin/bash + +#DEBHELPER# + +set -e + +if [ "$1" = "purge" ] +then + rm -f /var/log/atop.log* +fi + --- atop-1.23.orig/debian/copyright +++ atop-1.23/debian/copyright @@ -0,0 +1,13 @@ +This package was debianized by Edelhard Becker on +Thu, 13 Feb 2003 21:28:07 +0100. + +It was downloaded from ftp://ftp.ATComputing.nl/pub/tools/linux +New homepage and downloads via http://www.atconsultancy.nl/atop/home.html + +Upstream Author: Gerlof Langeveld + +Copyright: Gerlof Langeveld, AT Computing (gerlof@ATComputing.nl) + +You are free to distribute this software under the terms of the GNU General +Public License. On Debian systems, the complete text of the GNU General Public +License can be found in the file `/usr/share/common-licenses/GPL'. --- atop-1.23.orig/debian/init.d +++ atop-1.23/debian/init.d @@ -0,0 +1,64 @@ +#! /bin/sh +# +# atop init script +# + +### BEGIN INIT INFO +# Provides: atop +# Required-Start: $syslog +# Required-Stop: $syslog +# Should-Start: $local_fs +# Should-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Monitor for system resources and process activity +# Description: Atop is an ASCII full-screen performance monitor, +# similar to the top command, but atop only shows +# the active system-resources and processes, and +# only shows the deviations since the previous +# interval. +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/atop +DARGS="-a -w /var/log/atop.log 600" +NAME=atop +DESC="atop system monitor" + +test -x $DAEMON || exit 0 + +set -e + +case "$1" in + start) + echo -n "Starting $DESC: " + start-stop-daemon --start --background --quiet --exec $DAEMON -- $DARGS + echo "$NAME." + ;; + stop) + echo -n "Stopping $DESC: " + start-stop-daemon --stop --quiet --retry 2 --oknodo --exec $DAEMON -- $DARGS + echo "$NAME." + ;; + #reload) + restart|force-reload) + # + # If the "reload" option is implemented, move the "force-reload" + # option to the "reload" entry above. If not, "force-reload" is + # just the same as "restart". + # + echo -n "Restarting $DESC: " + start-stop-daemon --stop --quiet --exec $DAEMON -- $DARGS + sleep 1 + start-stop-daemon --start --background --quiet --exec $DAEMON -- $DARGS + echo "$NAME." + ;; + *) + N=/etc/init.d/$NAME + # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 --- atop-1.23.orig/debian/postinst +++ atop-1.23/debian/postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +#DEBHELPER# + +# always begin new logfile on update +LOGROTATE="/etc/logrotate.d/atop" + +if [ -f $LOGROTATE ]; then + /usr/sbin/logrotate -f $LOGROTATE +fi + --- atop-1.23.orig/debian/NEWS +++ atop-1.23/debian/NEWS @@ -0,0 +1,8 @@ +atop (1.13-1) unstable; urgency=low + + This new upstream release adds, among the usual bugfixes, recognition of + thread-groups and scheduling information. The log-file format has changed to + store the new information. This means that you can't read logs from the + previous releases. + + -- Edelhard Becker Fri, 24 Sep 2004 11:09:04 +0200 --- atop-1.23.orig/debian/README.Debian +++ atop-1.23/debian/README.Debian @@ -0,0 +1,23 @@ +atop Debian package +------------------- + +For comprehensive screenshots of atops capabilities and features and the HTML +online manual (if you don't have dwww and/or man2html installed locally) visit +the new official homepage at http://www.atconsultancy.nl/atop/home.html. + +Edelhard Becker Sat, 18 Dec 2004 12:59:37 +0100 + +There are the following changes made to the upstream source: + + - when installed, this package is started via init + - the kernel patch is not installed (mentioned in atop.1) + - the handling of logfiles is automated with logrotate (mentioned in atop.1) + +Edelhard Becker Fri Apr 25 12:26:45 CEST 2003 + +With release 1.10 the raw binary log file format has changed. This should be no +big problem since the package only keeps 14 rotations (i.e. 2 weeks when +rotated daily as the default is) of logfiles. If you need to replay old +logfiles, just install 1.9-6 additionally. + +Edelhard Becker Mon, 30 Jun 2003 16:44:50 +0200 --- atop-1.23.orig/debian/rules +++ atop-1.23/debian/rules @@ -0,0 +1,94 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + # Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/atop. + $(MAKE) install DESTDIR=$(CURDIR)/debian/atop + # remove unnecessary files + rm -rf $(CURDIR)/debian/atop/etc/atop $(CURDIR)/debian/atop/etc/rc.d + rm -rf $(CURDIR)/debian/atop/var/log/atop/dummy* $(CURDIR)/debian/atop/etc/cron.d + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot +# dh_installdebconf + dh_installdocs +# dh_installexamples +# dh_installmenu + dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime + dh_installinit +# dh_installcron + dh_installman +# dh_installinfo +# dh_undocumented + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- atop-1.23.orig/debian/watch +++ atop-1.23/debian/watch @@ -0,0 +1,9 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# Site Directory Pattern Version Script +version=2 +# the old ftp site +#ftp://ftp.atcomputing.nl/pub/tools/linux/atop-(.*)\.tar\.gz debian uupdate +# the new website +http://www.atconsultancy.nl/atop/download.html packages/atop-(.*)\.tar\.gz --- atop-1.23.orig/debian/dirs +++ atop-1.23/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/share/man/man1