Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Restore the ability to add symlinks located inside subdirectories |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
9d75d6ae887d17efcf161c549933505b |
| User & Date: | andygoth 2020-09-15 19:23:33.987 |
About
Test procedure demonstrating the problem fixed by this commit:
mkdir test
cd 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
This is due to the stat buffer examined by file_islink(0) being for the directory containing the link, rather than the link itself. The call to file_islink(0) is preceded by a call to file_nondir_objects_on_path(), which overwrites the stat buffer. The fix is to call file_islink(0) first.
Context
|
2020-09-15
| ||
| 20:52 | Allow files to be converted to symlinks and vice versa without an intermediate check-in to delete them ... (check-in: e0aebc21c6 user: andygoth tags: trunk) | |
| 19:23 | Restore the ability to add symlinks located inside subdirectories ... (check-in: 9d75d6ae88 user: andygoth tags: trunk) | |
| 19:23 | Remove some end-of-line whitespace and fix some very minor comment typos and capitalization errors ... (check-in: 0537925523 user: andygoth tags: trunk) | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
" WHERE pathname=%Q %s", zPath, filename_collation()) ){
db_multi_exec("UPDATE vfile SET deleted=0"
" WHERE pathname=%Q %s AND deleted",
zPath, filename_collation());
}else{
char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
int isExe = file_isexe(zFullname, RepoFILE);
if( file_nondir_objects_on_path(g.zLocalRoot, zFullname) ){
/* Do not add unsafe files to the vfile */
doSkip = 1;
}else{
db_multi_exec(
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink,mhash)"
"VALUES(%d,0,0,0,%Q,%d,%d,NULL)",
| > | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
" WHERE pathname=%Q %s", zPath, filename_collation()) ){
db_multi_exec("UPDATE vfile SET deleted=0"
" WHERE pathname=%Q %s AND deleted",
zPath, filename_collation());
}else{
char *zFullname = mprintf("%s%s", g.zLocalRoot, zPath);
int isExe = file_isexe(zFullname, RepoFILE);
int isLink = file_islink(0);
if( file_nondir_objects_on_path(g.zLocalRoot, zFullname) ){
/* Do not add unsafe files to the vfile */
doSkip = 1;
}else{
db_multi_exec(
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname,isexe,islink,mhash)"
"VALUES(%d,0,0,0,%Q,%d,%d,NULL)",
vid, zPath, isExe, isLink);
}
fossil_free(zFullname);
}
if( db_changes() && !doSkip ){
fossil_print("ADDED %s\n", zPath);
return 1;
}else{
|
| ︙ | ︙ |