Skip to content

Improve desktop file handling - #10

Merged
deepin-bot[bot] merged 4 commits into
linuxdeepin:masterfrom
black-desk:black-desk/fix/desktopfile
Apr 3, 2023
Merged

deepin-bot[bot] merged 4 commits into
linuxdeepin:masterfrom
black-desk:black-desk/fix/desktopfile

Conversation

@black-desk

@black-desk black-desk commented Mar 7, 2023 •

Copy link
Copy Markdown
Contributor

KeyFile::saveToFile not guaranteed section order, which is not the right
behavior of desktop file. XDG requires the first section of desktop file
always to be "Desktop Entry".

So I write a new DesktopFile class, which override the saveToFile method
of KeyFile, to make it work.

close linuxdeepin/developer-center#3807

@black-desk
black-desk force-pushed the black-desk/fix/desktopfile branch from b50e4ca to e89809a Compare March 7, 2023 02:59
@black-desk

Copy link
Copy Markdown
Contributor Author

@black-desk
black-desk force-pushed the black-desk/fix/desktopfile branch 4 times, most recently from c8f5989 to d2c11a9 Compare March 7, 2023 06:51
@black-desk

Copy link
Copy Markdown
Contributor Author

@black-desk

Copy link
Copy Markdown
Contributor Author

The old exec parsing behavior is completely wrong, I rewrite them.

@BLumia BLumia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtkcore 本身应该就带了一个 DDesktopEntry,那个不能满足要求的吗

@black-desk

Copy link
Copy Markdown
Contributor Author

dtkcore 本身应该就带了一个 DDesktopEntry,那个不能满足要求的吗

没看过 不过这里并不是entry的问题

是那个entry取出来以后要怎么解析成要跑的命令的问题

@black-desk

Copy link
Copy Markdown
Contributor Author

dtkcore 本身应该就带了一个 DDesktopEntry,那个不能满足要求的吗

没看过 不过这里并不是entry的问题

是那个entry取出来以后要怎么解析成要跑的命令的问题

可以考虑把整个这个类都换成dtk里的entry 但是这个项目是不是计划中要重做来着

@BLumia

BLumia commented Mar 14, 2023 •

Copy link
Copy Markdown
Member

但是这个项目是不是计划中要重做来着

发首个正式版之前来得及大修吗(x

感觉如果真能按之前的讨论做大幅度调整的话,大概是 side by side 做两个不同的共存,然后逐步砍掉目前的实现吧。

@black-desk

Copy link
Copy Markdown
Contributor Author

但是这个项目是不是计划中要重做来着

发首个正式版之前来得及大修吗(x

感觉如果真能按之前的讨论做大幅度调整的话,大概是 side by side 做两个不同的共存,然后逐步砍掉目前的实现吧。

但是正式版发了接口是不是就不能动了(x

@black-desk

Copy link
Copy Markdown
Contributor Author

@BLumia @zccrs beta发布的时候还修不修这些am启动应用的问题 如果这些东西在考虑范围内的话am的改动还挺多的.

@zccrs

zccrs commented Mar 30, 2023

Copy link
Copy Markdown
Member

但是这个项目是不是计划中要重做来着

发首个正式版之前来得及大修吗(x
感觉如果真能按之前的讨论做大幅度调整的话,大概是 side by side 做两个不同的共存,然后逐步砍掉目前的实现吧。

但是正式版发了接口是不是就不能动了(x

在社区版上可以动,把这个项目标记为技术预览版本,不作为正式版推出。

@zccrs

zccrs commented Mar 30, 2023

Copy link
Copy Markdown
Member

看具体的问题影响大小和需要改动的范围以及修复难度

@zccrs

zccrs commented Mar 30, 2023

Copy link
Copy Markdown
Member

看具体的问题影响大小和需要改动的范围以及修复难度

我的建议是先用比较小的改动解决一部分严重的问题。现阶段就开始重写它,但是不在Beta中集成重新的版本,Release版本中集成。

@black-desk
black-desk force-pushed the black-desk/fix/desktopfile branch 2 times, most recently from c9b5a96 to 4a734b4 Compare March 30, 2023 07:48
@black-desk
black-desk marked this pull request as ready for review March 30, 2023 07:49
@black-desk
black-desk requested a review from zccrs March 30, 2023 07:49
@zccrs

zccrs commented Mar 30, 2023

Copy link
Copy Markdown
Member

dtkcore 本身应该就带了一个 DDesktopEntry,那个不能满足要求的吗

等重构的时候再考虑用DTK

Comment thread src/lib/desktopfile.cpp Resolved
Comment thread src/lib/desktopfile.h Resolved
Comment thread src/lib/keyfile.cpp Resolved
@black-desk
black-desk force-pushed the black-desk/fix/desktopfile branch from 4a734b4 to 6bce070 Compare March 30, 2023 07:58
KeyFile::saveToFile not guaranteed section order, which is not the right
behavior of desktop file. XDG requires the first section of desktop file
always to be "Desktop Entry".

So I write a new DesktopFile class, which override the saveToFile method
of KeyFile, to make it work.

close linuxdeepin/developer-center#3807

Signed-off-by: black-desk <[email protected]>
@black-desk
black-desk force-pushed the black-desk/fix/desktopfile branch from 6bce070 to 3811f3c Compare March 30, 2023 09:56
@black-desk

Copy link
Copy Markdown
Contributor Author

/merge

@deepin-bot
deepin-bot Bot merged commit b912390 into linuxdeepin:master Apr 3, 2023
felixonmars added a commit to felixonmars/dde-application-manager that referenced this pull request Sep 16, 2023
Calling line.front() on an empty line is forbidden and crashes the
process. Adding checks after erasing spaces from the line.

```
(gdb) bt
 #0  0x00007ffff568e83c in  () at /usr/lib/libc.so.6
 linuxdeepin#1  0x00007ffff563e668 in raise () at /usr/lib/libc.so.6
 linuxdeepin#2  0x00007ffff56264b8 in abort () at /usr/lib/libc.so.6
 linuxdeepin#3  0x00007ffff5add3b2 in std::__glibcxx_assert_fail(char const*, int, char const*, char const*)
     (file=file@entry=0x7ffff5bd7858 "/usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h", line=line@entry=1305, function=function@entry=0x7ffff5bd79d0 "std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::front() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocat"..., condition=condition@entry=0x7ffff5bd3f6e "!empty()") at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/debug.cc:61
 linuxdeepin#4  0x00007ffff5b5a124 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::front() (this=<optimized out>) at /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:1305
 linuxdeepin#5  0x00005555555dc011 in KeyFile::loadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
 linuxdeepin#6  0x00005555555cd504 in DesktopInfo::DesktopInfo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
 linuxdeepin#7  0x000055555565b64e in StartManager::getAutostartList()::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)linuxdeepin#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const ()
 linuxdeepin#8  0x000055555565ba51 in StartManager::getAutostartList() ()
 linuxdeepin#9  0x0000555555654dd4 in StartManager::StartManager(QObject*) ()
 linuxdeepin#10 0x000055555566d5c0 in ApplicationManagerPrivate::ApplicationManagerPrivate(ApplicationManager*) ()
 linuxdeepin#11 0x000055555566ec8e in ApplicationManager::ApplicationManager(QObject*) ()
 linuxdeepin#12 0x000055555566eba5 in ApplicationManager::instance() ()
 linuxdeepin#13 0x00005555556769ce in main ()
```
black-desk pushed a commit that referenced this pull request Sep 17, 2023
Calling line.front() on an empty line is forbidden and crashes the
process. Adding checks after erasing spaces from the line.

```
(gdb) bt
 #0  0x00007ffff568e83c in  () at /usr/lib/libc.so.6
 #1  0x00007ffff563e668 in raise () at /usr/lib/libc.so.6
 #2  0x00007ffff56264b8 in abort () at /usr/lib/libc.so.6
 #3  0x00007ffff5add3b2 in std::__glibcxx_assert_fail(char const*, int, char const*, char const*)
     (file=file@entry=0x7ffff5bd7858 "/usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h", line=line@entry=1305, function=function@entry=0x7ffff5bd79d0 "std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::front() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocat"..., condition=condition@entry=0x7ffff5bd3f6e "!empty()") at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/debug.cc:61
 #4  0x00007ffff5b5a124 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::front() (this=<optimized out>) at /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:1305
 #5  0x00005555555dc011 in KeyFile::loadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
 #6  0x00005555555cd504 in DesktopInfo::DesktopInfo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
 #7  0x000055555565b64e in StartManager::getAutostartList()::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const ()
 #8  0x000055555565ba51 in StartManager::getAutostartList() ()
 #9  0x0000555555654dd4 in StartManager::StartManager(QObject*) ()
 #10 0x000055555566d5c0 in ApplicationManagerPrivate::ApplicationManagerPrivate(ApplicationManager*) ()
 #11 0x000055555566ec8e in ApplicationManager::ApplicationManager(QObject*) ()
 #12 0x000055555566eba5 in ApplicationManager::instance() ()
 #13 0x00005555556769ce in main ()
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants