<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - 't' modifier does not work well with thin archives"
   href="https://bugs.llvm.org/show_bug.cgi?id=39020">39020</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>'t' modifier does not work well with thin archives
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llvm-ar
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jh7370.2008@my.bristol.ac.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I was doing some investigation work and discovered that thin archvies +
llvm-ar's 't' modifier do not behave correctly, at least on Windows, although I
believe that some of it won't work on Linux either. Here is the reproducible
and resultant behaviour:

===

C:\Work>touch bar.o
C:\Work>touch D:\test\bar.o
C:\Work>mkdir dir
C:\Work>llvm-ar qcT test.a bar.o
C:\Work>llvm-ar qT test.a C:\Work\bar.o
C:\Work>llvm-ar qT test.a .\bar.o
C:\Work>llvm-ar qT test.a .\..\Work\bar.o
C:\Work>llvm-ar qT test.a dir\..\bar.o
C:\Work>llvm-ar qT test.a \Work\bar.o
C:\Work>llvm-ar qT test.a D:\test\bar.o

C:\Work>llvm-ar t test.a
/bar.o
/C:\Work\bar.o
/./bar.o
/./../Work/bar.o
/dir/../bar.o
//Work/bar.o
/D:\test\bar.o

C:\Work>cd dir
C:\Work\dir>llvm-ar t ..\test.a
../bar.o
../C:\Work\bar.o
.././bar.o
.././../Work/bar.o
../dir/../bar.o
..//Work/bar.o
../D:\test\bar.o

C:\Work\dir>cd ..\..
C:\>llvm-ar t Work\test.a
Work/bar.o
Work/C:\Work\bar.o
Work/./bar.o
Work/./../Work/bar.o
Work/dir/../bar.o
Work/D:\test\bar.o
Work//Work/bar.o

C:\>d:
D:\>llvm-ar t C:\Work\test.a
C:\Work/bar.o
C:\Work/C:\Work\bar.o
C:\Work/./bar.o
C:\Work/./../Work/bar.o
C:\Work/dir/../bar.o
C:\Work/D:\test\bar.o
C:\Work//Work/bar.o

===

There are three related, but different issues:
1) llvm-ar should not prepend '/' to the front of paths on Windows, if the
archive is in the current working directory. At the very least, it should be
'./', but I think it should probably just not do anything in this case.
2) For absolute paths, starting either with a drive specifier, nothing should
ever be prepended. The paths are absolute, so the relative location of the
archive to the working directory is irrelevant.
3) Paths relative to the current drive (i.e. starting with '\') should not have
anything pre-prended, unless they are on a different drive to the current
directory, in which case, they should only have the drive letter + ':'
prepended.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>