Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 64743 - sarg uses wrong /tmp directory
Summary: sarg uses wrong /tmp directory
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Jonathan Smith (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-20 05:22 UTC by Vermyndax
Modified: 2005-06-22 07:40 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
sarg-1.4.1-r3.ebuild holding four new patches (sarg-1.4.1-r3.ebuild,1.47 KB, text/plain)
2004-09-21 06:10 UTC, Andreas Kobara
Details
sarg-1.4.1-email.c.patch (fix double removing of directory when email-reporting is activated) (sarg-1.4.1-email.c.patch,309 bytes, patch)
2004-09-21 06:11 UTC, Andreas Kobara
Details | Diff
sarg-1.4.1-util.c.patch add parametercheck to builddia() from sf.net (sarg-1.4.1-util.c.patch,960 bytes, patch)
2004-09-21 06:12 UTC, Andreas Kobara
Details | Diff
sarg-1.4.1-nocache.patch allows to add META-field "Cache-Control" in total report files from sf.net (sarg-1.4.1-nocache.patch,9.26 KB, patch)
2004-09-21 06:13 UTC, Andreas Kobara
Details | Diff
sarg-1.4.1-redirector.patch adds support of handling of log-files for programms like SquidGuard from sf.net (sarg-1.4.1-redirector.patch,10.03 KB, patch)
2004-09-21 06:14 UTC, Andreas Kobara
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vermyndax 2004-09-20 05:22:57 UTC
Using sarg stable (1.4.1-r2) - when running sarg with the sarg.conf file set up, sarg creates an incorrect tmp dir in /tmp, then fails to do anything with the tmp files:

SARG: Successful report generated and sent to xxx@xxx
SARG: (removetmp) Cannot open file: /tmp/sarg_tmp/2004Sep18-2004Sep20/geral

In actuality, sarg creates a directory named /tmp/sarg, not /tmp/sarg_tmp.  I tried renaming the directory to /tmp/sarg but it was renamed back to the incorrect one on the next sarg run.

I also tried setting a tmp dir in sarg.conf, but sarg reads the tmp file directive, then creates a /sarg beneath the tmp directory I set, still resulting in the failure.  For example, if I set the tmp dir to be /tmp/sarg, then on the next run sarg creates /tmp/sarg/sarg and gives the same error about removing it from /tmp/sarg/sarg_tmp.

Reproducible: Always
Steps to Reproduce:
1. emerge sarg
2. set up sarg.conf
3. run sarg ("sarg")

Actual Results:  
SARG: Successful report generated and sent to xxx@xxx
SARG: (removetmp) Cannot open file: /tmp/sarg_tmp/2004Sep18-2004Sep20/geral

Expected Results:  
Worked with the files in the tmp dir and process them correctly

Portage 2.0.50-r11 (default-x86-1.4, gcc-3.3.4, glibc-2.3.3.20040420-r1, 2.6.8-
gentoo-r3)
=================================================================
System uname: 2.6.8-gentoo-r3 i686 Pentium III (Coppermine)
Gentoo Base System version 1.4.16
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) 
[disabled]
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium3 -fprefetch-loop-arrays -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share
/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -fprefetch-loop-arrays -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://open-systems.ufl.edu/mirrors/gentoo 
ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://mirrors.tds.net/gentoo 
ftp://mirrors.tds.net/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="apache2 apm berkdb bitmap-fonts crypt cups encode foomaticdb gd gd-
external gdbm gif gpm imagemagick imap jpeg kerberos ldap libwww maildir mysql 
ncurses nls offensive pam pdflib perl php png python readline samba sasl slang 
spell ssl svga tcpd truetype x86 xml xml2 xprint zlib"
Comment 1 Andreas Kobara 2004-09-20 13:36:15 UTC
By the way sarg's homepage changed to: http://sarg.sourceforge.net/sarg.php
Comment 2 Andreas Kobara 2004-09-20 14:01:48 UTC
Vermyndax,

sorry I cannot confirm that, it works without any problems here.
The only thing I did set in sarg.conf was the "access" confline
and "output". And it works without problems.
I also tried changing the "tmp" confline, and it works also.
I used strace to verify file and directory access, and it looks good,
except for some careful unlinks of unused logfiles, but that's ok.

Can you send me your sarg.conf by private email ?
Andy.
Comment 3 Vermyndax 2004-09-20 14:09:18 UTC
Andy...

I will email you my sarg.conf, but I did notice in the source file email.c:

sprintf(csort,"rm -r %s/sarg_tmp",TempDir);

Wouldn't that hard-code the tmp directory?  (Still learning C here)...
Comment 4 Andreas Kobara 2004-09-21 06:09:29 UTC
I can confirm your error now. It happens when "ouput_email" is set.

And I found three outstanding patches, which are not implemented yet,
but they're not concerning your problem.

About "hardcode", no what you define with "temporary_dir" is just a
prefix to sargs own tempdir, but it's using even more beside...

So here's a new ebuild and in summary four "new" patches.
Comment 5 Andreas Kobara 2004-09-21 06:10:53 UTC
Created attachment 40071 [details]
sarg-1.4.1-r3.ebuild holding four new patches
Comment 6 Andreas Kobara 2004-09-21 06:11:51 UTC
Created attachment 40072 [details, diff]
sarg-1.4.1-email.c.patch (fix double removing of directory when email-reporting is activated)
Comment 7 Andreas Kobara 2004-09-21 06:12:57 UTC
Created attachment 40073 [details, diff]
sarg-1.4.1-util.c.patch  add parametercheck to builddia() from sf.net
Comment 8 Andreas Kobara 2004-09-21 06:13:41 UTC
Created attachment 40074 [details, diff]
sarg-1.4.1-nocache.patch allows to add META-field "Cache-Control" in total report files from sf.net
Comment 9 Andreas Kobara 2004-09-21 06:14:12 UTC
Created attachment 40075 [details, diff]
sarg-1.4.1-redirector.patch adds support of handling of log-files for programms like SquidGuard from sf.net
Comment 10 Vermyndax 2004-09-21 09:37:05 UTC
Wow, I actually filed a confirmed bug!  Whew... ;)

Your ebuild/patches worked fine, Sarg is generating reports without errors now.  Many thanks!
Comment 11 Andreas Kobara 2004-09-21 11:56:37 UTC
Could someone from gentoo staff please still change a few more things:

1) The homepage-address: http://sarg.sourceforge.net
2) The src_uri of the main package: on sourceforge-mirror
3) The sort.index-patch is not available on the original site, it is
   fetched from the gentoo-mirrors. (src_uri is wrong)
4) Since we have those much patches, put them in a tarball and distribute
   it via distfiles. You may remove the old sort.index-patch from distfiles
   along with any old ebuilds depending on it.
5) All this will resolve the last warning line, when trying to unpack the
   plaintext sort.index-patch

Best regards,
Andy.
Comment 12 Eldad Zack (RETIRED) gentoo-dev 2004-11-21 01:44:09 UTC
Can you provide a unified patch diff for the source and a diff against the build with the changes you've tested?
Comment 13 Daniel Black (RETIRED) gentoo-dev 2005-01-08 01:28:10 UTC
see also 71656
Comment 14 Daniel Black (RETIRED) gentoo-dev 2005-01-25 00:05:10 UTC
Jared - you bug - have fun.
Comment 15 Eldad Zack (RETIRED) gentoo-dev 2005-05-02 06:38:38 UTC
Andreas, do newer sarg versions (2.0.x) has these fixes included?
Comment 16 Andreas Kobara 2005-05-05 10:40:42 UTC
no, the nocache and email patch is missing.
NoCache is just a feature, the email-thingie seem to happen on some machines...
no idea why.
Anyway 2.0.7 has so many security fixes, that we should completly remove the old
1.4.x which is really out of date.
Comment 17 Jonathan Smith (RETIRED) gentoo-dev 2005-06-22 07:40:05 UTC
fixed with 2.0.8