[Starkit] sdx.kit bugs

Massimo Dal Zotto dz at debian.org
Mon Nov 7 16:21:20 CET 2005


On Mon, Nov 07, 2005 at 02:24:02PM +0100, Jean-Claude Wippler wrote:
> Massimo Dal Zotto wrote:
> 
> >I found some bugs in sdx.kit:
> >
> >1)  sdx.kit pollutes the global namespace. More specifically it  
> >creates
> >    two variables 'a' and 'b' at toplevel.
> 
> I adopted your patch, thanks.
> 
> >2)  ls lists some files as directories. See test2 and test4 in  
> >makefile.
> 
> You mean sdx and tclkit?  That is an artefact of the way these files  
> are mounted in Tcl's VFS.
> 
> >3)  ls fails on dangling symlinks, for example lockfiles created
> >    by emacs.
> 
> Fixed.
> 
> >4)  ls prints wrong permissions for files with u-rwx or g-rwx.
> 
> Fixed, I think.
> 
> I've updated sdx.kit and CVS.
> 
> -jcw

Thanks.

I have found also a way to replicate the fifth bug (test5). It seems that
it is related to the automagic vfs mount done by vfs::auto:


all:	download test

download: sdx.kit tclkit 

sdx.kit:
	wget http://www.equi4.com/pub/sk/sdx.kit
	chmod +x sdx.kit

tclkit:
	wget http://www.equi4.com/pub/tk/8.5a4/tclkit-linux-x86.gz
	gunzip -f tclkit-linux-x86.gz
	mv -f tclkit-linux-x86 tclkit
	chmod +x tclkit

test:	test1 test2 test3 test4 test5

test1:
	### test1: sdx.kit pollutes global namespace
	./tclkit sdx.kit eval eval "file stat . c; parray c"
	./tclkit sdx.kit eval eval "file stat . a; parray a"
	./tclkit sdx.kit eval eval "file stat . b; parray b"
	./tclkit sdx.kit eval eval "catch {puts a=[set a]; puts b=[set b]}"

test2:
	### test2: ls lists some files as directories (see also test4 file d)
	ls -l
	./tclkit sdx.kit ls -l

test3:
	### test3: ls fails on dangling symlinks (like emacs lockfiles)
	ln -nfs user at host.domain:1111111111 ".#Makefile"
	ls -lA
	./tclkit sdx.kit ls -l || true
	@rm -f ".#Makefile"

test4:
	### test4: ls prints wrong permissions for files with u-rwx or g-rwx
	touch a b c d; mkdir e
	chmod 000 a
	chmod 004 b
	chmod 040 c
	chmod 400 d
	chmod 000 e
	ls -ld a b c d e
	./tclkit sdx.kit ls -l
	./tclkit sdx.kit ls -l a b c d e
	@chmod 755 a b c d e; rm -rf a b c d e

test5:
	### test5: vfs::auto mounts Makefile as vfs
	cp -f Makefile Makefile.save
	ls -l *
	./tclkit sdx.kit ls -l *
	./tclkit sdx.kit ls -l Makefile
	./tclkit sdx.kit eval eval '\
	    package require vfs; \
	    vfs::auto Makefile; \
	    set f [open Makefile]; \
	    puts [read [set f]]'
	mv -f Makefile Makefile.new
	mv -f Makefile.save Makefile
	cmp -l Makefile Makefile.new || true
	tail -1 Makefile.new


Note the mk4 header appended at the end of Makefile even if it was opened
only for reading. It seems that the mount code doesn't check for a proper
vfs or mk4 db. This could potentially corrupt user files as in this case.

-- 
Massimo Dal Zotto


More information about the Starkit mailing list