testAnnotate, testStatus, testIgnored fails if temp dir is a symlink

Bug #551351 reported by Ian Brandt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Java library for Bazaar
Fix Committed
Low
Piotr Piastucki
bzr-xmloutput
Fix Committed
Undecided
Unassigned

Bug Description

Surefire report attached.

Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
Java version: 1.5.0_22
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.2" arch: "i386" Family: "unix"

Failed tests:
  testAnnotate(org.vcs.bazaar.client.BazaarClientTest)
  testStatus(org.vcs.bazaar.client.BazaarClientTest)
  testIgnored(org.vcs.bazaar.client.BazaarClientTest)

Tests run: 77, Failures: 3, Errors: 0, Skipped: 5

Related branches

Revision history for this message
Ian Brandt (ian-ianbrandt) wrote :
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

Hi Ian,

Hmm, looks like your tmp dir is a symlink and bzr-java-lib test suite doesn't like that

Please try running the tests using -Djava.io.tmpdir=<path/to/dir>

e.g:

$> mvn test -Djava.io.tmpdir=/tmp

Regards

summary: - Failed tests: testAnnotate, testStatus, testIgnored
+ testAnnotate, testStatus, testIgnored fails if temp dir is a symlink
Changed in bzr-java-lib:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Ian Brandt (ian-ianbrandt) wrote :

Ah yes. Standard on Mac is:

$ ls -al /tmp
lrwxr-xr-x 1 root wheel 11 Dec 12 08:42 /tmp -> private/tmp

This fails:

mvn test -Djava.io.tmpdir=/tmp

This passes:

mvn test -Djava.io.tmpdir=/private/tmp

Thanks!

Changed in bzr-java-lib:
milestone: none → 1.3
assignee: nobody → Piotr Piastucki (piastucki)
Changed in bzr-java-lib:
status: Confirmed → In Progress
Revision history for this message
Piotr Piastucki (piastucki) wrote :

testAnnotate and testStatus can be fixed in bzr-java-lib by changing the respective asserts. Symlinks are expanded by bzr when branch root path is calculated hence they will not appear in the resulting paths and we need to compare canonical paths instead of absolute paths.

testIgnored fails because of the bug in xmloutput plugin. The following piece of code in lsxml.py is broken as it:
1) appends relative path to prefix, which will contain a symlink rather than the actual path
2) tries to find the relative path using branch root, which contains the actual path rather than a symlink.
3) As a result the correct relative path is not found and pattern lookup fails

            if prefix:
                fp = osutils.pathjoin(prefix, fp)
            if fid is None:
                fid = ''
            else:
                fid = '<id>%s</id>' % _escape_cdata(fid)
            fkind = '<kind>%s</kind>' % fkind
            status_kind = '<status_kind>%s</status_kind>' % long_status_kind[fc]
            fpath = '<path>%s</path>' % _escape_cdata(fp)
            if fc == 'I' and ignored:
                # get the pattern
                if tree.basedir in fp:
                    pat = tree.is_ignored(tree.relpath(fp))
                else:
                    pat = tree.is_ignored(fp)
                pattern = '<pattern>%s</pattern>' % _escape_cdata(pat)

This should be changed to:

            if fc == 'I' and ignored:
                # get the pattern
                pat = tree.is_ignored(fp)
                pattern = '<pattern>%s</pattern>' % _escape_cdata(pat)
            else:
                pattern = ''
            if prefix:
                fp = osutils.pathjoin(prefix, fp)
            if fid is None:
                fid = ''
            else:
                fid = '<id>%s</id>' % _escape_cdata(fid)
            fkind = '<kind>%s</kind>' % fkind
            status_kind = '<status_kind>%s</status_kind>' % long_status_kind[fc]
            fpath = '<path>%s</path>' % _escape_cdata(fp)

Changed in bzr-xmloutput:
status: New → Fix Committed
Changed in bzr-java-lib:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.