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

Prevent issues cause by declaring utilsfile as readonly #4690

Merged
merged 1 commit into from Apr 12, 2022

Conversation

PromoFaux
Copy link
Member

@PromoFaux PromoFaux commented Apr 11, 2022

By submitting this pull request, I confirm the following:

  • I have read and understood the contributors guide, as well as this entire template.
  • I have made only one major change in my proposed changes.
  • I have commented my proposed changes within the code.
  • I have tested my proposed changes, and have included unit tests where possible.
  • I am willing to help maintain this change if there are issues with it later.
  • I give this submission freely and claim no ownership.
  • It is compatible with the EUPL 1.2 license
  • I have squashed any insignificant commits. (git rebase)

What does this PR aim to accomplish?:

Declaring it as a readonly variable, and then sourceing it causes issues when it is declared in multiple scripts.

Simples.

@PromoFaux PromoFaux requested review from rdwebdesign and a team and removed request for rdwebdesign April 11, 2022 21:01
@PromoFaux PromoFaux force-pushed the utils-sourcing branch 2 times, most recently from 40753da to 79021f0 Compare April 11, 2022 21:17
@yubiuser
Copy link
Member

I'm not against this change but undecided if simply remove the readonly and source utils.sh whenever we need it would be the easier solution.

@PromoFaux
Copy link
Member Author

That also works, and is much more simple. I was maybe trying to be too clever by only sourcing the utils script if it needs to be. Is there any danger in sourcing a script multiple times? I guess not with this particular script

@yubiuser
Copy link
Member

Is there any danger in sourcing a script multiple times?

I don't think so. It's a pure helper script providing only functions and local variables. It does nothing on its own.

@PromoFaux
Copy link
Member Author

Then let us do it the simple way! I'll redo once I'm back from the office

…necassery

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
@PromoFaux PromoFaux changed the title Only source the utils.sh script if it has not already been sourced prevent issues cause by declaring utilsfile as readonly in some scripts Apr 12, 2022
@PromoFaux PromoFaux changed the title prevent issues cause by declaring utilsfile as readonly in some scripts Prevent issues cause by declaring utilsfile as readonly in some scripts Apr 12, 2022
@PromoFaux PromoFaux changed the title Prevent issues cause by declaring utilsfile as readonly in some scripts Prevent issues cause by declaring utilsfile as readonly Apr 12, 2022
@PromoFaux PromoFaux merged commit 29a867d into development Apr 12, 2022
@PromoFaux PromoFaux deleted the utils-sourcing branch April 12, 2022 18:17
@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/pi-hole-ftl-v5-15-web-v5-12-and-core-v5-10-released/54987/1

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.

None yet

4 participants