Issue #419
s4 update fails to remove a view when it is removed from viewspec
| Status: | New | Start date: | 11/08/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | Wilson Snyder | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - |
Description
JoeD noticed this bug. In his case, he was trying to remove one viewed area while adding two others. After he updated, the "removed" area remained.
Here is a simple testcase. I tried something more general, but I couldn't reproduce. I think the names I used are triggering the bug.
Given an initial viewspec:view ^/void project view ^/dvtools/trunk dvtools ##view ^/dvtools/branches/spoc dvtools-spoc ##view ^/dvtools/branches/ovmtools dvtools-ovmtoolsThe initial update gives the correct configuration:
$ s4 update $ ls -l total 12 -rw-rw-r-- 1 bdobbie caveo 98 Nov 8 13:17 Project.viewspec drwxrwxr-x 5 bdobbie caveo 4096 Nov 8 13:17 dvtools drwxrwxr-x 3 bdobbie caveo 4096 Nov 8 13:17 projectThe viewspec is then changed to:
view ^/void project ##view ^/dvtools/trunk dvtools view ^/dvtools/branches/spoc dvtools-spoc view ^/dvtools/branches/ovmtools dvtools-ovmtoolsAs you can see, the original "dvtools" directory is left behind:
$ s4 update $ ls -l total 20 -rw-rw-r-- 1 bdobbie caveo 146 Nov 8 13:18 Project.viewspec drwxrwxr-x 5 bdobbie caveo 4096 Nov 8 13:17 dvtools drwxrwxr-x 5 bdobbie caveo 4096 Nov 8 13:18 dvtools-ovmtools drwxrwxr-x 5 bdobbie caveo 4096 Nov 8 13:18 dvtools-spoc drwxrwxr-x 3 bdobbie caveo 4096 Nov 8 13:17 projectHere is an interesting portion of debug output for the second update command:
{s4-15987 13:37:28.023818 -perl/SVN/S4:0305} Requiring file /nfs/dv12/bdobbie/s4-test/.svn/s4_state
{s4-15987 13:37:28.025084 /S4/ViewSpec:0063} s4: Compare hash 'b7089e46b1aa5d6b0083aa58a78e67dc' against old 'fa78783dff88e507c57d75c9b60dcb06'
{s4-15987 13:37:28.025126 /S4/ViewSpec:0340} revision is 94286
{s4-15987 13:37:28.025184 /S4/ViewSpec:0349} Action: cmd=switch dir=dvtools-ovmtools fileline=/nfs/dv12/bdobbie/s4-test/Project.viewspec:5
rev=94286 url=svn+ssh://masvn/svn/dvtools/branches/ovmtools
{s4-15987 13:37:28.212546 /S4/ViewSpec:0362} s4: Creating empty directory to switch into: dvtools-ovmtools
{s4-15987 13:37:28.212608 /S4/ViewSpec:0511} s4: does 'dvtools-ovmtools' exist in /nfs/dv12/bdobbie/s4-test? if not, make it
{s4-15987 13:37:28.212848 /S4/ViewSpec:0533} s4: create_switchpoint dvtools-ovmtools from basedir /nfs/dv12/bdobbie/s4-test
{s4-15987 13:37:28.499492 -perl/SVN/S4:0239} + 'svn_orig switch --quiet svn+ssh://masvn/svn/void /nfs/dv12/bdobbie/s4-test/dvtools-ovmtools'
{s4-15987 13:37:29.218287 /S4/ViewSpec:0382} s4: uuid_from_url svn+ssh://masvn/svn/dvtools/branches/ovmtools
s4: Switching dvtools-ovmtools to ^/dvtools/branches/ovmtools rev 94286
{s4-15987 13:37:29.402656 -perl/SVN/S4:0239} + 'svn_orig switch svn+ssh://masvn/svn/dvtools/branches/ovmtools /nfs/dv12/bdobbie/s4-test/dvtools-ovmtools -r94286'
Updated to revision 94286.
{s4-15987 13:37:33.077531 /S4/ViewSpec:0349} Action: cmd=switch dir=dvtools-spoc fileline=/nfs/dv12/bdobbie/s4-test/Project.viewspec:4
rev=94286 url=svn+ssh://masvn/svn/dvtools/branches/spoc
{s4-15987 13:37:33.077804 /S4/ViewSpec:0362} s4: Creating empty directory to switch into: dvtools-spoc
{s4-15987 13:37:33.077883 /S4/ViewSpec:0511} s4: does 'dvtools-spoc' exist in /nfs/dv12/bdobbie/s4-test? if not, make it
{s4-15987 13:37:33.077933 /S4/ViewSpec:0533} s4: create_switchpoint dvtools-spoc from basedir /nfs/dv12/bdobbie/s4-test
{s4-15987 13:37:33.081821 -perl/SVN/S4:0239} + 'svn_orig switch --quiet svn+ssh://masvn/svn/void /nfs/dv12/bdobbie/s4-test/dvtools-spoc'
{s4-15987 13:37:34.231612 /S4/ViewSpec:0382} s4: uuid_from_url svn+ssh://masvn/svn/dvtools/branches/spoc
s4: Switching dvtools-spoc to ^/dvtools/branches/spoc rev 94286
{s4-15987 13:37:34.418667 -perl/SVN/S4:0239} + 'svn_orig switch svn+ssh://masvn/svn/dvtools/branches/spoc /nfs/dv12/bdobbie/s4-test/dvtools-spoc -r94286'
Updated to revision 94286.
{s4-15987 13:37:36.071376 /S4/ViewSpec:0349} Action: cmd=switch dir=project fileline=/nfs/dv12/bdobbie/s4-test/Project.viewspec:1
rev=94286 url=svn+ssh://masvn/svn/void
s4: Updating project
{s4-15987 13:37:36.072935 -perl/SVN/S4:0239} + 'svn_orig update /nfs/dv12/bdobbie/s4-test/project -r94286'
At revision 94286.
{s4-15987 13:37:37.021229 /S4/ViewSpec:0430} s4: prevlist: /export/dv12/bdobbie/s4-test/dvtools dvtools project
{s4-15987 13:37:37.021318 /S4/ViewSpec:0431} s4: thislist: /nfs/dv12/bdobbie/s4-test/dvtools-ovmtools
/nfs/dv12/bdobbie/s4-test/dvtools-spoc
dvtools-ovmtools dvtools-spoc project
s4: Remove unused switchpoint /export/dv12/bdobbie/s4-test/dvtools
{s4-15987 13:37:37.021763 /S4/ViewSpec:0465} Switchpoint /nfs/dv12/bdobbie/s4-test//export/dv12/bdobbie/s4-test/dvtools
has already been removed.
{s4-15987 13:37:37.021837 /S4/ViewSpec:0441} s4: Remember that we manage dvtools
Perhaps the most interesting line is the last one. Searching for that in the s4 source yields:
4768 DEBUG "s4: prevlist: ", join(' ',@prevlist), "\n" if $self->debug;
4769 DEBUG "s4: thislist: ", join(' ',@thislist), "\n" if $self->debug;
4770 foreach my $dir (@prevlist) {
4771 # I'm only interested in directories that were in @prevlist but
4772 # are not in @thislist. If dir is in both lists, quit.
4773 next if grep(/^$dir$/, @thislist);
4774 if (grep(/^$dir/, @thislist)) {
4775 # There is another mountpoint in @thislist that starts
4776 # with $dir, in other words there is a mountpoint underneath
4777 # this one. We can't remove the dir, but leave it in the
4778 # state file, so we can remove it when we have the chance.
4779 DEBUG "s4: Remember that we manage $dir\n" if $self->debug;
4780 push @{$self->{viewspec_managed_switches}}, $dir;
4781 next;
4782 }
4783 print "s4: Remove unused switchpoint $dir\n";
4784 $self->_remove_switchpoint (dir=>$dir, basepath=>$params{basepath});
4785 }
On line 4477, I think "/^$dir/" is matching the other dvtools-* areas. Perhaps the regexp may need to be enhanced.
History
Updated by Brad Dobbie 6 months ago
In fact, changing dvtools-* to *-dvtools does not trigger the bug. I think my suspicions about the code snippet above are valid.
view ^/dvtools/branches/spoc spoc-dvtools view ^/dvtools/branches/ovmtools ovmtools-dvtools
Also available in: Atom
![[logo]](/img/veripool_small.png)