Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
deepin-diskmanager (1.3.31) stable; urgency=medium

* fix: mount as root
* fix: UI error

-- re2zero <yangwu@uniontech.com> Tue, 26 Dec 2023 16:36:26 +0800

deepin-diskmanager (1.3.30) stable; urgency=medium

* fix: 修复“ZHITAI PC005”型号名未识别的相关问题
Expand Down
11 changes: 7 additions & 4 deletions service/diskoperation/partedcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3723,7 +3723,7 @@ bool PartedCore::checkRepairFileSystem(const Partition &partition)
}

/***********************************************private 挂载*****************************************************************/
bool PartedCore::mountDevice(const QString &mountpath, const QString devPath, const FSType &fsType)
bool PartedCore::mountDevice(const QString &mountpath, const QString devPath, const FSType &fsType, const QString userName)
{
qDebug() << __FUNCTION__ << "Mount start";
if (mountpath.isEmpty() || devPath.isEmpty() || fsType == FSType::FS_UNKNOWN) {
Expand All @@ -3735,7 +3735,9 @@ bool PartedCore::mountDevice(const QString &mountpath, const QString devPath, co
QString cmd ;
//vfat 1051系统上vfat格式不指定utf8挂载 通过文件管理器右键菜单新建文件夹会乱码 导致创建错误 为了规避该问题加上utf8属性
if (fsType == FSType::FS_FAT32 || fsType == FSType::FS_FAT16) {
cmd = QString("mount %1 %2 -o dmask=000,fmask=111,utf8").arg(devPath).arg(mountpath);
cmd = QString("mount %1 %2 -o dmask=000,fmask=111,utf8,uid=%3,gid=%4").arg(devPath).arg(mountpath).arg(userName).arg(userName);
} else if (fsType == FSType::FS_EXFAT || fsType == FSType::FS_NTFS) {
cmd = QString("mount %1 %2 -o uid=%3,gid=%4").arg(devPath).arg(mountpath).arg(userName).arg(userName);
} else if (fsType == FSType::FS_HFS) {
cmd = QString("mount %1 %2 -o dir_umask=000,file_umask=111").arg(devPath).arg(mountpath);
} else {
Expand Down Expand Up @@ -3870,7 +3872,7 @@ QPair<bool, QString> PartedCore::tmpMountDevice(const QString &mountpath, const
}

//挂载
if (!mountDevice(mountpath, devPath, fsType)) {
if (!mountDevice(mountpath, devPath, fsType, userName)) {
QString str = QString("%1:%2:%3").arg("DISK_ERROR").arg(DISK_ERROR::DISK_ERR_MOUNT_FAILED).arg(devPath);
return QPair<bool, QString>(false, str);
}
Expand Down Expand Up @@ -3926,7 +3928,8 @@ bool PartedCore::changeOwner(const QString &user, const QString &path)
if (psInfo == nullptr) {
return false;
}
//todo 暂时先不判断返回值 此处在fat ntfs文件系统有问题

//chown对fat ntfs exfat文件系统无效 -> mount使用uid=xx,gid=xx解决
chown(path.toStdString().c_str(), psInfo->pw_uid, psInfo->pw_gid);
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion service/diskoperation/partedcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,10 @@ class PartedCore : public QObject
* @param mountpath:挂载点
* @param devPath:设备路径
* @param fsType:文件系统类型
* @param userName:挂载所属用户
* @return true 挂载成功 false 挂载失败
*/
bool mountDevice(const QString &mountpath, const QString devPath, const FSType &fsType);
bool mountDevice(const QString &mountpath, const QString devPath, const FSType &fsType, const QString userName = "");

/**
* @brief 卸载设备
Expand Down