* fixed symlink creation and symlink attributes
* more debug output git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29562 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -47,8 +47,10 @@ inflate_data(uint8 *in, uint32 in_size, uint8 *out, uint32 out_size)
|
|||||||
status_t ret;
|
status_t ret;
|
||||||
|
|
||||||
ret = inflateInit(&stream);
|
ret = inflateInit(&stream);
|
||||||
if (ret != Z_OK)
|
if (ret != Z_OK) {
|
||||||
|
parser_debug("inflatInit failed\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
stream.avail_out = out_size;
|
stream.avail_out = out_size;
|
||||||
stream.next_out = out;
|
stream.next_out = out;
|
||||||
@@ -225,15 +227,19 @@ PkgDirectory::_InitPath(const char *path, BPath *destination)
|
|||||||
status_t ret = B_OK;
|
status_t ret = B_OK;
|
||||||
|
|
||||||
if (fPathType == P_INSTALL_PATH) {
|
if (fPathType == P_INSTALL_PATH) {
|
||||||
if (!path)
|
if (!path) {
|
||||||
|
parser_debug("_InitPath path is NULL\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
}
|
||||||
ret = destination->SetTo(path, fPath.String());
|
ret = destination->SetTo(path, fPath.String());
|
||||||
}
|
}
|
||||||
else if (fPathType == P_SYSTEM_PATH)
|
else if (fPathType == P_SYSTEM_PATH)
|
||||||
ret = destination->SetTo(fPath.String());
|
ret = destination->SetTo(fPath.String());
|
||||||
else {
|
else {
|
||||||
if (!path)
|
if (!path) {
|
||||||
|
parser_debug("_InitPath path is NULL\n");
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
BVolume volume(dev_for_path(path));
|
BVolume volume(dev_for_path(path));
|
||||||
ret = volume.InitCheck();
|
ret = volume.InitCheck();
|
||||||
@@ -294,8 +300,11 @@ PkgDirectory::_HandleAttributes(BPath *destination, BNode *node,
|
|||||||
ret = _ParseAttribute(buffer, node, &attrName, &nameSize, &attrType,
|
ret = _ParseAttribute(buffer, node, &attrName, &nameSize, &attrType,
|
||||||
&attrData, &dataSize, &temp, &tempSize, &attrCSize, &attrOSize,
|
&attrData, &dataSize, &temp, &tempSize, &attrCSize, &attrOSize,
|
||||||
&attrStarted, &done);
|
&attrStarted, &done);
|
||||||
if (ret != B_OK || done)
|
if (ret != B_OK || done) {
|
||||||
|
if (ret != B_OK)
|
||||||
|
parser_debug("_ParseAttribute failed for %s\n", destination->Path());
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] attrData;
|
delete[] attrData;
|
||||||
@@ -404,8 +413,8 @@ PkgDirectory::_ParseAttribute(uint8 *buffer, BNode *node, char **attrName,
|
|||||||
ssize_t wrote = node->WriteAttr(*attrName, *attrType, 0, *attrData,
|
ssize_t wrote = node->WriteAttr(*attrName, *attrType, 0, *attrData,
|
||||||
*attrOSize);
|
*attrOSize);
|
||||||
if(wrote != static_cast<ssize_t>(*attrOSize)) {
|
if(wrote != static_cast<ssize_t>(*attrOSize)) {
|
||||||
ret = B_ERROR;
|
parser_debug("Failed to write attribute %s %s\n", *attrName, strerror(wrote));
|
||||||
return ret;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
*attrStarted = false;
|
*attrStarted = false;
|
||||||
@@ -415,8 +424,8 @@ PkgDirectory::_ParseAttribute(uint8 *buffer, BNode *node, char **attrName,
|
|||||||
*attrOSize = 0;
|
*attrOSize = 0;
|
||||||
|
|
||||||
parser_debug(" > Attribute added.\n");
|
parser_debug(" > Attribute added.\n");
|
||||||
}
|
} else {
|
||||||
else {
|
parser_debug(" Unknown attribute\n");
|
||||||
ret = B_ERROR;
|
ret = B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,15 +454,13 @@ PkgDirectory::_ParseData(uint8 *buffer, BFile *file, uint64 originalSize,
|
|||||||
|
|
||||||
if (original != originalSize) {
|
if (original != originalSize) {
|
||||||
parser_debug(" File size mismatch\n");
|
parser_debug(" File size mismatch\n");
|
||||||
ret = B_ERROR; // File size mismatch
|
return B_ERROR; // File size mismatch
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
parser_debug(" Still good...\n");
|
parser_debug(" Still good...\n");
|
||||||
|
|
||||||
if (fPackage->Read(buffer, 4) != 4) {
|
if (fPackage->Read(buffer, 4) != 4) {
|
||||||
parser_debug(" Read(buffer, 4) failed\n");
|
parser_debug(" Read(buffer, 4) failed\n");
|
||||||
ret = B_ERROR;
|
return B_ERROR;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
parser_debug(" Still good...\n");
|
parser_debug(" Still good...\n");
|
||||||
|
|
||||||
@@ -469,6 +476,7 @@ PkgDirectory::_ParseData(uint8 *buffer, BFile *file, uint64 originalSize,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
parser_debug("_ParseData unknown tag\n");
|
||||||
ret = B_ERROR;
|
ret = B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,18 +539,17 @@ PkgFile::WriteToPath(const char *path, BPath *final)
|
|||||||
ret = file.SetTo(destination.Path(), B_WRITE_ONLY | B_CREATE_FILE);
|
ret = file.SetTo(destination.Path(), B_WRITE_ONLY | B_CREATE_FILE);
|
||||||
if (ret != B_OK)
|
if (ret != B_OK)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
} else if (ret != B_OK)
|
||||||
else if (ret != B_OK)
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
parser_debug(" File created!\n");
|
parser_debug(" File created!\n");
|
||||||
|
|
||||||
// Set the file permissions, creation and modification times
|
// Set the file permissions, creation and modification times
|
||||||
ret = file.SetPermissions(static_cast<mode_t>(fMode));
|
ret = file.SetPermissions(static_cast<mode_t>(fMode));
|
||||||
if (fCreationTime)
|
if (fCreationTime && ret == B_OK)
|
||||||
ret |= file.SetCreationTime(static_cast<time_t>(fCreationTime));
|
ret = file.SetCreationTime(static_cast<time_t>(fCreationTime));
|
||||||
if (fModificationTime)
|
if (fModificationTime && ret == B_OK)
|
||||||
ret |= file.SetModificationTime(static_cast<time_t>(fModificationTime));
|
ret = file.SetModificationTime(static_cast<time_t>(fModificationTime));
|
||||||
|
|
||||||
if (ret != B_OK)
|
if (ret != B_OK)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -675,7 +682,7 @@ PkgLink::WriteToPath(const char *path, BPath *final)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BSymLink symlink;
|
BSymLink symlink;
|
||||||
ret = dir.CreateSymLink(linkName.String(), fLink.String(), &symlink);
|
ret = dir.CreateSymLink(destination.Path(), fLink.String(), &symlink);
|
||||||
if (ret != B_OK) {
|
if (ret != B_OK) {
|
||||||
parser_debug("CreateSymLink failed\n");
|
parser_debug("CreateSymLink failed\n");
|
||||||
return ret;
|
return ret;
|
||||||
@@ -685,18 +692,20 @@ PkgLink::WriteToPath(const char *path, BPath *final)
|
|||||||
|
|
||||||
ret = symlink.SetPermissions(static_cast<mode_t>(fMode));
|
ret = symlink.SetPermissions(static_cast<mode_t>(fMode));
|
||||||
|
|
||||||
if (fCreationTime)
|
if (fCreationTime && ret == B_OK)
|
||||||
ret |= symlink.SetCreationTime(static_cast<time_t>(fCreationTime));
|
ret = symlink.SetCreationTime(static_cast<time_t>(fCreationTime));
|
||||||
|
|
||||||
if (fModificationTime)
|
if (fModificationTime && ret == B_OK)
|
||||||
ret |= symlink.SetModificationTime(static_cast<time_t>(fModificationTime));
|
ret = symlink.SetModificationTime(static_cast<time_t>(fModificationTime));
|
||||||
|
|
||||||
if (ret != B_OK)
|
if (ret != B_OK) {
|
||||||
|
parser_debug("Failed to set symlink attributes\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (fOffset) {
|
if (fOffset) {
|
||||||
// Simlinks also seem to have attributes - so parse them
|
// Symlinks also seem to have attributes - so parse them
|
||||||
ret = _HandleAttributes(&destination, &dir, "LnDa");
|
ret = _HandleAttributes(&destination, &symlink, "LnDa");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (final) {
|
if (final) {
|
||||||
|
|||||||
Reference in New Issue
Block a user