Skip to Content.
Sympa Menu

sm-sorcery-bugs - [SM-Sorcery-Bugs] [Bug 13588] New: gaze has some bad tmp dir/$TMP_DIR usage

sm-sorcery-bugs AT lists.ibiblio.org

Subject: Bugs for Sorcery are reported here

List archive

Chronological Thread  
  • From: bugzilla-daemon AT bugs.sourcemage.org
  • To: sm-sorcery-bugs AT lists.ibiblio.org
  • Subject: [SM-Sorcery-Bugs] [Bug 13588] New: gaze has some bad tmp dir/$TMP_DIR usage
  • Date: 4 Mar 2007 20:55:02 -0000

http://bugs.sourcemage.org/show_bug.cgi?id=13588

Summary: gaze has some bad tmp dir/$TMP_DIR usage
Product: Sorcery
Version: 1.14.x
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: Gaze
AssignedTo: sm-sorcery-bugs AT lists.ibiblio.org
ReportedBy: jakakranjc AT email.si


gaze uses some hardcoded /tmp files. I noticed I have some leftovers around
and
then did some research on which are bad:
$ ls /tmp/gaze*
/tmp/gaze.seen.10753 /tmp/gaze.seen.13785 /tmp/gaze.seen.32481 /tmp/
gaze.seen.694
/tmp/gaze.seen.12844 /tmp/gaze.seen.18369 /tmp/gaze.seen.32586 /tmp/
gaze.seen.9185
/tmp/gaze.seen.12889 /tmp/gaze.seen.29769 /tmp/gaze.seen.4909

$ grep -n /tmp usr/sbin/gaze
805: if ! [ -d "/tmp/liblock-0/cast.$1" ]
810: tail /tmp/$1.compile.log \
811: --follow=name --pid=$(ls "/tmp/liblock-0/cast.$1") 2>/dev/null
821: local FILE=`find /tmp/liblock-0 -maxdepth 1 -mindepth 1 -name "cast.*" |
826: tail $(find /tmp/sorcery/cast/ -name $FILE.compile.log )\
827: --follow=name --pid=$(ls "/tmp/liblock-0/cast.$FILE") 2>/dev/null
1486: FOUND="/tmp/gaze.seen.$$"
1940: export TMP_DIR=/tmp
2088: if [ ${TMP_DIR:0:13} == "/tmp/sorcery/" ]; then

A line by line analysis follows.

805, 811, 821 and 827 should use LOCK_DIR, in case anyone modifies it:
$ git grep -n liblock-
etc/sorcery/config:135: LOCK_DIR=/tmp/liblock-$UID
usr/sbin/gaze:805: if ! [ -d "/tmp/liblock-0/cast.$1" ]
usr/sbin/gaze:811: --follow=name --pid=$(ls "/tmp/liblock-0/cast.$1")
2>/dev/
null
usr/sbin/gaze:821: local FILE=`find /tmp/liblock-0 -maxdepth 1 -mindepth 1 -
name "cast.*" |
usr/sbin/gaze:827: --follow=name --pid=$(ls "/tmp/liblock-0/
cast.$FILE") 2>/dev/null

810 looks plain wrong to me, build api and gaze:826 suggest it is in the
cast's
TMP_DIR (suggested fix is to make it like 826):
$ git grep -n \\.compile.log
usr/sbin/alter:32: C_LOG=$TMP_DIR/$SPELL-$VERSION.compile.log
usr/sbin/delve:91: C_LOG=${C_LOG:="/tmp/sorcery/delve/$SPELL.compile.log"}
usr/sbin/gaze:810: tail /tmp/$1.compile.log \
usr/sbin/gaze:826: tail $(find /tmp/sorcery/cast/ -name $FILE.compile.log
)\
var/lib/sorcery/modules/build_api/api1:27: C_LOG=$TMP_DIR/$SPELL.compile.log
var/lib/sorcery/modules/build_api/api2:31: export C_LOG=$TMP_DIR/
$SPELL.compile.log

826 looks ok, the root of $TMP_DIR is hardcoded to /tmp/sorcery as cast
doesn't
call mk_tmp_dirs with the second parameter

1486 should use gaze's $TMP_DIR, so the files get removed on cleanup.
However,
this would only work for the root user, so I suggest gaze_show_dependencies
(the function where this call is) does some manual cleanup after it is done
too
(like gaze alien).

1940 and 2088 are fine

I hope all this line referencing isn't too confusing.
Is there anything wrong with my conclusions? If not, I will prepare a patch.
If
there is, I'll prepare a modified one. :)

--
Configure bugmail: http://bugs.sourcemage.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



  • [SM-Sorcery-Bugs] [Bug 13588] New: gaze has some bad tmp dir/$TMP_DIR usage, bugzilla-daemon, 03/04/2007

Archive powered by MHonArc 2.6.24.

Top of Page