Skip to content
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

Fix #6377: two tarballs with the same folder in them were considered as one #11855

Merged
merged 1 commit into from Jan 21, 2024

Conversation

TrueBrain
Copy link
Member

Motivation / Problem

When you have two tarballs, both with the same foldername in them, they are considered to be part of the same folder. This means they merged together.

This is especially tricky if they also contain the same files, but with different content. Which file is actually being seen by OpenTTD heavily depends on in which order the game loads the tarballs.

This was identified in #6377, but never resolved. Yes, I am solving 9 year old bugs that were marked "good first issues". Also, given nobody replied to the ticket in 7 years, it seems to not be that big of a problem. But okay.

Fixes #6377.

Description

Although #6377 makes it sound like it is trivial to fix, and that "It is now no longer needed, but noone removed it.", it doesn't actually say what to remove. Turns out, it is not removing anything, it is about adding stuff.

Prefix all files added to the tar-list with the tarname they came from. This means that even if two tarballs have the same folder in them, they are different from one another.

Limitations

This is really hard to test. Although this "should be fine", and initial testing shows that base graphics, NewGRFs and AIs work fine, it is very hard to say if not something made an assumption somewhere in how deep an info.nut or whatever has to be.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@TrueBrain TrueBrain enabled auto-merge (squash) January 21, 2024 14:39
@LordAro
Copy link
Member

LordAro commented Jan 21, 2024

What happens if there are two tarballs with the same name in different folders? :)

@TrueBrain
Copy link
Member Author

What happens if there are two tarballs with the same name in different folders? :)

Different folders were already handled, as tarballs are indexed by the folder they are found int.

@TrueBrain TrueBrain changed the title Fix: two tarballs with the same folder in them were considered as one Fix #6377: two tarballs with the same folder in them were considered as one Jan 21, 2024
@TrueBrain TrueBrain enabled auto-merge (squash) January 21, 2024 16:45
Copy link
Contributor

@rubidium42 rubidium42 left a comment

Choose a reason for hiding this comment

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

There is a visible effect on the configuration file: the filename of the tar gets included in the NewGRF configuration/presets.
As such, this change will affect the functionality of lines 1055-1059 of settings.cpp. So I guess this breaks loading NewGRF configurations from before 1.5.0.
I would say: tough luck on that.

@TrueBrain TrueBrain merged commit 0c81579 into OpenTTD:master Jan 21, 2024
19 checks passed
@TrueBrain TrueBrain deleted the tar-folders branch February 11, 2024 19:19
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.

a bug in path handling of tar files
3 participants