You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Roman Neuhauser <ne...@chello.cz> on 2004/06/29 22:19:13 UTC

svnlook error message may end up in repos/db/nodes

I managed to destroy a repository by fooling around with svnlook's
stdout and stderr:

roman@isis ~/tmp 1048:0 > rm -fr wc repos
roman@isis ~/tmp 1049:0 > svnadmin create ./repos
roman@isis ~/tmp 1050:0 > (cd import; svn import . file:///home/roman/tmp/repos --message 'Initial repository layout')
Adding         foo

Committed revision 1.
roman@isis ~/tmp 1051:0 > svn co file:///home/roman/tmp/repos wc
A  wc/foo
Checked out revision 1.
roman@isis ~/tmp 1052:0 > cd wc
roman@isis ~/tmp/wc 1053:0 > echo '2' >|foo
roman@isis ~/tmp/wc 1054:0 > cat foo
2
roman@isis ~/tmp/wc 1055:0 > svn ci -m fubar
Sending        foo
Transmitting file data .
Committed revision 2.
roman@isis ~/tmp/wc 1056:0 > svnlook diff -r 2 /home/roman/tmp/repos
Modified: foo
(...)
roman@isis ~/tmp/wc 1057:0 > svnlook diff -r 2 /home/roman/tmp/repos >&- 2>&-
roman@isis ~/tmp/wc 1058:1 > svnlook diff -r 2 /home/roman/tmp/repos
Modified: foo
(...)
roman@isis ~/tmp/wc 1059:0 > svnlook diff -r 2 /home/roman/tmp/repos >&-
svn: Can't write to stream: Bad file descriptor
roman@isis ~/tmp/wc 1060:1 > svnlook diff -r 2 /home/roman/tmp/repos
Modified: foo
(...)
roman@isis ~/tmp/wc 1061:0 > svnlook diff -r 2 /home/roman/tmp/repos >&- 2>&-
roman@isis ~/tmp/wc 1062:1 > svnlook diff -r 2 /home/roman/tmp/repos
Modified: foo
(...)
roman@isis ~/tmp/wc 1063:0 > svnlook diff -r 2 /home/roman/tmp/repos 2>&-
Modified: foo
(...)
roman@isis ~/tmp/wc 1064:0 > svnlook diff -r 2 /home/roman/tmp/repos >&- 2>&1
zsh: 1: bad file descriptor
roman@isis ~/tmp/wc 1065:1 > svnlook diff -r 2 /home/roman/tmp/repos >&- 2>&-
roman@isis ~/tmp/wc 1066:1 > svnlook diff -r 2 /home/roman/tmp/repos
svn: Berkeley DB error while opening 'nodes' table for filesystem /home/roman/tmp/repos/db:
Invalid argument
roman@isis ~/tmp/wc 1067:1 > head -1 ../repos/db/nodes
svn: Can't write to stream: Bad file descriptor


the above doesn't seem to be a reliable trigger, but getting the text in
the db/nodes file is just a matter of the number of tries; perhaps there
is a race somewhere?

this was achieved on FreeBSD 4.10-STABLE i386 with these versions:

roman@isis ~/tmp/wc 1198:0 > ldd $(which svnlook)
/usr/local/bin/svnlook:
        libsvn_repos-1.so.0 => /usr/local/lib/libsvn_repos-1.so.0 (0x2806d000)
        libsvn_fs-1.so.0 => /usr/local/lib/libsvn_fs-1.so.0 (0x2807e000)
        libsvn_delta-1.so.0 => /usr/local/lib/libsvn_delta-1.so.0 (0x2809a000)
        libsvn_diff-1.so.0 => /usr/local/lib/libsvn_diff-1.so.0 (0x280a1000)
        libsvn_subr-1.so.0 => /usr/local/lib/libsvn_subr-1.so.0 (0x280a8000)
        libaprutil-0.so.9 => /usr/local/lib/libaprutil-0.so.9 (0x280c6000)
        libdb4.so.0 => /usr/local/lib/libdb4.so.0 (0x280da000)
        libexpat.so.5 => /usr/local/lib/libexpat.so.5 (0x28160000)
        libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x2817d000)
        libapr-0.so.9 => /usr/local/lib/libapr-0.so.9 (0x2826a000)
        libm.so.2 => /usr/lib/libm.so.2 (0x28288000)
        libcrypt.so.2 => /usr/lib/libcrypt.so.2 (0x282a4000)
        libc_r.so.4 => /usr/lib/libc_r.so.4 (0x282be000)
roman@isis ~/tmp/wc 1199:0 > ldd $(which svnlook)|awk '/=>/{print $3}'|while read l; do echo -n "$l: "; pkg_which $l; done
/usr/local/lib/libsvn_repos-1.so.0: subversion-1.0.5
/usr/local/lib/libsvn_fs-1.so.0: subversion-1.0.5
/usr/local/lib/libsvn_delta-1.so.0: subversion-1.0.5
/usr/local/lib/libsvn_diff-1.so.0: subversion-1.0.5
/usr/local/lib/libsvn_subr-1.so.0: subversion-1.0.5
/usr/local/lib/libaprutil-0.so.9: apr-db4-0.9.4_9
/usr/local/lib/libdb4.so.0: db4-4.0.14_1,1
/usr/local/lib/libexpat.so.5: expat-1.95.7
/usr/local/lib/libiconv.so.3: libiconv-1.9.1_3
/usr/local/lib/libapr-0.so.9: apr-db4-0.9.4_9
/usr/lib/libm.so.2: ?
/usr/lib/libcrypt.so.2: ?
/usr/lib/libc_r.so.4: ?


let me know if you need more information.

-- 
FreeBSD 4.10-STABLE
12:08AM up 15:03, 5 users, load averages: 0.01, 0.01, 0.00

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svnlook error message may end up in repos/db/nodes

Posted by Tobias Ringström <to...@ringstrom.mine.nu>.
Roman Neuhauser wrote:

>roman@isis ~/tmp/wc 1065:1 > svnlook diff -r 2 /home/roman/tmp/repos >&- 2>&-
>roman@isis ~/tmp/wc 1066:1 > svnlook diff -r 2 /home/roman/tmp/repos
>svn: Berkeley DB error while opening 'nodes' table for filesystem /home/roman/tmp/repos/db:
>Invalid argument
>roman@isis ~/tmp/wc 1067:1 > head -1 ../repos/db/nodes
>svn: Can't write to stream: Bad file descriptor
>
>the above doesn't seem to be a reliable trigger, but getting the text in
>the db/nodes file is just a matter of the number of tries; perhaps there
>is a race somewhere?
>  
>
I'm not that surprised that this happens. What you do is that you're 
closing stdout and stderr which makes file descriptors 1 and 2 
available. The first two files that are created in svnlook will get file 
descriptors 1 and 2 which corresponds to stdout and stderr. If you print 
an error message at that point, it will be printed to file descriptor 2, 
i.e. whatever that file descriptor happens to be used for. In your case 
it was the nodes table. The reason it looks like a race is probably 
because of the bdb log files. You can use strace to find out which file 
handles are used for what.

I guess we should fix it... but is this something that applications 
generally tend to handle?

/Tobias


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org