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

Change alias to not substitute the same alias recursively #630

Closed
Hoekstraa opened this issue Jun 19, 2023 · 1 comment · Fixed by #741
Closed

Change alias to not substitute the same alias recursively #630

Hoekstraa opened this issue Jun 19, 2023 · 1 comment · Fixed by #741
Labels
bug Something isn't working contributor-friendly

Comments

@Hoekstraa
Copy link
Contributor

Hoekstraa commented Jun 19, 2023

As of now (dev build included), alias doesn't behave like POSIX spec says.
It naively repeats substitution 10 times if a recursive loop is found.
POSIX spec however mentions:

To prevent infinite loops in recursive aliasing, if the shell is not currently processing an alias of the same name, the word shall be replaced by the value of the alias; otherwise, it shall not be replaced.

source

The current implementation can create a situation like the following (thank you, Noxebo on Discord):

image

How to resolve:
keep track of the last used alias, and if the same alias is used again directly after, don't substitute.

@Hoekstraa Hoekstraa added bug Something isn't working contributor-friendly labels Jun 19, 2023
shyguy1412 added a commit to shyguy1412/bitburner-src that referenced this issue Jun 20, 2023
shyguy1412 added a commit to shyguy1412/bitburner-src that referenced this issue Jun 20, 2023
shyguy1412 added a commit to shyguy1412/bitburner-src that referenced this issue Jun 20, 2023
Snarling pushed a commit that referenced this issue Jun 20, 2023
@Snarling
Copy link
Collaborator

This was partially addressed by #635 but we may want to do more of a rewrite to provide full recursion-detection (instead of just checking the most recent alias substitution)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working contributor-friendly
Projects
None yet
2 participants