Fossil

Artifact [583effbd9e]
Login

Artifact 583effbd9e6f95e0ac8f22fafae303751eaecea44620e1dbcc60dfbbe46c9837:

Wiki page [checkin/9d75d6ae887d17efcf161c549933505b9daf034de21a7629713ea90db247488e] by andygoth 2020-09-15 19:32:07.
D 2020-09-15T19:32:07.566
L checkin/9d75d6ae887d17efcf161c549933505b9daf034de21a7629713ea90db247488e
N text/x-markdown
U andygoth
W 864
Test procedure demonstrating the problem fixed by this commit:

```
mkdir test
fossil new test.fossil
fossil open test.fossil -f
fossil set allow-symlinks 1
mkdir subdir
cd subdir
ln -s xxx link
fossil addremove
fossil sql "SELECT islink FROM vfile"
fossil commit -m xxx
```

If the bug is not fixed, the SQL query will return "0" and the commit will fail:

```
ERROR: [subdir/link] is 3 bytes on disk but 0 in the repository
NOTICE: Repository version of [subdir/link] stored in [file-XXX]
working checkout does not match what would have ended up in the repository:  YYY versus ZZZ
```

The problem is that the stat buffer examined by file_islink(0) is for the directory containing the link, rather than the link itself.  This is due to it being preceded by a call to file_nondir_objects_on_path().  The fix is to call file_islink(0) first.
Z 162af15d6ddeeb39d388d83b84845a43