Skip to content

Conversation

ukanga
Copy link
Contributor

@ukanga ukanga commented Aug 2, 2025

Fixes #430

@ygerlach
Copy link
Contributor

ygerlach commented Aug 2, 2025

This change is probably fine, but it introduces a time-of-check-time-of-use bug.

My suggestion would be to replace file_read in read_info_file with something like this:

try{
	GLib.FileUtils.get_contents(file_path, out dist_file_cont);
}
catch (Error e) {
	return null;
}

This should remove all logging, but avoid the time-of-check-time-of-use problem.

@mtwebster
Copy link
Member

What version are you using? Is this necessary since 76bd8ee?

@ukanga
Copy link
Contributor Author

ukanga commented Aug 2, 2025

This change is probably fine, but it introduces a time-of-check-time-of-use bug.

My suggestion would be to replace file_read in read_info_file with something like this:

try{
	GLib.FileUtils.get_contents(file_path, out dist_file_cont);
}
catch (Error e) {
	return null;
}

This should remove all logging, but avoid the time-of-check-time-of-use problem.

Yes, let's not introduce bugs. Let me make the change shortly.

@ukanga ukanga force-pushed the fix-issue-430-noisy-file-not-found branch 2 times, most recently from 79042b3 to 330f25d Compare August 2, 2025 19:50
Do not introduce a Time-of-Check to Time-of-Use (TOCTOU) bug.
@ukanga
Copy link
Contributor Author

ukanga commented Aug 2, 2025

What version are you using? Is this necessary since 76bd8ee?

I on Arch Linux using extra/timeshift 25.07.4-1.

I would expect it to still be the case since the function is still present and other functions still call it.

@Anagastes
Copy link

Just a quick note: Under EndeavourOS, it is now a symlink. And a different name. So I have the same error. :)

ls -halFs /etc/*-release 
4,0K lrwxrwxrwx 1 root root 21 16. Aug 2022  /etc/os-release -> ../usr/lib/os-release

@ygerlach
Copy link
Contributor

ygerlach commented Aug 3, 2025

Just a quick note: Under EndeavourOS, it is now a symlink. And a different name. So I have the same error. :)

What different name? timeshift checks /etc/os-release or /etc/lsb-release what ever is present. And it should follow symlinks. Maybe you get an error, because one of the two files where missing, but it still works?

But having the info that some distros put the files at a different folder is good. I guess timeshift should check /usr/lib/os-release at some point too.

@Anagastes
Copy link

Just a quick note: Under EndeavourOS, it is now a symlink. And a different name. So I have the same error. :)

What different name? timeshift checks /etc/os-release or /etc/lsb-release what ever is present. And it should follow symlinks. Maybe you get an error, because one of the two files where missing, but it still works?

But having the info that some distros put the files at a different folder is good. I guess timeshift should check /usr/lib/os-release at some point too.

Sorry, bad wording.. I mean primary the symlink to /usr/lib/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

On Arch Linux timeshift get's noisy when it does not find /etc/lsb_release
4 participants