Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#538 ad fails under certain conditions, because cnid_for_paths_parent(...) (ad_utils.c) handles path concatenation wrongly

None
closed
nobody
None
1
2013-12-06
2013-11-08
Stefan Muenkner
No

When using "ad mv" like so:

ad mv /Volume/Path/File /Volume/Path/Target/File

where the volume path is "/Volume/Path" an error is generated with the following error message:

Nov 08 15:13:31.369557 [1717] {ad_util.c:360} (E:Default): lstat(rpath: Target/File, elem: CanvasScripts): /Volume/PathTarget/File: No such file or directory
Couldn't resolve CNID for parent of /Volume/PathTarget/File

The reason is, that cnid_for_paths_parent(...) (in ad_utils.c) splits the path into the volume (base) path [here /Volume/Path ] and the relative path to the target [Target/File]. The relative path is then split into path components and every component is then in a loop concatenated to a statpath (initially set to the volume path) to retrieve (and set?) the correct parent CNIDs. Within the loop the statpath gets a "/" appended after the relative path component is appended to statpath. This fails since the initial value of statpath is e.g. "/Volume/Path" without a trailing "/".

The attached patch moves the call to "EC_ZERO(bcatcstr(statpath, "/"));" to the start of the loop, fixing the error generation.

Additionally, "EC_NULL(statpath = bfromcstr(vol->volinfo.v_path));" was moved after the "if (l->qty==1)....", because the loop is only entered for l->qty!=1 and only then statpath is used.

1 Attachments

Discussion

  • Ralph Böhme
    Ralph Böhme
    2013-12-06

    • status: open --> closed
    • Group: -->