WIP: quotes-fix #344

Draft
Matou1306 wants to merge 4 commits from Matou1306/kolibrios:quotes-fix into main
First-time contributor

Fixes #336:

Created a new asm template "quotkinizer" that takes a path and wraps it in quotes.
This file sits in programs (so that specific wrapper binaries could be created for any program where needed), for dgen specifically: I made dgen_open.asm which includes the quotkinizer template ... This dgen_open is now the main binary linked in assoc.ini to open .md and .gen files. All what dgen_open does is execute dgen but with quotes over the path

I tested it locally with a dummy .md file (with spaces all over the path) and verified that it didn't show the path truncation error. (However, it's stuck on dgen logo, I don't know if that's because it's a dummy file or what... but even before implementing the fix it was also getting stuck at the logo)
But the main error that I was getting: "Unable to load "/tmp0/1/New" stopped appearing when opening "/tmp0/1/New folder/New file.md"

Fixes #336: Created a new asm template "quotkinizer" that takes a path and wraps it in quotes. This file sits in programs (so that specific wrapper binaries could be created for any program where needed), for dgen specifically: I made dgen_open.asm which includes the quotkinizer template ... This dgen_open is now the main binary linked in assoc.ini to open .md and .gen files. All what dgen_open does is execute dgen but with quotes over the path I tested it locally with a dummy .md file (with spaces all over the path) and verified that it didn't show the path truncation error. (However, it's stuck on dgen logo, I don't know if that's because it's a dummy file or what... but even before implementing the fix it was also getting stuck at the logo) But the main error that I was getting: "Unable to load "/tmp0/1/New" stopped appearing when opening "/tmp0/1/New folder/New file.md"
Matou1306 added 11 commits 2026-02-24 11:34:58 +00:00
Matou1306 force-pushed quotes-fix from 6dd27a94f6 to c8efe352dc 2026-02-24 12:06:12 +00:00 Compare
Matou1306 force-pushed quotes-fix from c8efe352dc to e7d1a0b5db 2026-02-27 16:05:43 +00:00 Compare
Owner

I already wrote about what can be done. This solution, in my opinion, is bad.

I already wrote about what can be done. This solution, in my opinion, is bad.
Author
First-time contributor

@mxlgv Just to make sure we're on the same page, I realized the PR description was outdated (just updated it).

I completely removed the global macro and the @open changes. The current code only modifies dgen/main.c to handle arguments locally.

If you already reviewed this latest committed code and still see issues, could you please give more specific details on what's wrong?

@mxlgv Just to make sure we're on the same page, I realized the PR description was outdated (just updated it). I completely removed the global macro and the @open changes. The current code only modifies dgen/main.c to handle arguments locally. If you already reviewed this latest committed code and still see issues, could you please give more specific details on what's wrong?
Owner

@Matou1306 #336 (comment) here I wrote that you can make a launcher specifically for working with files. The launcher is a simple fasm program that adds quotes to the path and launches the program. Thus, changes to the port are not necessary.

@Matou1306 https://git.kolibrios.org/KolibriOS/kolibrios/issues/336#issuecomment-4405 here I wrote that you can make a launcher specifically for working with files. The launcher is a simple fasm program that adds quotes to the path and launches the program. Thus, changes to the port are not necessary.
Author
First-time contributor

@mxlgv Oh my bad!! I just realized I totally missed this comment from last week! I had the page open so it didn't send me a notification.
I really appreciate your apology from that message, and sorry for the confusion I caused by missing this for a whole week while you had already pointed out the preferred path.

Thanks for referencing it, I will discard the past changes and start working on your approach then push the edits asap

@mxlgv Oh my bad!! I just realized I totally missed this comment from last week! I had the page open so it didn't send me a notification. I really appreciate your apology from that message, and sorry for the confusion I caused by missing this for a whole week while you had already pointed out the preferred path. Thanks for referencing it, I will discard the past changes and start working on your approach then push the edits asap
mxlgv changed title from quotes-fix to WIP: quotes-fix 2026-03-02 18:30:28 +00:00
mxlgv added the Category/ApplicationsFASM
Kind
Bug
Priority
Low
labels 2026-03-02 18:31:06 +00:00
Owner

@Matou1306 Thank you for showing such interest in the project)

@Matou1306 Thank you for showing such interest in the project)
Matou1306 force-pushed quotes-fix from e7d1a0b5db to d8d4759097 2026-03-03 18:25:09 +00:00 Compare
Author
First-time contributor

@mxlgv I implemented your suggested FASM wrapper and pushed the latest version. Please take a look and tell me your thoughts

(Note: I tested it with a dummy file with spaces in the path. The path truncation error is completely gone. It hangs on the DGen logo though but it did that before the fix too (since it's not a valid file I guess)).

Waiting for your comments and review.

@mxlgv I implemented your suggested FASM wrapper and pushed the latest version. Please take a look and tell me your thoughts (Note: I tested it with a dummy file with spaces in the path. The path truncation error is completely gone. It hangs on the DGen logo though but it did that before the fix too (since it's not a valid file I guess)). Waiting for your comments and review.
mxlgv requested changes 2026-03-04 16:34:27 +00:00
mxlgv left a comment
Owner

You took writing the template too literally, I suggest giving up inc and making a program in a separate folder.

I suggest that it be universal. To have the program automatically launch a file in its folder with the same name without open: for example /kolibrios/blabalbal/dgen_open will launch /kolibrios/blablabal/dgen.

You took writing the template too literally, I suggest giving up inc and making a program in a separate folder. I suggest that it be universal. To have the program automatically launch a file in its folder with the same name without `open`: for example `/kolibrios/blabalbal/dgen_open` will launch `/kolibrios/blablabal/dgen`.
@@ -0,0 +3,4 @@
format binary as ""
TARGET equ '/kolibrios/emul/dgen/dgen'
Owner

It's a bad decision to hardcode the file path

It's a bad decision to hardcode the file path
@@ -0,0 +21,4 @@
mov edi, new_params
mov byte [edi], '"'
inc edi
Owner

Why are you copying the path? It is better to hardcode the quote before the path and add the last quote to the end of the line.

Why are you copying the path? It is better to hardcode the quote before the path and add the last quote to the end of the line.
Matou1306 marked this conversation as resolved
@@ -0,0 +37,4 @@
mov dword [fi + 8], new_params
.launch:
mov eax, 70
Owner

Use constants from KOSfunc.inc.

Use constants from KOSfunc.inc.
Matou1306 marked this conversation as resolved
Owner

@Matou1306
What's the bug in DGEN? Which specific file is not valid. Does DGEN run a file with quotes via SHELL for example?

@Matou1306 What's the bug in DGEN? Which specific file is not valid. Does DGEN run a file with quotes via SHELL for example?
Author
First-time contributor

@mxlgv Sorry for the delay, I had university exams today.

Regarding your question: initially, no, I didn't try it via SHELL. I just double-clicked the file from Eolite and got DGen opening but stuck on the logo. The file I used is a dummy file (just an empty/random char filled New file.md). I don't actually know of a valid file/ROM that works on DGen to test this properly (help finding one to test would be appreciated).
I just tried using SHELL per your suggestion. After some trial and error, the final result I got was: 'dgen' started. PID = 31, but no actual window opened.

And regarding your requested changes:
-Do you mean something like ../../? Or by universal you mean something even more general like dynamically reading the file's own executable path? Like for dgen it should read /kolibrios/emul/dgen_open, chop off _open and launch /kolibrios/emul/dgen ?
-My original intention was to avoid memory access violations in case the path didn't have a free byte in the beginning, but yeah I realized it would already be O(n) time to reach the null terminator, so maybe just shifting it while parsing would be a better solution by avoiding O(n) space too?
-Regarding KOSfunc.inc, noted.

I will start working on these updates and push them asap

@mxlgv Sorry for the delay, I had university exams today. Regarding your question: initially, no, I didn't try it via SHELL. I just double-clicked the file from Eolite and got DGen opening but stuck on the logo. The file I used is a dummy file (just an empty/random char filled New file.md). I don't actually know of a valid file/ROM that works on DGen to test this properly (help finding one to test would be appreciated). I just tried using SHELL per your suggestion. After some trial and error, the final result I got was: 'dgen' started. PID = 31, but no actual window opened. And regarding your requested changes: -Do you mean something like ../../? Or by universal you mean something even more general like dynamically reading the file's own executable path? Like for dgen it should read `/kolibrios/emul/dgen_open`, chop off _open and launch `/kolibrios/emul/dgen` ? -My original intention was to avoid memory access violations in case the path didn't have a free byte in the beginning, but yeah I realized it would already be O(n) time to reach the null terminator, so maybe just shifting it while parsing would be a better solution by avoiding O(n) space too? -Regarding KOSfunc.inc, noted. I will start working on these updates and push them asap
Matou1306 added 1 commit 2026-03-07 12:15:23 +00:00
requested changes
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 52s
Build system / Build (pull_request) Successful in 17m51s
2c20243949
Matou1306 added 1 commit 2026-03-07 12:22:04 +00:00
use SSF_START_APP instead of hardcoded subfunction number 7
Some checks failed
Build system / Build (pull_request) Failing after 2s
Build system / Check kernel codestyle (pull_request) Successful in 28s
0b422c07ac
Author
First-time contributor

Hey @mxlgv, I just pushed your requested changes. Please take a look and let me know if there is anything else.

The only thing remaining is the relative path change you requested. I am not totally sure I understand your plan correctly on this one, so I am waiting for your answer to my previous question before making this specific change.

Hey @mxlgv, I just pushed your requested changes. Please take a look and let me know if there is anything else. The only thing remaining is the relative path change you requested. I am not totally sure I understand your plan correctly on this one, so I am waiting for your answer to my previous question before making this specific change.
Owner

@Matou1306 Hi!
Yes:

Or by universal you mean something even more general like dynamically reading the file's own executable path? Like for dgen it should read /kolibrios/emul/dgen_open, chop off _open and launch /kolibrios/emul/dgen

Regarding the quote.
If I'm not mistaken, then according to the documentation, the argument cannot be larger than 256 bytes (including '\0'). I suggest using this size for now.

* Command line must be terminated by the character with the code 0

What was approximately expected:

A separate program #344 (comment) that works approximately on this principle:

q_path:  ; You can also not use a label but write path+1 in the MENUET header
       rb 1
path:
       rb 256+1 ; + 1 for end quote

and

mov al,'"'
mov [q_path], al 

and

path[strlen(path)] = '"';

and RUN.

@Matou1306 Hi! Yes: > Or by universal you mean something even more general like dynamically reading the file's own executable path? Like for dgen it should read /kolibrios/emul/dgen_open, chop off _open and launch /kolibrios/emul/dgen Regarding the quote. If I'm not mistaken, then according to the documentation, the argument cannot be larger than 256 bytes (including '\0'). I suggest using this size for now. https://git.kolibrios.org/KolibriOS/kolibrios/src/commit/6f2a947deb6add78781762d3d8cbad7bf1ef0e3d/kernel/trunk/docs/sysfuncs.txt#L4348 What was approximately expected: A separate program https://git.kolibrios.org/KolibriOS/kolibrios/pulls/344#issuecomment-4582 that works approximately on this principle: ```asm q_path: ; You can also not use a label but write path+1 in the MENUET header rb 1 path: rb 256+1 ; + 1 for end quote ``` and ```asm mov al,'"' mov [q_path], al ``` and ```c path[strlen(path)] = '"'; ``` and RUN.
Matou1306 added 1 commit 2026-03-08 16:15:54 +00:00
requested changes (all)
Some checks failed
Build system / Check kernel codestyle (pull_request) Successful in 24s
Build system / Build (pull_request) Failing after 17m3s
a259518124
Author
First-time contributor

@mxlgv Hello,
Thanks for the review. I implemented your requested changes, please take a look and tell me what else I can improve.

@mxlgv Hello, Thanks for the review. I implemented your requested changes, please take a look and tell me what else I can improve.
Some checks failed
Build system / Check kernel codestyle (pull_request) Successful in 24s
Required
Details
Build system / Build (pull_request) Failing after 17m3s
Required
Details
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u quotes-fix:Matou1306-quotes-fix
git checkout Matou1306-quotes-fix
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KolibriOS/kolibrios#344