Skip to content

filesystem: always report the filename extension - #431

Open
msetaro wants to merge 1 commit into
ec-:mainfrom
msetaro:issue/31-extension-output-upstream
Open

msetaro wants to merge 1 commit into
ec-:mainfrom
msetaro:issue/31-extension-output-upstream

Conversation

@msetaro

@msetaro msetaro commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Unix and Windows Sys_LoadLibrary print FS_AllowedExtension's output on a true return, but the function only populated that output on false returns. Initialize the supplied output for every filename, using an empty string when there is no dot. Preserve classification, casing, and the special .so.N suffix.

This fixes the shared output contract for both platform callers. Existing callers that inspect the output only on false returns keep the same strings.

Regression:

gcc -O2 -fno-strict-aliasing -ffunction-sections -fdata-sections \
  tools/tests/extension_output.c code/qcommon/files.c code/qcommon/q_shared.c \
  -Wl,--gc-sections -o /tmp/extension-output
/tmp/extension-output

Before: the output assertion fails for an extensionless name. After: empty/extensionless/trailing-dot, ordinary extension, versioned .so and allowed/disallowed pk3 cases pass. The separate pointer-arithmetic fix in #425 is unchanged by this patch.

The fork includes these assertions in its existing unit driver. Sanitizer/pointer modes, original unit/collision/smoke/frame goldens pass. Production symbol gate passes; machine-code bytes change only in FS_AllowedExtension among 99 function sections, for the added output initialization. The text diff also renames a compiler switch-table label in FS_Seek; its bytes are unchanged. Tracked in msetaro#31.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant