Skip to content

Conversation

@akleshchev
Copy link
Contributor

Draft, applying 'Add more functionality to LLFile and cleanup LLAPRFile' on top of a develop-linux branch to see how it goes.

# Conflicts:
#	indra/llcrashlogger/llcrashlock.cpp
#	indra/llrender/llshadermgr.cpp
#	indra/test/CMakeLists.txt
@akleshchev
Copy link
Contributor Author

akleshchev commented Dec 16, 2025

@RyeMutt are you fine with adding this to linux branch?

Seems like the only issue is 'out of memory' for mac builds which does not look to be specific to this change.

@RyeMutt
Copy link
Contributor

RyeMutt commented Dec 16, 2025

I'm currently working on a changeset to resolve the out of memory/diskspace issue on the macos runner by splitting the test and viewer builds into seperate jobs. I'd like to get that in first and have a few days to put this branch through a good round of regression testing before it gets merged into linux.

@akleshchev
Copy link
Contributor Author

I'd like to get that in first and have a few days to put this branch through a good round of regression testing before it gets merged into linux.

File operations are mostly covered by unit tests, like llcontrol test - creates a settings file, writes, reads. If you think something isn't properly covered yet should be checked, perhaps you can suggest a unit test to implement?

@akleshchev
Copy link
Contributor Author

Thanks, adding those changes.

@RyeMutt
Copy link
Contributor

RyeMutt commented Dec 17, 2025

It looks like this is potentially caused by LLFileSystem::getFileSize now wrapping LLFile::size which can return -1 where as the previous version a failure would return 0.

@akleshchev
Copy link
Contributor Author

akleshchev commented Dec 17, 2025

hich can return -1 where as the previous version a failure would return 0.

Yes, it's probably better to return 0 (it returns ec either way) instead of looking for everything that expects non zero value.

Lots of places do !vf.getSize()

@fmartian
Copy link
Contributor

hich can return -1 where as the previous version a failure would return 0.

Yes, it's probably better to return 0 (it returns ec either way) instead of looking for everything that expects non zero value.

Lots of places do !vf.getSize()

The idea was to fix the callers of LLFile::size() and I think I got them almost all but seems one or two escaped (or might be caused by Linux specific changes, the patch was developed against the development branch). For LLFileSystem::getSize() I think it is easiest for now to limit the returned value to 0 although the checks should be probably rather changed to "vf.getSize() > 0" for a more generic fix since that function is defined to return a signed value.

I do have more thorough changes that will avoid some of these problems (and completely do away with LLAPRFile) but it got somewhat hard to manage with the new Linux compatibility requirement too.

@akleshchev
Copy link
Contributor Author

akleshchev commented Dec 17, 2025

Switched size functions to return 0. Double-checked logs and I see nothing suspicious.

The idea was to fix the callers of LLFile::size()

I don't think it adds much value. If someone needs to check the error state, they can check ec variant.

but it got somewhat hard to manage with the new Linux compatibility requirement too.

Sorry for adding more work, at the moment it might be wise to wait a bit with that.

@fmartian
Copy link
Contributor

fmartian commented Dec 17, 2025

Switched size functions to return 0.

The idea was to fix the callers of LLFile::size()

I don't think it adds much value. If someone needs to check the error state, they can check ec variant.

The problem is not in the places that call LLFile::size(). It's called only a handful times throughout so far and except in LLFileSystem the caller is actually properly checking for the value to be positive to determine if the file is valid.
The problem is with LLFileSystem::getSize() which is called all over the place without checking the return value. Most times the code just happens to not crash by chance while it does repeatedly do an allocation for 0 bytes/elements. That's not really safe.

#5172 is an attempt to fix this although testing has been limited.

A quick and dirty fix would be to limit the return value of LLFileSystem::getSize(). However that does only mask the real problem. There is more opportunity to clean/optimize things in several of those places, but I tried to make it not to big.

@akleshchev akleshchev requested a review from RyeMutt December 18, 2025 15:02
@Hecklezz
Copy link
Contributor

Hecklezz commented Dec 24, 2025

Seems you accidentality changed the permissions of 20 of the 33 files to be executable (chmod 755) from their original read and user owner write (chmod 644). There is really no need for that to have happened and seemed like it was done on accident.

@akleshchev
Copy link
Contributor Author

Seems you accidentality changed the permissions of 20 of the 33 files to be executable

Thanks for noticing. No idea how that happened, probably was same way in the original commit. Will fix some time later, probably after the holidays.

akleshchev and others added 5 commits January 5, 2026 22:33
…ocations and utf8->utf16 conversions

Fix LLFile::tmpdir failing when temp directory is located in a unicode path on windows
Add Tracy profiler tagging to LLFile that's disabled by default
Replace LLFile::utf8StringToWstring with our fsyspath std::filesystem::path adapter
Introduce std::filesystem::path to llifstream/llofstream wrappers
Add move operators to fsyspath to match copy operator
Restore LLUniqueFile RAII class for direct c file io wrapping and reducing merge conflicts with downstream code that may depend upon it

Signed-off-by: Rye <rye@alchemyviewer.org>
…he with new LLFile IO code

Add non-allocating to_chars and to_wchars string creation functions to LLUUID

Signed-off-by: Rye <rye@alchemyviewer.org>
Signed-off-by: Rye <rye@alchemyviewer.org>
Signed-off-by: Rye <rye@alchemyviewer.org>
@Hecklezz
Copy link
Contributor

Hecklezz commented Jan 6, 2026

Seems you accidentality changed the permissions of 20 of the 33 files to be executable

Thanks for noticing. No idea how that happened, probably was same way in the original commit. Will fix some time later, probably after the holidays.

After your recent commit, there are still 9 more that were changed to be executable that shouldn't be.
I also noticed there are a number of files that shouldn't be executable that have snuck in with other commits over the years, but those are outside the scope of this PR.
When this PR gets merged I'll run a script to fix them all and put up a separate PR :)

@akleshchev
Copy link
Contributor Author

After your recent commit, there are still 9 more that were changed to be executable that shouldn't be.

Fixed. For some reason those weren't visible locally.

Copy link
Contributor

@RyeMutt RyeMutt left a comment

Choose a reason for hiding this comment

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

LGTM!

@akleshchev
Copy link
Contributor Author

@RyeMutt Thank you!

@akleshchev akleshchev merged commit 516bd5e into develop-linux Jan 7, 2026
16 checks passed
@akleshchev akleshchev deleted the andreyk/apr_cleanup branch January 7, 2026 00:15
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2026
@secondlife secondlife unlocked this conversation Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants