namspace: trace DOS namespace name generation
Add namespace-level tracing for DOS name generation to verify the parent directory and real Unix name used for alias collision handling.
This commit is contained in:
@@ -2562,17 +2562,10 @@ static void build_dos_attr_name(int volume, uint8 *path, char *unixname,
|
||||
}
|
||||
|
||||
/*
|
||||
* Some old DOS scan paths already pass the synthesized 8.3 alias in
|
||||
* `path`/nwpath->fn. If `unixname` was rebuilt from that alias, it no
|
||||
* longer identifies the real long on-disk name; using it would collapse
|
||||
* colliding long directories back to the same raw alias, e.g. LONG_DIR.
|
||||
* Prefer the real unixname when it is available. Some namespace/DOS scan
|
||||
* paths pass an already synthesized 8.3 name in `path`; if we return that
|
||||
* blindly, colliding long directories can both be displayed as LONG_DIR.
|
||||
*/
|
||||
if (path && *path && dos_is_83_name(path, options)) {
|
||||
strmaxcpy(out, path, out_len-1);
|
||||
up_fn(out);
|
||||
return;
|
||||
}
|
||||
|
||||
if (unixname && *unixname) {
|
||||
strmaxcpy(parent, unixname, sizeof(parent)-1);
|
||||
slash = strrchr(parent, '/');
|
||||
@@ -2586,6 +2579,14 @@ static void build_dos_attr_name(int volume, uint8 *path, char *unixname,
|
||||
}
|
||||
}
|
||||
|
||||
/* Fallback: keep a previously synthesized DOS alias only when there is no
|
||||
* reliable real unixname to rebuild from. */
|
||||
if (path && *path && dos_is_83_name(path, options)) {
|
||||
strmaxcpy(out, path, out_len-1);
|
||||
up_fn(out);
|
||||
return;
|
||||
}
|
||||
|
||||
build_dos_83_alias(options, NULL,
|
||||
leaf, stb ? stb->st_ino : 0, out, out_len);
|
||||
}
|
||||
@@ -2599,7 +2600,7 @@ void get_dos_file_attrib(NW_DOS_FILE_INFO *f,
|
||||
uint8 spath[14];
|
||||
uint32 nw_owner=get_file_owner(stb);
|
||||
build_dos_attr_name(volume, path, unixname, stb, spath, sizeof(spath));
|
||||
XDPRINTF((1,0,"DOSFILEATTR path='%s' unix='%s' alias='%s' inode=%ld", path ? (char*)path : "", unixname ? unixname : "", spath, stb ? (long)stb->st_ino : 0L));
|
||||
XDPRINTF((0,0,"DOSFILEATTR path='%s' unix='%s' alias='%s' inode=%ld", path ? (char*)path : "", unixname ? unixname : "", spath, stb ? (long)stb->st_ino : 0L));
|
||||
f->namlen=min(strlen((char*)spath), 12);
|
||||
strncpy((char*)f->name, (char*)spath, f->namlen);
|
||||
U32_TO_32(get_nw_attrib_dword(volume, unixname, stb), f->attributes);
|
||||
@@ -2626,7 +2627,7 @@ void get_dos_dir_attrib(NW_DOS_DIR_INFO *f,
|
||||
{
|
||||
uint8 spath[14];
|
||||
build_dos_attr_name(volume, path, unixname, stb, spath, sizeof(spath));
|
||||
XDPRINTF((1,0,"DOSFILEATTR path='%s' unix='%s' alias='%s' inode=%ld", path ? (char*)path : "", unixname ? unixname : "", spath, stb ? (long)stb->st_ino : 0L));
|
||||
XDPRINTF((0,0,"DOSFILEATTR path='%s' unix='%s' alias='%s' inode=%ld", path ? (char*)path : "", unixname ? unixname : "", spath, stb ? (long)stb->st_ino : 0L));
|
||||
f->namlen=min(strlen((char*)spath), 12);
|
||||
strncpy((char*)f->name, (char*)spath, f->namlen);
|
||||
U32_TO_32(get_nw_attrib_dword(volume, unixname, stb),
|
||||
|
||||
@@ -922,6 +922,11 @@ static int build_dos_name(DIR_BASE_ENTRY *e, uint8 *fname, int size_fname)
|
||||
e->nwpath.statb.st_ino,
|
||||
fname,
|
||||
size_fname);
|
||||
XDPRINTF((0,0,"NSDOSNAME parent='%s' real='%s' alias='%s' inode=%ld",
|
||||
parent_unix ? parent_unix : "",
|
||||
e->nwpath.fn ? (char*)e->nwpath.fn : "",
|
||||
fname ? (char*)fname : "",
|
||||
(long)e->nwpath.statb.st_ino));
|
||||
xfree(parent_unix);
|
||||
return(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user