-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make maximum clipboard buffer lenght configurable #150
base: main
Are you sure you want to change the base?
Conversation
5e17fb1
to
b0cb18f
Compare
98a0c57
to
3b1dedd
Compare
3b1dedd
to
0265918
Compare
0265918
to
3a15fee
Compare
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2024102322-4.3&flavor=pull-requests Test run included the following:
New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2024091704-4.3&flavor=update
Failed tests20 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/112766#dependencies 200 fixed
Unstable tests
|
PipelineRetry |
PipelineRetryFailed |
PipelineRetryFailed |
PipelineRetry |
Pasting doesn't work:
But that's probably because copying failed:
|
Ok, the message on copy is not really a failure - the first one is expected to not have this file. Can you suppress the error message in this case? |
The metadata format needs to be documented somewhere. It has many more values than the old one, but also the parser is quite limited and can't understand full JSON - the limitations need to be described somewhere (expected line breaks, one value per line etc) |
Exactly. I thought about it as well. Most use cases would be reading the metadata rather than writing to it. I wanted to avoid dependency on any external JSON parsing library for C language to support full JSON. In the end, all of xside.c should be replaced by Demi's rewrite of GUI daemons in Rust? There is a mention of clipboard files in qubes-doc. But they are for end-user. I still believe that it might be a good place to document the metadata format. |
Yes. I guess instead of an error message, p.s.: I will use |
TBH, I'm not a fan of mixing content of the loaded file with info about loading process itself. And also, the missing file needs special treatment anyway (compared to other errors on opening the file like permission denied) - missing file is okay on copy, and also kinda expected on some paste (if user didn't copied anything before). But for example permission error or io error are not okay (they should not be treated same as missing file). So, maybe in case of missing file report it via a return value from the function (making it more than a bool) and log message about it only in the paste path? But for other errors log errors directly from the loading function. Or, add a parameter whether missing file message should be logged? |
One day maybe, but not anytime soon. Anyway, it's okay to support just subset of JSON (as you said - it's mostly xside who write the file, but there are few where others write it too - for example copying dom0 clipboard via the clipboard widget). But it needs to be documented what that subset is. |
I just realized that fgets includes |
The previous code reported non-existent I am doing some improvements and will send push them soon. |
@marmarek metadata parsing fixes and improvement are pushed in the new commit to this PR (hopefully it would make the review easier).
I will do this as well. But maybe it would better to finalize this PR and then do that? |
p.s. It appears that it still has some issues. I am working on it |
Found the error. In key, value parsing formatting string, I did not include underline as a valid character for key. p.s. And it turns out that underline and hyphen should be allowed for vmname too |
I am adding a special case if user tries to press ctrl+shift+c in a qube where the clipboard is empty. This can be handled with the new metadata (copy_action=true, successful=true, cleared=true, sent_size=0) |
c853445
to
83b6395
Compare
I made another small adjustment. If |
Better parsing and error handling for `/run/qubes/qubes-clipboard.bin.metadata`
83b6395
to
e1e6026
Compare
|
||
file = fopen(QUBES_CLIPBOARD_FILENAME ".metadata", "r"); | ||
if (!file) { | ||
if (logging) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors other than ENOENT should result in a logged message even on copy operation. Similar comment applies to other messages below messages below. Generally, expected situation should not be reported as an error but others should get logged, and expected case is either fie exists and is correctly parsed, or file doesn't exist yet on the first copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors other than ENOENT should result in a logged message even on copy operation. Similar comment applies to other messages below messages below. Generally, expected situation should not be reported as an error but others should get logged, and expected case is either fie exists and is correctly parsed, or file doesn't exist yet on the first copy.
I am having problem to properly understand this.
When you advise: Errors other than ENOENT should result in a logged message even on copy operation
,
does it mean always log or only if debug mode or verbose mode is enabled?
1st part of fix. Making the clipboard buffer size configurable via
max_clipboard_size
setting withinguid.conf
fixes: QubesOS/qubes-issues#9296